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 */
static GObject * gimp_align_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_align_tool_constructed (GObject *object);
static void gimp_align_tool_finalize (GObject *object);
static gboolean gimp_align_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error);
static void gimp_align_tool_finalize (GObject *object);
static void gimp_align_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
@ -148,7 +146,7 @@ gimp_align_tool_class_init (GimpAlignToolClass *klass)
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
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->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);
}
static GObject *
gimp_align_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_align_tool_constructed (GObject *object)
{
GObject *object;
GimpTool *tool;
GimpAlignTool *align_tool;
GimpTool *tool = GIMP_TOOL (object);
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object);
GObject *options = G_OBJECT (gimp_tool_get_options (tool));
GtkContainer *container;
GObject *options;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
tool = GIMP_TOOL (object);
align_tool = GIMP_ALIGN_TOOL (object);
options = G_OBJECT (gimp_tool_get_options (tool));
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
/* This line of code is evil because it relies on that the 'options'
* 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_widget_show (align_tool->controls);
}
return object;
}
static void

View File

@ -43,42 +43,40 @@
#include "gimptoolcontrol.h"
static GObject * gimp_brush_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_brush_tool_constructed (GObject *object);
static void gimp_brush_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static void gimp_brush_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_brush_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_brush_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec);
static void gimp_brush_tool_motion (GimpTool *tool,
const GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static void gimp_brush_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_brush_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_brush_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
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,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_notify_brush (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_brush_changed (GimpContext *context,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush (GimpBrushCore *brush_core,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_set_brush_after (GimpBrushCore *brush_core,
GimpBrush *brush,
GimpBrushTool *brush_tool);
static void gimp_brush_tool_notify_brush (GimpDisplayConfig *config,
GParamSpec *pspec,
GimpBrushTool *brush_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);
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->oper_update = gimp_brush_tool_oper_update;
tool_class->cursor_update = gimp_brush_tool_cursor_update;
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
@ -123,22 +121,16 @@ gimp_brush_tool_init (GimpBrushTool *brush_tool)
brush_tool->brush_y = 0.0;
}
static GObject *
gimp_brush_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_brush_tool_constructed (GObject *object)
{
GObject *object;
GimpTool *tool;
GimpPaintTool *paint_tool;
GimpBrushTool *brush_tool;
GimpTool *tool = GIMP_TOOL (object);
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (object);
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (object);
GimpDisplayConfig *display_config;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
tool = GIMP_TOOL (object);
paint_tool = GIMP_PAINT_TOOL (object);
brush_tool = GIMP_BRUSH_TOOL (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
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_CALLBACK (gimp_brush_tool_set_brush_after),
brush_tool);
return object;
}
static void

View File

@ -43,39 +43,37 @@
/* local function prototypes */
static GObject * gimp_color_picker_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_color_picker_tool_finalize (GObject *object);
static void gimp_color_picker_tool_constructed (GObject *object);
static void gimp_color_picker_tool_finalize (GObject *object);
static void gimp_color_picker_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_color_picker_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_color_picker_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_color_picker_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_color_picker_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static void gimp_color_picker_tool_oper_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_response (GtkWidget *widget,
gint response_id,
GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
static void gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_response (GtkWidget *widget,
gint response_id,
GimpColorPickerTool *picker_tool);
static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
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);
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;
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;
}
static GObject *
gimp_color_picker_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_color_picker_tool_constructed (GObject *object)
{
GObject *object;
GimpTool *tool;
GimpTool *tool = GIMP_TOOL (object);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
tool = GIMP_TOOL (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_color_tool_enable (GIMP_COLOR_TOOL (object),
GIMP_COLOR_TOOL_GET_OPTIONS (tool));
return object;
}
static void

View File

@ -58,53 +58,55 @@ struct _GimpCropToolClass
static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_crop_tool_constructor (GType type,
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_constructed (GObject *object);
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);
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,
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,
@ -140,7 +142,7 @@ gimp_crop_tool_class_init (GimpCropToolClass *klass)
GimpToolClass *tool_class = GIMP_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->get_property = gimp_rectangle_tool_get_property;
@ -181,30 +183,25 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
crop_tool->current_image = NULL;
}
static GObject *
gimp_crop_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_crop_tool_constructed (GObject *object)
{
GObject *object;
GimpCropTool *crop_tool;
GimpCropTool *crop_tool = GIMP_CROP_TOOL (object);
GimpCropOptions *options;
GimpContext *gimp_context;
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);
g_object_get (object,
"tool-info", &tool_info,
NULL);
gimp_context = gimp_get_user_context (tool_info->gimp);
crop_tool = GIMP_CROP_TOOL (object);
g_signal_connect_object (gimp_context, "image-changed",
G_CALLBACK (gimp_crop_tool_image_changed),
crop_tool,
@ -231,10 +228,7 @@ gimp_crop_tool_constructor (GType type,
gimp_rectangle_tool_set_constraint (GIMP_RECTANGLE_TOOL (object),
gimp_crop_tool_get_constraint (crop_tool));
gimp_crop_tool_update_option_defaults (crop_tool,
FALSE);
return object;
gimp_crop_tool_update_option_defaults (crop_tool, FALSE);
}
static void

View File

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

View File

@ -32,23 +32,21 @@ enum
};
static GObject * gimp_foreground_select_tool_undo_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_foreground_select_tool_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_foreground_select_tool_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_foreground_select_tool_undo_constructed (GObject *object);
static void gimp_foreground_select_tool_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_foreground_select_tool_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_foreground_select_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void gimp_foreground_select_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
static void gimp_foreground_select_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void gimp_foreground_select_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
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);
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->get_property = gimp_foreground_select_tool_undo_get_property;
@ -83,16 +81,14 @@ gimp_foreground_select_tool_undo_init (GimpForegroundSelectToolUndo *undo)
{
}
static GObject *
gimp_foreground_select_tool_undo_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_foreground_select_tool_undo_constructed (GObject *object)
{
GObject *object;
GimpForegroundSelectToolUndo *foreground_select_tool_undo;
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);
@ -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),
(gpointer) &foreground_select_tool_undo->foreground_select_tool);
return object;
}
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 GObject * gimp_image_map_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_image_map_tool_constructed (GObject *object);
static void gimp_image_map_tool_finalize (GObject *object);
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);
object_class->constructor = gimp_image_map_tool_constructor;
object_class->constructed = gimp_image_map_tool_constructed;
object_class->finalize = gimp_image_map_tool_finalize;
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;
}
static GObject *
gimp_image_map_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_image_map_tool_constructed (GObject *object)
{
GObject *object;
GimpImageMapTool *image_map_tool;
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (object);
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)
image_map_tool->operation = klass->get_operation (image_map_tool,
&image_map_tool->config);
return object;
}
static void

