libgimp*: implement GObject::constructed() instead of ::constructor()

This commit is contained in:
Michael Natterer 2011-01-12 22:03:33 +01:00
parent 229007106e
commit 8d2d16ac25
10 changed files with 116 additions and 187 deletions

View File

@ -54,9 +54,7 @@ typedef struct
} PreviewSettings;
static GObject * gimp_aspect_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_aspect_preview_constructed (GObject *object);
static void gimp_aspect_preview_dispose (GObject *object);
static void gimp_aspect_preview_get_property (GObject *object,
guint property_id,
@ -102,7 +100,7 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
object_class->constructor = gimp_aspect_preview_constructor;
object_class->constructed = gimp_aspect_preview_constructed;
object_class->dispose = gimp_aspect_preview_dispose;
object_class->get_property = gimp_aspect_preview_get_property;
object_class->set_property = gimp_aspect_preview_set_property;
@ -134,21 +132,19 @@ gimp_aspect_preview_init (GimpAspectPreview *preview)
NULL);
}
static GObject *
gimp_aspect_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_aspect_preview_constructed (GObject *object)
{
GObject *object;
gchar *data_name;
PreviewSettings settings;
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
data_name = g_strdup_printf ("%s-aspect-preview-%d",
g_get_prgname (),
gimp_aspect_preview_counter++);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
if (gimp_get_data (data_name, &settings))
{
gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
@ -156,8 +152,6 @@ gimp_aspect_preview_constructor (GType type,
g_object_set_data_full (object, "gimp-aspect-preview-data-name",
data_name, (GDestroyNotify) g_free);
return object;
}
static void

View File

@ -56,9 +56,7 @@ typedef struct
} PreviewSettings;
static GObject * gimp_drawable_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_drawable_preview_constructed (GObject *object);
static void gimp_drawable_preview_dispose (GObject *object);
static void gimp_drawable_preview_get_property (GObject *object,
guint property_id,
@ -100,7 +98,7 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
object_class->constructor = gimp_drawable_preview_constructor;
object_class->constructed = gimp_drawable_preview_constructed;
object_class->dispose = gimp_drawable_preview_dispose;
object_class->get_property = gimp_drawable_preview_get_property;
object_class->set_property = gimp_drawable_preview_set_property;
@ -131,21 +129,19 @@ gimp_drawable_preview_init (GimpDrawablePreview *preview)
NULL);
}
static GObject *
gimp_drawable_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_drawable_preview_constructed (GObject *object)
{
GObject *object;
gchar *data_name;
PreviewSettings settings;
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
data_name = g_strdup_printf ("%s-drawable-preview-%d",
g_get_prgname (),
++gimp_drawable_preview_counter);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
if (gimp_get_data (data_name, &settings))
{
gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
@ -155,8 +151,6 @@ gimp_drawable_preview_constructor (GType type,
g_object_set_data_full (object, "gimp-drawable-preview-data-name",
data_name, (GDestroyNotify) g_free);
return object;
}
static void

View File

@ -66,9 +66,7 @@ typedef struct
#define GIMP_ZOOM_PREVIEW_GET_PRIVATE(obj) \
((GimpZoomPreviewPrivate *) ((GimpZoomPreview *) (obj))->priv)
static GObject * gimp_zoom_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_zoom_preview_constructed (GObject *object);
static void gimp_zoom_preview_finalize (GObject *object);
static void gimp_zoom_preview_dispose (GObject *object);
static void gimp_zoom_preview_get_property (GObject *object,
@ -137,7 +135,7 @@ gimp_zoom_preview_class_init (GimpZoomPreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
object_class->constructor = gimp_zoom_preview_constructor;
object_class->constructed = gimp_zoom_preview_constructed;
object_class->finalize = gimp_zoom_preview_finalize;
object_class->dispose = gimp_zoom_preview_dispose;
object_class->get_property = gimp_zoom_preview_get_property;
@ -203,22 +201,20 @@ gimp_zoom_preview_init (GimpZoomPreview *preview)
GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
}
static GObject *
gimp_zoom_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_zoom_preview_constructed (GObject *object)
{
GimpZoomPreviewPrivate *priv;
GObject *object;
GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
gchar *data_name;
PreviewSettings settings;
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
data_name = g_strdup_printf ("%s-zoom-preview-%d",
g_get_prgname (),
gimp_zoom_preview_counter++);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
if (gimp_get_data (data_name, &settings))
{
gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
@ -227,8 +223,6 @@ gimp_zoom_preview_constructor (GType type,
g_object_set_data_full (object, "gimp-zoom-preview-data-name",
data_name, (GDestroyNotify) g_free);
priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
if (! priv->model)
{
GimpZoomModel *model = gimp_zoom_model_new ();
@ -240,8 +234,6 @@ gimp_zoom_preview_constructor (GType type,
}
gimp_zoom_preview_set_adjustments (GIMP_ZOOM_PREVIEW (object), 1.0, 1.0);
return object;
}
static void

View File

@ -63,9 +63,7 @@ enum
LAST_SIGNAL
};
static GObject * gimp_chain_button_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_chain_button_constructed (GObject *object);
static void gimp_chain_button_set_property (GObject *object,
guint property_id,
const GValue *value,
@ -103,7 +101,7 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_chain_button_constructor;
object_class->constructed = gimp_chain_button_constructed;
object_class->set_property = gimp_chain_button_set_property;
object_class->get_property = gimp_chain_button_get_property;
@ -150,17 +148,13 @@ gimp_chain_button_init (GimpChainButton *button)
button);
}
static GObject *
gimp_chain_button_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_chain_button_constructed (GObject *object)
{
GObject *object;
GimpChainButton *button;
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
button = GIMP_CHAIN_BUTTON (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
button->line1 = gimp_chain_line_new (button->position, 1);
button->line2 = gimp_chain_line_new (button->position, -1);
@ -191,8 +185,6 @@ gimp_chain_button_constructor (GType type,
gtk_widget_show (button->button);
gtk_widget_show (button->line1);
gtk_widget_show (button->line2);
return object;
}
static void

View File

@ -62,6 +62,7 @@ enum
LAST_SIGNAL
};
typedef struct
{
GimpColorConfig *config;
@ -70,9 +71,8 @@ typedef struct
#define GIMP_COLOR_DISPLAY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplayPrivate))
static GObject * gimp_color_display_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_color_display_constructed (GObject *object);
static void gimp_color_display_dispose (GObject *object);
static void gimp_color_display_set_property (GObject *object,
guint property_id,
@ -102,7 +102,7 @@ gimp_color_display_class_init (GimpColorDisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_color_display_constructor;
object_class->constructed = gimp_color_display_constructed;
object_class->dispose = gimp_color_display_dispose;
object_class->set_property = gimp_color_display_set_property;
object_class->get_property = gimp_color_display_get_property;
@ -154,19 +154,14 @@ gimp_color_display_init (GimpColorDisplay *display)
display->enabled = FALSE;
}
static GObject *
gimp_color_display_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_color_display_constructed (GObject *object)
{
GObject *object;
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);
/* emit an initial "changed" signal after all construct properties are set */
gimp_color_display_changed (GIMP_COLOR_DISPLAY (object));
return object;
}
static void

View File

@ -54,9 +54,7 @@ enum
};
static GObject * gimp_color_profile_store_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_color_profile_store_constructed (GObject *object);
static void gimp_color_profile_store_dispose (GObject *object);
static void gimp_color_profile_store_finalize (GObject *object);
static void gimp_color_profile_store_set_property (GObject *object,
@ -95,7 +93,7 @@ gimp_color_profile_store_class_init (GimpColorProfileStoreClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_color_profile_store_constructor;
object_class->constructed = gimp_color_profile_store_constructed;
object_class->dispose = gimp_color_profile_store_dispose;
object_class->finalize = gimp_color_profile_store_finalize;
object_class->set_property = gimp_color_profile_store_set_property;
@ -131,18 +129,14 @@ gimp_color_profile_store_init (GimpColorProfileStore *store)
G_N_ELEMENTS (types), types);
}
static GObject *
gimp_color_profile_store_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_color_profile_store_constructed (GObject *object)
{
GObject *object;
GimpColorProfileStore *store;
GimpColorProfileStore *store = GIMP_COLOR_PROFILE_STORE (object);
GtkTreeIter iter;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
store = GIMP_COLOR_PROFILE_STORE (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gtk_list_store_append (GTK_LIST_STORE (store), &iter);
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
@ -156,8 +150,6 @@ gimp_color_profile_store_constructor (GType type,
{
gimp_color_profile_store_load (store, store->history, NULL);
}
return object;
}
static void

View File

@ -48,27 +48,26 @@ enum
};
static GObject * gimp_dialog_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_dialog_dispose (GObject *object);
static void gimp_dialog_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dialog_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dialog_constructed (GObject *object);
static void gimp_dialog_dispose (GObject *object);
static void gimp_dialog_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dialog_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_dialog_hide (GtkWidget *widget);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_close (GtkDialog *dialog);
static void gimp_dialog_hide (GtkWidget *widget);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_help (GObject *dialog);
static void gimp_dialog_response (GtkDialog *dialog,
gint response_id);
static void gimp_dialog_close (GtkDialog *dialog);
static void gimp_dialog_help (GObject *dialog);
static void gimp_dialog_response (GtkDialog *dialog,
gint response_id);
G_DEFINE_TYPE (GimpDialog, gimp_dialog, GTK_TYPE_DIALOG)
@ -85,7 +84,7 @@ gimp_dialog_class_init (GimpDialogClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
object_class->constructor = gimp_dialog_constructor;
object_class->constructed = gimp_dialog_constructed;
object_class->dispose = gimp_dialog_dispose;
object_class->set_property = gimp_dialog_set_property;
object_class->get_property = gimp_dialog_get_property;
@ -128,16 +127,14 @@ gimp_dialog_init (GimpDialog *dialog)
NULL);
}
static GObject *
gimp_dialog_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_dialog_constructed (GObject *object)
{
GObject *object;
GimpHelpFunc help_func;
const gchar *help_id;
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);
help_func = g_object_get_data (object, "gimp-dialog-help-func");
help_id = g_object_get_data (object, "gimp-dialog-help-id");
@ -162,8 +159,6 @@ gimp_dialog_constructor (GType type,
g_object_set_data (object, "gimp-dialog-help-button", button);
}
return object;
}
static void

View File

@ -55,18 +55,18 @@ enum
PROP_HINT
};
static GObject * gimp_hint_box_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_hint_box_finalize (GObject *object);
static void gimp_hint_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_hint_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_hint_box_constructed (GObject *object);
static void gimp_hint_box_finalize (GObject *object);
static void gimp_hint_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_hint_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpHintBox, gimp_hint_box, GTK_TYPE_HBOX)
@ -78,7 +78,7 @@ gimp_hint_box_class_init (GimpHintBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_hint_box_constructor;
object_class->constructed = gimp_hint_box_constructed;
object_class->finalize = gimp_hint_box_finalize;
object_class->set_property = gimp_hint_box_set_property;
object_class->get_property = gimp_hint_box_get_property;
@ -102,18 +102,14 @@ gimp_hint_box_init (GimpHintBox *box)
box->hint = NULL;
}
static GObject *
gimp_hint_box_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_hint_box_constructed (GObject *object)
{
GObject *object;
GimpHintBox *box;
GimpHintBox *box = GIMP_HINT_BOX (object);
GtkWidget *label;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
box = GIMP_HINT_BOX (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
gtk_box_set_spacing (GTK_BOX (box), 12);
@ -139,8 +135,6 @@ gimp_hint_box_constructor (GType type,
-1);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
gtk_widget_show (label);
return object;
}
static void

View File

@ -54,12 +54,9 @@ typedef struct
} GimpIntStorePrivate;
static GObject * gimp_int_store_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_int_store_tree_model_init (GtkTreeModelIface *iface);
static void gimp_int_store_constructed (GObject *object);
static void gimp_int_store_finalize (GObject *object);
static void gimp_int_store_set_property (GObject *object,
guint property_id,
@ -93,7 +90,7 @@ gimp_int_store_class_init (GimpIntStoreClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_int_store_constructor;
object_class->constructed = gimp_int_store_constructed;
object_class->finalize = gimp_int_store_finalize;
object_class->set_property = gimp_int_store_set_property;
object_class->get_property = gimp_int_store_get_property;
@ -120,26 +117,29 @@ gimp_int_store_class_init (GimpIntStoreClass *klass)
g_type_class_add_private (object_class, sizeof (GimpIntStorePrivate));
}
static void
gimp_int_store_tree_model_init (GtkTreeModelIface *iface)
{
parent_iface = g_type_interface_peek_parent (iface);
iface->row_inserted = gimp_int_store_row_inserted;
}
static void
gimp_int_store_init (GimpIntStore *store)
{
store->empty_iter = NULL;
}
static GObject *
gimp_int_store_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_int_store_constructed (GObject *object)
{
GObject *object;
GimpIntStore *store;
GimpIntStorePrivate *priv;
GimpIntStore *store = GIMP_INT_STORE (object);
GimpIntStorePrivate *priv = GIMP_INT_STORE_GET_PRIVATE (store);
GType types[GIMP_INT_STORE_NUM_COLUMNS];
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
store = GIMP_INT_STORE (object);
priv = GIMP_INT_STORE_GET_PRIVATE (store);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
types[GIMP_INT_STORE_VALUE] = G_TYPE_INT;
types[GIMP_INT_STORE_LABEL] = G_TYPE_STRING;
@ -152,16 +152,6 @@ gimp_int_store_constructor (GType type,
GIMP_INT_STORE_NUM_COLUMNS, types);
gimp_int_store_add_empty (store);
return object;
}
static void
gimp_int_store_tree_model_init (GtkTreeModelIface *iface)
{
parent_iface = g_type_interface_peek_parent (iface);
iface->row_inserted = gimp_int_store_row_inserted;
}
static void

View File

@ -59,18 +59,15 @@ typedef struct
((GimpStringComboBoxPrivate *) ((GimpStringComboBox *) (obj))->priv)
static GObject * gimp_string_combo_box_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_string_combo_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_string_combo_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_string_combo_box_constructed (GObject *object);
static void gimp_string_combo_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_string_combo_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpStringComboBox, gimp_string_combo_box, GTK_TYPE_COMBO_BOX)
@ -83,7 +80,7 @@ gimp_string_combo_box_class_init (GimpStringComboBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = gimp_string_combo_box_constructor;
object_class->constructed = gimp_string_combo_box_constructed;
object_class->set_property = gimp_string_combo_box_set_property;
object_class->get_property = gimp_string_combo_box_get_property;
@ -145,18 +142,14 @@ gimp_string_combo_box_init (GimpStringComboBox *combo_box)
GimpStringComboBoxPrivate);
}
static GObject *
gimp_string_combo_box_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static void
gimp_string_combo_box_constructed (GObject *object)
{
GObject *object;
GimpStringComboBoxPrivate *priv;
GimpStringComboBoxPrivate *priv = GIMP_STRING_COMBO_BOX_GET_PRIVATE (object);
GtkCellRenderer *cell;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
priv = GIMP_STRING_COMBO_BOX_GET_PRIVATE (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
priv->text_renderer = cell = gtk_cell_renderer_text_new ();
@ -164,8 +157,6 @@ gimp_string_combo_box_constructor (GType type,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell,
"text", priv->label_column,
NULL);
return object;
}
static void