app: implement GObject::constructed() instead of ::constructor()

This commit is contained in:
Michael Natterer 2011-01-13 10:06:07 +01:00
parent c1b3575648
commit 503a9cebce
13 changed files with 242 additions and 347 deletions

View File

@ -55,14 +55,12 @@
/* local function prototypes */ /* local function prototypes */
static GObject * gimp_align_tool_constructor (GType type, static void gimp_align_tool_constructed (GObject *object);
guint n_params, static void gimp_align_tool_finalize (GObject *object);
GObjectConstructParam *params);
static gboolean gimp_align_tool_initialize (GimpTool *tool, static gboolean gimp_align_tool_initialize (GimpTool *tool,
GimpDisplay *display, GimpDisplay *display,
GError **error); GError **error);
static void gimp_align_tool_finalize (GObject *object);
static void gimp_align_tool_control (GimpTool *tool, static void gimp_align_tool_control (GimpTool *tool,
GimpToolAction action, GimpToolAction action,
GimpDisplay *display); GimpDisplay *display);
@ -148,7 +146,7 @@ gimp_align_tool_class_init (GimpAlignToolClass *klass)
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->finalize = gimp_align_tool_finalize; object_class->finalize = gimp_align_tool_finalize;
object_class->constructor = gimp_align_tool_constructor; object_class->constructed = gimp_align_tool_constructed;
tool_class->initialize = gimp_align_tool_initialize; tool_class->initialize = gimp_align_tool_initialize;
tool_class->control = gimp_align_tool_control; tool_class->control = gimp_align_tool_control;
@ -182,22 +180,16 @@ gimp_align_tool_init (GimpAlignTool *align_tool)
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_MOVE); gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_MOVE);
} }
static GObject * static void
gimp_align_tool_constructor (GType type, gimp_align_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool; GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object);
GimpAlignTool *align_tool; GObject *options = G_OBJECT (gimp_tool_get_options (tool));
GtkContainer *container; GtkContainer *container;
GObject *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object);
align_tool = GIMP_ALIGN_TOOL (object);
options = G_OBJECT (gimp_tool_get_options (tool));
/* This line of code is evil because it relies on that the 'options' /* This line of code is evil because it relies on that the 'options'
* object is fully constructed before we get here, which is not * object is fully constructed before we get here, which is not
@ -211,8 +203,6 @@ gimp_align_tool_constructor (GType type,
gtk_container_add (container, align_tool->controls); gtk_container_add (container, align_tool->controls);
gtk_widget_show (align_tool->controls); gtk_widget_show (align_tool->controls);
} }
return object;
} }
static void static void

View File

@ -43,42 +43,40 @@
#include "gimptoolcontrol.h" #include "gimptoolcontrol.h"
static GObject * gimp_brush_tool_constructor (GType type, static void gimp_brush_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_brush_tool_motion (GimpTool *tool, static void gimp_brush_tool_motion (GimpTool *tool,
const GimpCoords *coords, const GimpCoords *coords,
guint32 time, guint32 time,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display); GimpDisplay *display);
static void gimp_brush_tool_oper_update (GimpTool *tool, static void gimp_brush_tool_oper_update (GimpTool *tool,
const GimpCoords *coords, const GimpCoords *coords,
GdkModifierType state, GdkModifierType state,
gboolean proximity, gboolean proximity,
GimpDisplay *display); GimpDisplay *display);
static void gimp_brush_tool_cursor_update (GimpTool *tool, static void gimp_brush_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords, const GimpCoords *coords,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display); GimpDisplay *display);
static void gimp_brush_tool_options_notify (GimpTool *tool, static void gimp_brush_tool_options_notify (GimpTool *tool,
GimpToolOptions *options, GimpToolOptions *options,
const GParamSpec *pspec); const GParamSpec *pspec);
static void gimp_brush_tool_draw (GimpDrawTool *draw_tool); static void gimp_brush_tool_draw (GimpDrawTool *draw_tool);
static void gimp_brush_tool_brush_changed (GimpContext *context, static void gimp_brush_tool_brush_changed (GimpContext *context,
GimpBrush *brush, GimpBrush *brush,
GimpBrushTool *brush_tool); GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core, static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core,
GimpBrush *brush, GimpBrush *brush,
GimpBrushTool *brush_tool); GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core, static void gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core,
GimpBrush *brush, GimpBrush *brush,
GimpBrushTool *brush_tool); GimpBrushTool *brush_tool);
static void gimp_brush_tool_notify_brush (GimpDisplayConfig *config, static void gimp_brush_tool_notify_brush (GimpDisplayConfig *config,
GParamSpec *pspec, GParamSpec *pspec,
GimpBrushTool *brush_tool); GimpBrushTool *brush_tool);
G_DEFINE_TYPE (GimpBrushTool, gimp_brush_tool, GIMP_TYPE_PAINT_TOOL) G_DEFINE_TYPE (GimpBrushTool, gimp_brush_tool, GIMP_TYPE_PAINT_TOOL)
@ -93,14 +91,14 @@ gimp_brush_tool_class_init (GimpBrushToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_brush_tool_constructor; object_class->constructed = gimp_brush_tool_constructed;
tool_class->motion = gimp_brush_tool_motion; tool_class->motion = gimp_brush_tool_motion;
tool_class->oper_update = gimp_brush_tool_oper_update; tool_class->oper_update = gimp_brush_tool_oper_update;
tool_class->cursor_update = gimp_brush_tool_cursor_update; tool_class->cursor_update = gimp_brush_tool_cursor_update;
tool_class->options_notify = gimp_brush_tool_options_notify; tool_class->options_notify = gimp_brush_tool_options_notify;
draw_tool_class->draw = gimp_brush_tool_draw; draw_tool_class->draw = gimp_brush_tool_draw;
} }
static void static void
@ -123,22 +121,16 @@ gimp_brush_tool_init (GimpBrushTool *brush_tool)
brush_tool->brush_y = 0.0; brush_tool->brush_y = 0.0;
} }
static GObject * static void
gimp_brush_tool_constructor (GType type, gimp_brush_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool; GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (object);
GimpPaintTool *paint_tool; GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (object);
GimpBrushTool *brush_tool;
GimpDisplayConfig *display_config; GimpDisplayConfig *display_config;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object);
paint_tool = GIMP_PAINT_TOOL (object);
brush_tool = GIMP_BRUSH_TOOL (object);
g_assert (GIMP_IS_BRUSH_CORE (paint_tool->core)); g_assert (GIMP_IS_BRUSH_CORE (paint_tool->core));
@ -164,8 +156,6 @@ gimp_brush_tool_constructor (GType type,
g_signal_connect_after (paint_tool->core, "set-brush", g_signal_connect_after (paint_tool->core, "set-brush",
G_CALLBACK (gimp_brush_tool_set_brush_after), G_CALLBACK (gimp_brush_tool_set_brush_after),
brush_tool); brush_tool);
return object;
} }
static void static void

View File

@ -43,39 +43,37 @@
/* local function prototypes */ /* local function prototypes */
static GObject * gimp_color_picker_tool_constructor (GType type, static void gimp_color_picker_tool_constructed (GObject *object);
guint n_params, static void gimp_color_picker_tool_finalize (GObject *object);
GObjectConstructParam *params);
static void gimp_color_picker_tool_finalize (GObject *object);
static void gimp_color_picker_tool_control (GimpTool *tool, static void gimp_color_picker_tool_control (GimpTool *tool,
GimpToolAction action, GimpToolAction action,
GimpDisplay *display); GimpDisplay *display);
static void gimp_color_picker_tool_modifier_key (GimpTool *tool, static void gimp_color_picker_tool_modifier_key (GimpTool *tool,
GdkModifierType key, GdkModifierType key,
gboolean press, gboolean press,
GdkModifierType state, GdkModifierType state,
GimpDisplay *display); GimpDisplay *display);
static void gimp_color_picker_tool_oper_update (GimpTool *tool, static void gimp_color_picker_tool_oper_update (GimpTool *tool,
const GimpCoords *coords, const GimpCoords *coords,
GdkModifierType state, GdkModifierType state,
gboolean proximity, gboolean proximity,
GimpDisplay *display); GimpDisplay *display);
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool, static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state, GimpColorPickState pick_state,
GimpImageType sample_type, GimpImageType sample_type,
GimpRGB *color, GimpRGB *color,
gint color_index); gint color_index);
static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool); static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_response (GtkWidget *widget, static void gimp_color_picker_tool_info_response (GtkWidget *widget,
gint response_id, gint response_id,
GimpColorPickerTool *picker_tool); GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool, static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpImageType sample_type, GimpImageType sample_type,
GimpRGB *color, GimpRGB *color,
gint color_index); gint color_index);
G_DEFINE_TYPE (GimpColorPickerTool, gimp_color_picker_tool, G_DEFINE_TYPE (GimpColorPickerTool, gimp_color_picker_tool,
@ -108,7 +106,7 @@ gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
object_class->constructor = gimp_color_picker_tool_constructor; object_class->constructed = gimp_color_picker_tool_constructed;
object_class->finalize = gimp_color_picker_tool_finalize; object_class->finalize = gimp_color_picker_tool_finalize;
tool_class->control = gimp_color_picker_tool_control; tool_class->control = gimp_color_picker_tool_control;
@ -126,22 +124,16 @@ gimp_color_picker_tool_init (GimpColorPickerTool *tool)
color_tool->pick_mode = GIMP_COLOR_PICK_MODE_FOREGROUND; color_tool->pick_mode = GIMP_COLOR_PICK_MODE_FOREGROUND;
} }
static GObject * static void
gimp_color_picker_tool_constructor (GType type, gimp_color_picker_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object);
gimp_color_tool_enable (GIMP_COLOR_TOOL (object), gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
GIMP_COLOR_TOOL_GET_OPTIONS (tool)); GIMP_COLOR_TOOL_GET_OPTIONS (tool));
return object;
} }
static void static void