View File

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

View File

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

View File

@ -81,9 +81,8 @@ typedef struct GimpRectangleSelectToolPrivate
static void gimp_rectangle_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject *gimp_rectangle_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_rectangle_select_tool_constructed (GObject *object);
static void gimp_rectangle_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
@ -183,7 +182,7 @@ gimp_rectangle_select_tool_class_init (GimpRectangleSelectToolClass *klass)
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->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;
}
static GObject *
gimp_rectangle_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_rectangle_select_tool_constructed (GObject *object)
{
GObject *object;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectOptions *options;
GimpRectangleSelectToolPrivate *priv;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectOptions *options;
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);
@ -270,8 +267,6 @@ gimp_rectangle_select_tool_constructor (GType type,
object, 0);
gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
return object;
}
static void

View File

@ -76,9 +76,7 @@
static void gimp_text_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_text_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_text_tool_constructed (GObject *object);
static void gimp_text_tool_dispose (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);
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->finalize = gimp_text_tool_finalize;
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");
}
static GObject *
gimp_text_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_text_tool_constructed (GObject *object)
{
GObject *object;
GimpTextTool *text_tool;
GimpTextOptions *options;
GimpTextTool *text_tool = GIMP_TEXT_TOOL (object);
GimpTextOptions *options = GIMP_TEXT_TOOL_GET_OPTIONS (text_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);
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);
gimp_text_options_connect_text (options, text_tool->proxy);
@ -302,8 +295,6 @@ gimp_text_tool_constructor (GType type,
g_object_set (options,
"highlight", FALSE,
NULL);
return object;
}
static void

View File

@ -70,9 +70,7 @@
#define MIN_HANDLE_SIZE 6
static GObject * gimp_transform_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_transform_tool_constructed (GObject *object);
static void gimp_transform_tool_finalize (GObject *object);
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);
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;
tool_class->initialize = gimp_transform_tool_initialize;
@ -238,29 +236,21 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
tr_tool->dialog = NULL;
}
static GObject *
gimp_transform_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_transform_tool_constructed (GObject *object)
{
GObject *object;
GimpTool *tool;
GimpTransformTool *tr_tool;
GimpTransformOptions *options;
GimpTool *tool = GIMP_TOOL (object);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (object);
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
tool = GIMP_TOOL (object);
tr_tool = GIMP_TRANSFORM_TOOL (object);
options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
if (tr_tool->use_grid)
{
tr_tool->type = options->type;
tr_tool->direction = options->direction;
}
return object;
}
static void

View File

@ -35,23 +35,21 @@ enum
};
static GObject * gimp_transform_tool_undo_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_transform_tool_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_transform_tool_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_transform_tool_undo_constructed (GObject *object);
static void gimp_transform_tool_undo_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_transform_tool_undo_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_transform_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void gimp_transform_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
static void gimp_transform_tool_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void gimp_transform_tool_undo_free (GimpUndo *undo,
GimpUndoMode undo_mode);
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);
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->get_property = gimp_transform_tool_undo_get_property;
@ -85,19 +83,15 @@ gimp_transform_tool_undo_init (GimpTransformToolUndo *undo)
{
}
static GObject *
gimp_transform_tool_undo_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_transform_tool_undo_constructed (GObject *object)
{
GObject *object;
GimpTransformToolUndo *transform_tool_undo;
GimpTransformToolUndo *transform_tool_undo = GIMP_TRANSFORM_TOOL_UNDO (object);
GimpTransformTool *transform_tool;
gint i;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
transform_tool_undo = GIMP_TRANSFORM_TOOL_UNDO (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
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),
(gpointer) &transform_tool_undo->transform_tool);
return object;
}
static void