View File

@ -58,53 +58,55 @@ struct _GimpCropToolClass
static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_crop_tool_constructor (GType type, static void gimp_crop_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_crop_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_crop_tool_button_press (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonPressType press_type,
GimpDisplay *display);
static void gimp_crop_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_crop_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_crop_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_crop_tool_draw (GimpDrawTool *draw_tool);
static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h);
static void gimp_crop_tool_update_option_defaults (GimpCropTool *crop_tool,
gboolean ignore_pending);
static GimpRectangleConstraint
gimp_crop_tool_get_constraint (GimpCropTool *crop_tool);
static void gimp_crop_tool_options_notify (GimpCropOptions *options, static void gimp_crop_tool_control (GimpTool *tool,
GParamSpec *pspec, GimpToolAction action,
GimpCropTool *crop_tool); GimpDisplay *display);
static void gimp_crop_tool_image_changed (GimpCropTool *crop_tool, static void gimp_crop_tool_button_press (GimpTool *tool,
GimpImage *image, const GimpCoords *coords,
GimpContext *context); guint32 time,
static void gimp_crop_tool_image_size_changed (GimpCropTool *crop_tool); GdkModifierType state,
static void gimp_crop_tool_cancel (GimpRectangleTool *rect_tool); GimpButtonPressType press_type,
static gboolean gimp_crop_tool_rectangle_change_complete (GimpRectangleTool *rect_tool); GimpDisplay *display);
static void gimp_crop_tool_button_release (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_crop_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_crop_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_crop_tool_draw (GimpDrawTool *draw_tool);
static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h);
static void gimp_crop_tool_update_option_defaults (GimpCropTool *crop_tool,
gboolean ignore_pending);
static GimpRectangleConstraint
gimp_crop_tool_get_constraint (GimpCropTool *crop_tool);
static void gimp_crop_tool_options_notify (GimpCropOptions *options,
GParamSpec *pspec,
GimpCropTool *crop_tool);
static void gimp_crop_tool_image_changed (GimpCropTool *crop_tool,
GimpImage *image,
GimpContext *context);
static void gimp_crop_tool_image_size_changed (GimpCropTool *crop_tool);
static void gimp_crop_tool_cancel (GimpRectangleTool *rect_tool);
static gboolean gimp_crop_tool_rectangle_change_complete (GimpRectangleTool *rect_tool);
G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL, G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL,
@ -140,7 +142,7 @@ gimp_crop_tool_class_init (GimpCropToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_crop_tool_constructor; object_class->constructed = gimp_crop_tool_constructed;
object_class->set_property = gimp_rectangle_tool_set_property; object_class->set_property = gimp_rectangle_tool_set_property;
object_class->get_property = gimp_rectangle_tool_get_property; object_class->get_property = gimp_rectangle_tool_get_property;
@ -181,30 +183,25 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
crop_tool->current_image = NULL; crop_tool->current_image = NULL;
} }
static GObject * static void
gimp_crop_tool_constructor (GType type, gimp_crop_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpCropTool *crop_tool = GIMP_CROP_TOOL (object);
GimpCropTool *crop_tool;
GimpCropOptions *options; GimpCropOptions *options;
GimpContext *gimp_context; GimpContext *gimp_context;
GimpToolInfo *tool_info; GimpToolInfo *tool_info;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_rectangle_tool_constructor (object); gimp_rectangle_tool_constructor (object);
g_object_get (object, g_object_get (object,
"tool-info", &tool_info, "tool-info", &tool_info,
NULL); NULL);
gimp_context = gimp_get_user_context (tool_info->gimp); gimp_context = gimp_get_user_context (tool_info->gimp);
crop_tool = GIMP_CROP_TOOL (object);
g_signal_connect_object (gimp_context, "image-changed", g_signal_connect_object (gimp_context, "image-changed",
G_CALLBACK (gimp_crop_tool_image_changed), G_CALLBACK (gimp_crop_tool_image_changed),
crop_tool, crop_tool,
@ -231,10 +228,7 @@ gimp_crop_tool_constructor (GType type,
gimp_rectangle_tool_set_constraint (GIMP_RECTANGLE_TOOL (object), gimp_rectangle_tool_set_constraint (GIMP_RECTANGLE_TOOL (object),
gimp_crop_tool_get_constraint (crop_tool)); gimp_crop_tool_get_constraint (crop_tool));
gimp_crop_tool_update_option_defaults (crop_tool, gimp_crop_tool_update_option_defaults (crop_tool, FALSE);
FALSE);
return object;
} }
static void static void

View File

@ -61,9 +61,7 @@ typedef struct
} FgSelectStroke; } FgSelectStroke;
static GObject * gimp_foreground_select_tool_constructor (GType type, static void gimp_foreground_select_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_foreground_select_tool_finalize (GObject *object); static void gimp_foreground_select_tool_finalize (GObject *object);
static void gimp_foreground_select_tool_control (GimpTool *tool, static void gimp_foreground_select_tool_control (GimpTool *tool,
@ -160,7 +158,7 @@ gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
free_select_tool_class = GIMP_FREE_SELECT_TOOL_CLASS (klass); free_select_tool_class = GIMP_FREE_SELECT_TOOL_CLASS (klass);
object_class->constructor = gimp_foreground_select_tool_constructor; object_class->constructed = gimp_foreground_select_tool_constructed;
object_class->finalize = gimp_foreground_select_tool_finalize; object_class->finalize = gimp_foreground_select_tool_finalize;
tool_class->control = gimp_foreground_select_tool_control; tool_class->control = gimp_foreground_select_tool_control;
@ -199,23 +197,17 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
fg_select->mask = NULL; fg_select->mask = NULL;
} }
static GObject * static void
gimp_foreground_select_tool_constructor (GType type, gimp_foreground_select_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpToolOptions *options = GIMP_TOOL_GET_OPTIONS (object);
GimpToolOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
options = GIMP_TOOL_GET_OPTIONS (object);
g_signal_connect_object (options, "notify", g_signal_connect_object (options, "notify",
G_CALLBACK (gimp_foreground_select_options_notify), G_CALLBACK (gimp_foreground_select_options_notify),
object, 0); object, 0);
return object;
} }
static void static void

View File

@ -32,23 +32,21 @@ enum
}; };
static GObject * gimp_foreground_select_tool_undo_constructor (GType type, static void gimp_foreground_select_tool_undo_constructed (GObject *object);
guint n_params, static void gimp_foreground_select_tool_undo_set_property (GObject *object,
GObjectConstructParam *params); guint property_id,
static void gimp_foreground_select_tool_undo_set_property (GObject *object, const GValue *value,
guint property_id, GParamSpec *pspec);
const GValue *value, static void gimp_foreground_select_tool_undo_get_property (GObject *object,
GParamSpec *pspec); guint property_id,
static void gimp_foreground_select_tool_undo_get_property (GObject *object, GValue *value,
guint property_id, GParamSpec *pspec);
GValue *value,
GParamSpec *pspec);
static void gimp_foreground_select_tool_undo_pop (GimpUndo *undo, static void gimp_foreground_select_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode, GimpUndoMode undo_mode,
GimpUndoAccumulator *accum); GimpUndoAccumulator *accum);
static void gimp_foreground_select_tool_undo_free (GimpUndo *undo, static void gimp_foreground_select_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode); GimpUndoMode undo_mode);
G_DEFINE_TYPE (GimpForegroundSelectToolUndo, gimp_foreground_select_tool_undo, G_DEFINE_TYPE (GimpForegroundSelectToolUndo, gimp_foreground_select_tool_undo,
@ -63,7 +61,7 @@ gimp_foreground_select_tool_undo_class_init (GimpForegroundSelectToolUndoClass *
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
object_class->constructor = gimp_foreground_select_tool_undo_constructor; object_class->constructed = gimp_foreground_select_tool_undo_constructed;
object_class->set_property = gimp_foreground_select_tool_undo_set_property; object_class->set_property = gimp_foreground_select_tool_undo_set_property;
object_class->get_property = gimp_foreground_select_tool_undo_get_property; object_class->get_property = gimp_foreground_select_tool_undo_get_property;
@ -83,16 +81,14 @@ gimp_foreground_select_tool_undo_init (GimpForegroundSelectToolUndo *undo)
{ {
} }
static GObject * static void
gimp_foreground_select_tool_undo_constructor (GType type, gimp_foreground_select_tool_undo_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object;
GimpForegroundSelectToolUndo *foreground_select_tool_undo; GimpForegroundSelectToolUndo *foreground_select_tool_undo;
GimpForegroundSelectTool *foreground_select_tool; GimpForegroundSelectTool *foreground_select_tool;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
foreground_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (object); foreground_select_tool_undo = GIMP_FOREGROUND_SELECT_TOOL_UNDO (object);
@ -102,8 +98,6 @@ gimp_foreground_select_tool_undo_constructor (GType type,
g_object_add_weak_pointer (G_OBJECT (foreground_select_tool_undo->foreground_select_tool), g_object_add_weak_pointer (G_OBJECT (foreground_select_tool_undo->foreground_select_tool),
(gpointer) &foreground_select_tool_undo->foreground_select_tool); (gpointer) &foreground_select_tool_undo->foreground_select_tool);
return object;
} }
static void static void

View File

@ -71,9 +71,7 @@ static void gimp_image_map_tool_base_init (GimpImageMapToolClass *klas
static void gimp_image_map_tool_init (GimpImageMapTool *im_tool); static void gimp_image_map_tool_init (GimpImageMapTool *im_tool);
static GObject * gimp_image_map_tool_constructor (GType type, static void gimp_image_map_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_image_map_tool_finalize (GObject *object); static void gimp_image_map_tool_finalize (GObject *object);
static gboolean gimp_image_map_tool_initialize (GimpTool *tool, static gboolean gimp_image_map_tool_initialize (GimpTool *tool,
@ -155,7 +153,7 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
object_class->constructor = gimp_image_map_tool_constructor; object_class->constructed = gimp_image_map_tool_constructed;
object_class->finalize = gimp_image_map_tool_finalize; object_class->finalize = gimp_image_map_tool_finalize;
tool_class->initialize = gimp_image_map_tool_initialize; tool_class->initialize = gimp_image_map_tool_initialize;
@ -211,25 +209,20 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
image_map_tool->label_group = NULL; image_map_tool->label_group = NULL;
} }
static GObject * static void
gimp_image_map_tool_constructor (GType type, gimp_image_map_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (object);
GimpImageMapTool *image_map_tool;
GimpImageMapToolClass *klass; GimpImageMapToolClass *klass;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
image_map_tool = GIMP_IMAGE_MAP_TOOL (object); klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
if (klass->get_operation) if (klass->get_operation)
image_map_tool->operation = klass->get_operation (image_map_tool, image_map_tool->operation = klass->get_operation (image_map_tool,
&image_map_tool->config); &image_map_tool->config);
return object;
} }
static void static void

View File

@ -51,9 +51,7 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static GObject * gimp_paint_tool_constructor (GType type, static void gimp_paint_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_paint_tool_finalize (GObject *object); static void gimp_paint_tool_finalize (GObject *object);
static void gimp_paint_tool_control (GimpTool *tool, static void gimp_paint_tool_control (GimpTool *tool,
@ -110,7 +108,7 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_paint_tool_constructor; object_class->constructed = gimp_paint_tool_constructed;
object_class->finalize = gimp_paint_tool_finalize; object_class->finalize = gimp_paint_tool_finalize;
tool_class->control = gimp_paint_tool_control; tool_class->control = gimp_paint_tool_control;
@ -147,22 +145,16 @@ gimp_paint_tool_init (GimpPaintTool *paint_tool)
paint_tool->core = NULL; paint_tool->core = NULL;
} }
static GObject * static void
gimp_paint_tool_constructor (GType type, gimp_paint_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool; GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (object);
GimpPaintOptions *options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
GimpPaintInfo *paint_info; GimpPaintInfo *paint_info;
GimpPaintTool *paint_tool;
GimpPaintOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object);
paint_tool = GIMP_PAINT_TOOL (object);
options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
g_assert (GIMP_IS_TOOL_INFO (tool->tool_info)); g_assert (GIMP_IS_TOOL_INFO (tool->tool_info));
g_assert (GIMP_IS_PAINT_INFO (tool->tool_info->paint_info)); g_assert (GIMP_IS_PAINT_INFO (tool->tool_info->paint_info));
@ -180,8 +172,6 @@ gimp_paint_tool_constructor (GType type,
tool, 0); tool, 0);
gimp_paint_tool_hard_notify (options, NULL, tool); gimp_paint_tool_hard_notify (options, NULL, tool);
return object;
} }
static void static void

View File

@ -46,13 +46,11 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static GObject * gimp_perspective_clone_tool_constructor (GType type, static void gimp_perspective_clone_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static gboolean gimp_perspective_clone_tool_initialize (GimpTool *tool, static gboolean gimp_perspective_clone_tool_initialize (GimpTool *tool,
GimpDisplay *display, GimpDisplay *display,
GError **error); GError **error);
static gboolean gimp_perspective_clone_tool_has_display (GimpTool *tool, static gboolean gimp_perspective_clone_tool_has_display (GimpTool *tool,
GimpDisplay *display); GimpDisplay *display);
@ -137,7 +135,7 @@ gimp_perspective_clone_tool_class_init (GimpPerspectiveCloneToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_perspective_clone_tool_constructor; object_class->constructed = gimp_perspective_clone_tool_constructed;
tool_class->initialize = gimp_perspective_clone_tool_initialize; tool_class->initialize = gimp_perspective_clone_tool_initialize;
tool_class->has_display = gimp_perspective_clone_tool_has_display; tool_class->has_display = gimp_perspective_clone_tool_has_display;
@ -180,21 +178,17 @@ gimp_perspective_clone_tool_init (GimpPerspectiveCloneTool *clone_tool)
#endif #endif
} }
static GObject * static void
gimp_perspective_clone_tool_constructor (GType type, gimp_perspective_clone_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool; GimpPerspectiveCloneTool *clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (object);
GimpPerspectiveCloneTool *clone_tool;
GimpPerspectiveCloneOptions *options; GimpPerspectiveCloneOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object); options = GIMP_PERSPECTIVE_CLONE_TOOL_GET_OPTIONS (tool);
clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (object);
options = GIMP_PERSPECTIVE_CLONE_TOOL_GET_OPTIONS (tool);
g_signal_connect_object (options, g_signal_connect_object (options,
"notify::clone-mode", "notify::clone-mode",
@ -202,8 +196,6 @@ gimp_perspective_clone_tool_constructor (GType type,
clone_tool, 0); clone_tool, 0);
gimp_perspective_clone_tool_mode_notify (options, NULL, clone_tool); gimp_perspective_clone_tool_mode_notify (options, NULL, clone_tool);
return object;
} }
static gboolean static gboolean

View File

@ -81,9 +81,8 @@ typedef struct GimpRectangleSelectToolPrivate
static void gimp_rectangle_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_rectangle_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject *gimp_rectangle_select_tool_constructor (GType type, static void gimp_rectangle_select_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_rectangle_select_tool_control (GimpTool *tool, static void gimp_rectangle_select_tool_control (GimpTool *tool,
GimpToolAction action, GimpToolAction action,
GimpDisplay *display); GimpDisplay *display);
@ -183,7 +182,7 @@ gimp_rectangle_select_tool_class_init (GimpRectangleSelectToolClass *klass)
g_type_class_add_private (klass, sizeof (GimpRectangleSelectToolPrivate)); g_type_class_add_private (klass, sizeof (GimpRectangleSelectToolPrivate));
object_class->constructor = gimp_rectangle_select_tool_constructor; object_class->constructed = gimp_rectangle_select_tool_constructed;
object_class->set_property = gimp_rectangle_tool_set_property; object_class->set_property = gimp_rectangle_tool_set_property;
object_class->get_property = gimp_rectangle_tool_get_property; object_class->get_property = gimp_rectangle_tool_get_property;
@ -241,17 +240,15 @@ gimp_rectangle_select_tool_init (GimpRectangleSelectTool *rect_sel_tool)
priv->press_y = 0.0; priv->press_y = 0.0;
} }
static GObject * static void
gimp_rectangle_select_tool_constructor (GType type, gimp_rectangle_select_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectTool *rect_sel_tool; GimpRectangleSelectOptions *options;
GimpRectangleSelectOptions *options; GimpRectangleSelectToolPrivate *priv;
GimpRectangleSelectToolPrivate *priv;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_rectangle_tool_constructor (object); gimp_rectangle_tool_constructor (object);
@ -270,8 +267,6 @@ gimp_rectangle_select_tool_constructor (GType type,
object, 0); object, 0);
gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE); gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
return object;
} }
static void static void

View File

@ -76,9 +76,7 @@
static void gimp_text_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_text_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_text_tool_constructor (GType type, static void gimp_text_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_text_tool_dispose (GObject *object); static void gimp_text_tool_dispose (GObject *object);
static void gimp_text_tool_finalize (GObject *object); static void gimp_text_tool_finalize (GObject *object);
@ -206,7 +204,7 @@ gimp_text_tool_class_init (GimpTextToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_text_tool_constructor; object_class->constructed = gimp_text_tool_constructed;
object_class->dispose = gimp_text_tool_dispose; object_class->dispose = gimp_text_tool_dispose;
object_class->finalize = gimp_text_tool_finalize; object_class->finalize = gimp_text_tool_finalize;
object_class->set_property = gimp_rectangle_tool_set_property; object_class->set_property = gimp_rectangle_tool_set_property;
@ -275,22 +273,17 @@ gimp_text_tool_init (GimpTextTool *text_tool)
"context/context-font-select-set"); "context/context-font-select-set");
} }
static GObject * static void
gimp_text_tool_constructor (GType type, gimp_text_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTextTool *text_tool = GIMP_TEXT_TOOL (object);
GimpTextTool *text_tool; GimpTextOptions *options = GIMP_TEXT_TOOL_GET_OPTIONS (text_tool);
GimpTextOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_rectangle_tool_constructor (object); gimp_rectangle_tool_constructor (object);
text_tool = GIMP_TEXT_TOOL (object);
options = GIMP_TEXT_TOOL_GET_OPTIONS (text_tool);
text_tool->proxy = g_object_new (GIMP_TYPE_TEXT, NULL); text_tool->proxy = g_object_new (GIMP_TYPE_TEXT, NULL);
gimp_text_options_connect_text (options, text_tool->proxy); gimp_text_options_connect_text (options, text_tool->proxy);
@ -302,8 +295,6 @@ gimp_text_tool_constructor (GType type,
g_object_set (options, g_object_set (options,
"highlight", FALSE, "highlight", FALSE,
NULL); NULL);
return object;
} }
static void static void

View File

@ -70,9 +70,7 @@
#define MIN_HANDLE_SIZE 6 #define MIN_HANDLE_SIZE 6
static GObject * gimp_transform_tool_constructor (GType type, static void gimp_transform_tool_constructed (GObject *object);
guint n_params,
GObjectConstructParam *params);
static void gimp_transform_tool_finalize (GObject *object); static void gimp_transform_tool_finalize (GObject *object);
static gboolean gimp_transform_tool_initialize (GimpTool *tool, static gboolean gimp_transform_tool_initialize (GimpTool *tool,
@ -161,7 +159,7 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass);
object_class->constructor = gimp_transform_tool_constructor; object_class->constructed = gimp_transform_tool_constructed;
object_class->finalize = gimp_transform_tool_finalize; object_class->finalize = gimp_transform_tool_finalize;
tool_class->initialize = gimp_transform_tool_initialize; tool_class->initialize = gimp_transform_tool_initialize;
@ -238,29 +236,21 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
tr_tool->dialog = NULL; tr_tool->dialog = NULL;
} }
static GObject * static void
gimp_transform_tool_constructor (GType type, gimp_transform_tool_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTool *tool = GIMP_TOOL (object);
GimpTool *tool; GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (object);
GimpTransformTool *tr_tool; GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
GimpTransformOptions *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
tool = GIMP_TOOL (object);
tr_tool = GIMP_TRANSFORM_TOOL (object);
options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
if (tr_tool->use_grid) if (tr_tool->use_grid)
{ {
tr_tool->type = options->type; tr_tool->type = options->type;
tr_tool->direction = options->direction; tr_tool->direction = options->direction;
} }
return object;
} }
static void static void

View File

@ -35,23 +35,21 @@ enum
}; };
static GObject * gimp_transform_tool_undo_constructor (GType type, static void gimp_transform_tool_undo_constructed (GObject *object);
guint n_params, static void gimp_transform_tool_undo_set_property (GObject *object,
GObjectConstructParam *params); guint property_id,
static void gimp_transform_tool_undo_set_property (GObject *object, const GValue *value,
guint property_id, GParamSpec *pspec);
const GValue *value, static void gimp_transform_tool_undo_get_property (GObject *object,
GParamSpec *pspec); guint property_id,
static void gimp_transform_tool_undo_get_property (GObject *object, GValue *value,
guint property_id, GParamSpec *pspec);
GValue *value,
GParamSpec *pspec);
static void gimp_transform_tool_undo_pop (GimpUndo *undo, static void gimp_transform_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode, GimpUndoMode undo_mode,
GimpUndoAccumulator *accum); GimpUndoAccumulator *accum);
static void gimp_transform_tool_undo_free (GimpUndo *undo, static void gimp_transform_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode); GimpUndoMode undo_mode);
G_DEFINE_TYPE (GimpTransformToolUndo, gimp_transform_tool_undo, GIMP_TYPE_UNDO) G_DEFINE_TYPE (GimpTransformToolUndo, gimp_transform_tool_undo, GIMP_TYPE_UNDO)
@ -65,7 +63,7 @@ gimp_transform_tool_undo_class_init (GimpTransformToolUndoClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass); GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
object_class->constructor = gimp_transform_tool_undo_constructor; object_class->constructed = gimp_transform_tool_undo_constructed;
object_class->set_property = gimp_transform_tool_undo_set_property; object_class->set_property = gimp_transform_tool_undo_set_property;
object_class->get_property = gimp_transform_tool_undo_get_property; object_class->get_property = gimp_transform_tool_undo_get_property;
@ -85,19 +83,15 @@ gimp_transform_tool_undo_init (GimpTransformToolUndo *undo)
{ {
} }
static GObject * static void
gimp_transform_tool_undo_constructor (GType type, gimp_transform_tool_undo_constructed (GObject *object)
guint n_params,
GObjectConstructParam *params)
{ {
GObject *object; GimpTransformToolUndo *transform_tool_undo = GIMP_TRANSFORM_TOOL_UNDO (object);
GimpTransformToolUndo *transform_tool_undo;
GimpTransformTool *transform_tool; GimpTransformTool *transform_tool;
gint i; gint i;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
transform_tool_undo = GIMP_TRANSFORM_TOOL_UNDO (object);
g_assert (GIMP_IS_TRANSFORM_TOOL (transform_tool_undo->transform_tool)); g_assert (GIMP_IS_TRANSFORM_TOOL (transform_tool_undo->transform_tool));
@ -113,8 +107,6 @@ gimp_transform_tool_undo_constructor (GType type,
g_object_add_weak_pointer (G_OBJECT (transform_tool_undo->transform_tool), g_object_add_weak_pointer (G_OBJECT (transform_tool_undo->transform_tool),
(gpointer) &transform_tool_undo->transform_tool); (gpointer) &transform_tool_undo->transform_tool);
return object;
} }
static void static void