From 9c37b3de7466a22d4c784657a86c522e2a4f118a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 26 Jun 2014 18:22:42 -0400 Subject: [PATCH] gtk: Don't use GObjectClass.constructor Use the newer constructed instead, which has a fast path in GObject. --- gtk/gtkassistant.c | 22 ++++++---------------- gtk/gtkbutton.c | 26 +++++++------------------- gtk/gtkcellview.c | 27 ++++++++------------------- gtk/gtkcombobox.c | 25 +++++++------------------ gtk/gtkcomboboxtext.c | 14 ++++---------- gtk/gtkcustompaperunixdialog.c | 17 +++++------------ gtk/gtkdialog.c | 22 ++++++---------------- gtk/gtkentrycompletion.c | 25 +++++++------------------ gtk/gtkfilechooserbutton.c | 25 +++++++------------------ gtk/gtkfilechooserwidget.c | 25 +++++++------------------ gtk/gtkiconview.c | 23 +++++++---------------- gtk/gtkinvisible.c | 21 +++++---------------- gtk/gtkprintjob.c | 27 +++++++-------------------- gtk/gtkprintunixdialog.c | 17 +++++------------ gtk/gtkrecentchooserdialog.c | 21 ++++++--------------- gtk/gtkrecentchoosermenu.c | 27 ++++++++------------------- gtk/gtkscalebutton.c | 25 +++++++------------------ gtk/gtkstatusicon.c | 34 +++++++++++----------------------- gtk/gtktreemenu.c | 25 +++++++------------------ gtk/gtktreeviewcolumn.c | 22 ++++++---------------- gtk/gtkwindow.c | 21 +++++++-------------- 21 files changed, 140 insertions(+), 351 deletions(-) diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 215a9c82ac..ac85fc569b 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -349,21 +349,13 @@ add_action_widgets (GtkAssistant *assistant) } } -static GObject * -gtk_assistant_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_assistant_constructed (GObject *object) { - GObject *object; - GtkAssistant *assistant; - GtkAssistantPrivate *priv; + GtkAssistant *assistant = GTK_ASSISTANT (object); + GtkAssistantPrivate *priv = assistant->priv; - object = G_OBJECT_CLASS (gtk_assistant_parent_class)->constructor (type, - n_construct_properties, - construct_params); - - assistant = GTK_ASSISTANT (object); - priv = assistant->priv; + G_OBJECT_CLASS (gtk_assistant_parent_class)->constructed (object); priv->constructed = TRUE; if (priv->use_header_bar == -1) @@ -371,8 +363,6 @@ gtk_assistant_constructor (GType type, add_action_widgets (assistant); apply_use_header_bar (assistant); - - return object; } static void @@ -386,7 +376,7 @@ gtk_assistant_class_init (GtkAssistantClass *class) widget_class = (GtkWidgetClass *) class; container_class = (GtkContainerClass *) class; - gobject_class->constructor = gtk_assistant_constructor; + gobject_class->constructed = gtk_assistant_constructed; gobject_class->set_property = gtk_assistant_set_property; gobject_class->get_property = gtk_assistant_get_property; diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index ce4729b351..7e702618ea 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -141,9 +141,7 @@ static GType gtk_button_child_type (GtkContainer *container); static void gtk_button_finish_activate (GtkButton *button, gboolean do_it); -static GObject* gtk_button_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_button_constructed (GObject *object); static void gtk_button_construct_child (GtkButton *button); static void gtk_button_state_changed (GtkWidget *widget, GtkStateType previous_state); @@ -205,7 +203,7 @@ gtk_button_class_init (GtkButtonClass *klass) widget_class = (GtkWidgetClass*) klass; container_class = (GtkContainerClass*) klass; - gobject_class->constructor = gtk_button_constructor; + gobject_class->constructed = gtk_button_constructed; gobject_class->dispose = gtk_button_dispose; gobject_class->set_property = gtk_button_set_property; gobject_class->get_property = gtk_button_get_property; @@ -671,28 +669,18 @@ gtk_button_destroy (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_button_parent_class)->destroy (widget); } -static GObject* -gtk_button_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_button_constructed (GObject *object) { - GObject *object; - GtkButton *button; - GtkButtonPrivate *priv; + GtkButton *button = GTK_BUTTON (object); + GtkButtonPrivate *priv = button->priv; - object = G_OBJECT_CLASS (gtk_button_parent_class)->constructor (type, - n_construct_properties, - construct_params); - - button = GTK_BUTTON (object); - priv = button->priv; + G_OBJECT_CLASS (gtk_button_parent_class)->constructed (object); priv->constructed = TRUE; if (priv->label_text != NULL) gtk_button_construct_child (button); - - return object; } diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c index c1ab25ea0e..fe75936871 100644 --- a/gtk/gtkcellview.c +++ b/gtk/gtkcellview.c @@ -49,10 +49,8 @@ * they all share the same height but may have variable widths). */ -static GObject *gtk_cell_view_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); -static void gtk_cell_view_get_property (GObject *object, +static void gtk_cell_view_constructed (GObject *object); +static void gtk_cell_view_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec); @@ -167,7 +165,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - gobject_class->constructor = gtk_cell_view_constructor; + gobject_class->constructed = gtk_cell_view_constructed; gobject_class->get_property = gtk_cell_view_get_property; gobject_class->set_property = gtk_cell_view_set_property; gobject_class->finalize = gtk_cell_view_finalize; @@ -342,20 +340,13 @@ gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface) iface->get_area = gtk_cell_view_cell_layout_get_area; } -static GObject * -gtk_cell_view_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_cell_view_constructed (GObject *object) { - GObject *object; - GtkCellView *view; - GtkCellViewPrivate *priv; + GtkCellView *view = GTK_CELL_VIEW (object); + GtkCellViewPrivate *priv = view->priv; - object = G_OBJECT_CLASS (gtk_cell_view_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - view = GTK_CELL_VIEW (object); - priv = view->priv; + G_OBJECT_CLASS (gtk_cell_view_parent_class)->constructed (object); if (!priv->area) { @@ -369,8 +360,6 @@ gtk_cell_view_constructor (GType type, priv->size_changed_id = g_signal_connect (priv->context, "notify", G_CALLBACK (context_size_changed_cb), view); - - return object; } static void diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index baeb30de8d..96ef51a051 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -254,9 +254,7 @@ static guint combo_box_signals[LAST_SIGNAL] = {0,}; static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface); -static GObject *gtk_combo_box_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); +static void gtk_combo_box_constructed (GObject *object); static void gtk_combo_box_dispose (GObject *object); static void gtk_combo_box_finalize (GObject *object); static void gtk_combo_box_destroy (GtkWidget *widget); @@ -514,7 +512,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) widget_class->direction_changed = gtk_combo_box_direction_changed; object_class = (GObjectClass *)klass; - object_class->constructor = gtk_combo_box_constructor; + object_class->constructed = gtk_combo_box_constructed; object_class->dispose = gtk_combo_box_dispose; object_class->finalize = gtk_combo_box_finalize; object_class->set_property = gtk_combo_box_set_property; @@ -4793,20 +4791,13 @@ gtk_combo_box_format_entry_text (GtkComboBox *combo_box, } -static GObject * -gtk_combo_box_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_combo_box_constructed (GObject *object) { - GObject *object; - GtkComboBox *combo_box; - GtkComboBoxPrivate *priv; + GtkComboBox *combo_box = GTK_COMBO_BOX (object); + GtkComboBoxPrivate *priv = combo_box->priv; - object = G_OBJECT_CLASS (gtk_combo_box_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - combo_box = GTK_COMBO_BOX (object); - priv = combo_box->priv; + G_OBJECT_CLASS (gtk_combo_box_parent_class)->constructed (object); if (!priv->area) { @@ -4844,8 +4835,6 @@ gtk_combo_box_constructor (GType type, g_signal_connect (combo_box, "changed", G_CALLBACK (gtk_combo_box_entry_active_changed), NULL); } - - return object; } diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c index 9ac057d5e8..863435ea99 100644 --- a/gtk/gtkcomboboxtext.c +++ b/gtk/gtkcomboboxtext.c @@ -92,16 +92,12 @@ G_DEFINE_TYPE_WITH_CODE (GtkComboBoxText, gtk_combo_box_text, GTK_TYPE_COMBO_BOX G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_combo_box_text_buildable_interface_init)); -static GObject * -gtk_combo_box_text_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_combo_box_text_constructed (GObject *object) { - GObject *object; const gint text_column = 0; - object = G_OBJECT_CLASS (gtk_combo_box_text_parent_class)->constructor - (type, n_construct_properties, construct_properties); + G_OBJECT_CLASS (gtk_combo_box_text_parent_class)->constructed (object); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object), text_column); gtk_combo_box_set_id_column (GTK_COMBO_BOX (object), 1); @@ -116,8 +112,6 @@ gtk_combo_box_text_constructor (GType type, "text", text_column, NULL); } - - return object; } static void @@ -136,7 +130,7 @@ gtk_combo_box_text_class_init (GtkComboBoxTextClass *klass) GObjectClass *object_class; object_class = (GObjectClass *)klass; - object_class->constructor = gtk_combo_box_text_constructor; + object_class->constructed = gtk_combo_box_text_constructed; } static void diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c index 8dd43b798a..b98ba78abd 100644 --- a/gtk/gtkcustompaperunixdialog.c +++ b/gtk/gtkcustompaperunixdialog.c @@ -90,9 +90,7 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE (GtkCustomPaperUnixDialog, gtk_custom_paper_unix_dialog, GTK_TYPE_DIALOG) -static GObject *gtk_custom_paper_unix_dialog_constructor (GType type, - guint n_params, - GObjectConstructParam *params); +static void gtk_custom_paper_unix_dialog_constructed (GObject *object); static void gtk_custom_paper_unix_dialog_finalize (GObject *object); static void populate_dialog (GtkCustomPaperUnixDialog *dialog); static void printer_added_cb (GtkPrintBackend *backend, @@ -273,7 +271,7 @@ _gtk_print_save_custom_papers (GtkListStore *store) static void gtk_custom_paper_unix_dialog_class_init (GtkCustomPaperUnixDialogClass *class) { - G_OBJECT_CLASS (class)->constructor = gtk_custom_paper_unix_dialog_constructor; + G_OBJECT_CLASS (class)->constructed = gtk_custom_paper_unix_dialog_constructed; G_OBJECT_CLASS (class)->finalize = gtk_custom_paper_unix_dialog_finalize; } @@ -317,15 +315,12 @@ gtk_custom_paper_unix_dialog_init (GtkCustomPaperUnixDialog *dialog) g_signal_connect (dialog, "response", G_CALLBACK (custom_paper_dialog_response_cb), NULL); } -static GObject * -gtk_custom_paper_unix_dialog_constructor (GType type, - guint n_params, - GObjectConstructParam *params) +static void +gtk_custom_paper_unix_dialog_constructed (GObject *object) { - GObject *object; gboolean use_header; - object = G_OBJECT_CLASS (gtk_custom_paper_unix_dialog_parent_class)->constructor (type, n_params, params); + G_OBJECT_CLASS (gtk_custom_paper_unix_dialog_parent_class)->constructed (object); g_object_get (object, "use-header-bar", &use_header, NULL); if (!use_header) @@ -335,8 +330,6 @@ gtk_custom_paper_unix_dialog_constructor (GType type, NULL); gtk_dialog_set_default_response (GTK_DIALOG (object), GTK_RESPONSE_CLOSE); } - - return object; } static void diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 4ab47fb4ab..5a36d73d33 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -522,21 +522,13 @@ add_action_widgets (GtkDialog *dialog) } } -static GObject * -gtk_dialog_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_dialog_constructed (GObject *object) { - GObject *object; - GtkDialog *dialog; - GtkDialogPrivate *priv; + GtkDialog *dialog = GTK_DIALOG (object); + GtkDialogPrivate *priv = dialog->priv; - object = G_OBJECT_CLASS (gtk_dialog_parent_class)->constructor (type, - n_construct_properties, - construct_params); - - dialog = GTK_DIALOG (object); - priv = dialog->priv; + G_OBJECT_CLASS (gtk_dialog_parent_class)->constructed (object); priv->constructed = TRUE; if (priv->use_header_bar == -1) @@ -544,8 +536,6 @@ gtk_dialog_constructor (GType type, add_action_widgets (dialog); apply_use_header_bar (dialog); - - return object; } static void @@ -568,7 +558,7 @@ gtk_dialog_class_init (GtkDialogClass *class) gobject_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); - gobject_class->constructor = gtk_dialog_constructor; + gobject_class->constructed = gtk_dialog_constructed; gobject_class->set_property = gtk_dialog_set_property; gobject_class->get_property = gtk_dialog_get_property; gobject_class->finalize = gtk_dialog_finalize; diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 66db4af337..e4d5736a6a 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -120,9 +120,7 @@ enum static void gtk_entry_completion_cell_layout_init (GtkCellLayoutIface *iface); static GtkCellArea* gtk_entry_completion_get_area (GtkCellLayout *cell_layout); -static GObject *gtk_entry_completion_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); +static void gtk_entry_completion_constructed (GObject *object); static void gtk_entry_completion_set_property (GObject *object, guint prop_id, const GValue *value, @@ -204,7 +202,7 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass) object_class = (GObjectClass *)klass; - object_class->constructor = gtk_entry_completion_constructor; + object_class->constructed = gtk_entry_completion_constructed; object_class->set_property = gtk_entry_completion_set_property; object_class->get_property = gtk_entry_completion_get_property; object_class->dispose = gtk_entry_completion_dispose; @@ -503,23 +501,16 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) priv->filter_model = NULL; } -static GObject * -gtk_entry_completion_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_entry_completion_constructed (GObject *object) { - GtkEntryCompletion *completion; - GtkEntryCompletionPrivate *priv; - GObject *object; + GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (object); + GtkEntryCompletionPrivate *priv = completion->priv; GtkCellRenderer *cell; GtkTreeSelection *sel; GtkWidget *popup_frame; - object = G_OBJECT_CLASS (gtk_entry_completion_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - completion = (GtkEntryCompletion *) object; - priv = completion->priv; + G_OBJECT_CLASS (gtk_entry_completion_parent_class)->constructed (object); if (!priv->cell_area) { @@ -626,8 +617,6 @@ gtk_entry_completion_constructor (GType type, * been inserted, so we pack the action treeview after the first * action has been added */ - - return object; } diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 9a011310b0..62fce5a388 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -247,9 +247,7 @@ static gboolean gtk_file_chooser_button_remove_shortcut_folder (GtkFileChooser GError **error); /* GObject Functions */ -static GObject *gtk_file_chooser_button_constructor (GType type, - guint n_params, - GObjectConstructParam *params); +static void gtk_file_chooser_button_constructed (GObject *object); static void gtk_file_chooser_button_set_property (GObject *object, guint param_id, const GValue *value, @@ -369,7 +367,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) gobject_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); - gobject_class->constructor = gtk_file_chooser_button_constructor; + gobject_class->constructed = gtk_file_chooser_button_constructed; gobject_class->set_property = gtk_file_chooser_button_set_property; gobject_class->get_property = gtk_file_chooser_button_get_property; gobject_class->finalize = gtk_file_chooser_button_finalize; @@ -780,21 +778,14 @@ gtk_file_chooser_button_remove_shortcut_folder (GtkFileChooser *chooser, * GObject Functions * * ******************* */ -static GObject * -gtk_file_chooser_button_constructor (GType type, - guint n_params, - GObjectConstructParam *params) +static void +gtk_file_chooser_button_constructed (GObject *object) { - GObject *object; - GtkFileChooserButton *button; - GtkFileChooserButtonPrivate *priv; + GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (object); + GtkFileChooserButtonPrivate *priv = button->priv; GSList *list; - object = G_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->constructor (type, - n_params, - params); - button = GTK_FILE_CHOOSER_BUTTON (object); - priv = button->priv; + G_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->constructed (object); if (!priv->dialog) { @@ -877,8 +868,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS update_label_and_image (button); update_combo_box (button); - - return object; } static void diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 0a229970ad..7a46250c89 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -400,9 +400,7 @@ enum { static void gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface); static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface); -static GObject* gtk_file_chooser_widget_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_file_chooser_widget_constructed (GObject *object); static void gtk_file_chooser_widget_finalize (GObject *object); static void gtk_file_chooser_widget_set_property (GObject *object, guint prop_id, @@ -2159,30 +2157,21 @@ location_toggle_popup_handler (GtkFileChooserWidget *impl) } } -static GObject* -gtk_file_chooser_widget_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_file_chooser_widget_constructed (GObject *object) { - GtkFileChooserWidget *impl; - GtkFileChooserWidgetPrivate *priv; - GObject *object; + GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object); + GtkFileChooserWidgetPrivate *priv = impl->priv; profile_start ("start", NULL); - object = G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->constructor (type, - n_construct_properties, - construct_params); - impl = GTK_FILE_CHOOSER_WIDGET (object); - priv = impl->priv; + G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->constructed (object); g_assert (priv->file_system); update_appearance (impl); profile_end ("end", NULL); - - return object; } static void @@ -6972,7 +6961,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class) int i; gobject_class->finalize = gtk_file_chooser_widget_finalize; - gobject_class->constructor = gtk_file_chooser_widget_constructor; + gobject_class->constructed = gtk_file_chooser_widget_constructed; gobject_class->set_property = gtk_file_chooser_widget_set_property; gobject_class->get_property = gtk_file_chooser_widget_get_property; gobject_class->dispose = gtk_file_chooser_widget_dispose; diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 730dc14816..7a1b1dc7a9 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -117,9 +117,7 @@ enum /* GObject vfuncs */ static void gtk_icon_view_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_icon_view_dispose (GObject *object); -static GObject *gtk_icon_view_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); +static void gtk_icon_view_constructed (GObject *object); static void gtk_icon_view_set_property (GObject *object, guint prop_id, const GValue *value, @@ -342,7 +340,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; - gobject_class->constructor = gtk_icon_view_constructor; + gobject_class->constructed = gtk_icon_view_constructed; gobject_class->dispose = gtk_icon_view_dispose; gobject_class->set_property = gtk_icon_view_set_property; gobject_class->get_property = gtk_icon_view_get_property; @@ -992,22 +990,15 @@ gtk_icon_view_init (GtkIconView *icon_view) } /* GObject methods */ -static GObject * -gtk_icon_view_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) + +static void +gtk_icon_view_constructed (GObject *object) { - GtkIconView *icon_view; - GObject *object; + GtkIconView *icon_view = GTK_ICON_VIEW (object); - object = G_OBJECT_CLASS (gtk_icon_view_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - icon_view = (GtkIconView *) object; + G_OBJECT_CLASS (gtk_icon_view_parent_class)->constructed (object); gtk_icon_view_ensure_cell_area (icon_view, NULL); - - return object; } static void diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c index 628b2d2d55..5d07914260 100644 --- a/gtk/gtkinvisible.c +++ b/gtk/gtkinvisible.c @@ -69,10 +69,7 @@ static void gtk_invisible_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); - -static GObject *gtk_invisible_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_invisible_constructed (GObject *object); G_DEFINE_TYPE_WITH_PRIVATE (GtkInvisible, gtk_invisible, GTK_TYPE_WIDGET) @@ -93,7 +90,7 @@ gtk_invisible_class_init (GtkInvisibleClass *class) gobject_class->set_property = gtk_invisible_set_property; gobject_class->get_property = gtk_invisible_get_property; - gobject_class->constructor = gtk_invisible_constructor; + gobject_class->constructed = gtk_invisible_constructed; g_object_class_install_property (gobject_class, PROP_SCREEN, @@ -322,18 +319,10 @@ gtk_invisible_get_property (GObject *object, /* We use a constructor here so that we can realize the invisible on * the correct screen after the “screen” property has been set */ -static GObject* -gtk_invisible_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_invisible_constructed (GObject *object) { - GObject *object; - - object = G_OBJECT_CLASS (gtk_invisible_parent_class)->constructor (type, - n_construct_properties, - construct_params); + G_OBJECT_CLASS (gtk_invisible_parent_class)->constructed (object); gtk_widget_realize (GTK_WIDGET (object)); - - return object; } diff --git a/gtk/gtkprintjob.c b/gtk/gtkprintjob.c index 05772ad6f2..baae02f82b 100644 --- a/gtk/gtkprintjob.c +++ b/gtk/gtkprintjob.c @@ -95,9 +95,7 @@ static void gtk_print_job_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static GObject* gtk_print_job_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_print_job_constructed (GObject *object); enum { STATUS_CHANGED, @@ -124,7 +122,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) object_class = (GObjectClass *) class; object_class->finalize = gtk_print_job_finalize; - object_class->constructor = gtk_print_job_constructor; + object_class->constructed = gtk_print_job_constructed; object_class->set_property = gtk_print_job_set_property; object_class->get_property = gtk_print_job_get_property; @@ -228,23 +226,14 @@ gtk_print_job_init (GtkPrintJob *job) } -static GObject* -gtk_print_job_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_print_job_constructed (GObject *object) { - GtkPrintJob *job; - GtkPrintJobPrivate *priv; - GObject *object; + GtkPrintJob *job = GTK_PRINT_JOB (object); + GtkPrintJobPrivate *priv = job->priv; - object = - G_OBJECT_CLASS (gtk_print_job_parent_class)->constructor (type, - n_construct_properties, - construct_params); + G_OBJECT_CLASS (gtk_print_job_parent_class)->constructed (object); - job = GTK_PRINT_JOB (object); - - priv = job->priv; g_assert (priv->printer_set && priv->settings_set && priv->page_setup_set); @@ -253,8 +242,6 @@ gtk_print_job_constructor (GType type, job, priv->settings, priv->page_setup); - - return object; } diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 9743c8117c..3e999026bc 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -118,9 +118,7 @@ #define RULER_RADIUS 2 -static GObject *gtk_print_unix_dialog_constructor (GType type, - guint n_params, - GObjectConstructParam *params); +static void gtk_print_unix_dialog_constructed (GObject *object); static void gtk_print_unix_dialog_destroy (GtkWidget *widget); static void gtk_print_unix_dialog_finalize (GObject *object); static void gtk_print_unix_dialog_set_property (GObject *object, @@ -394,7 +392,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; - object_class->constructor = gtk_print_unix_dialog_constructor; + object_class->constructed = gtk_print_unix_dialog_constructed; object_class->finalize = gtk_print_unix_dialog_finalize; object_class->set_property = gtk_print_unix_dialog_set_property; object_class->get_property = gtk_print_unix_dialog_get_property; @@ -792,15 +790,12 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog) _gtk_print_load_custom_papers (priv->custom_paper_list); } -static GObject * -gtk_print_unix_dialog_constructor (GType type, - guint n_params, - GObjectConstructParam *params) +static void +gtk_print_unix_dialog_constructed (GObject *object) { - GObject *object; gboolean use_header; - object = G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->constructor (type, n_params, params); + G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->constructed (object); g_object_get (object, "use-header-bar", &use_header, NULL); if (use_header) @@ -814,8 +809,6 @@ gtk_print_unix_dialog_constructor (GType type, gtk_header_bar_pack_end (GTK_HEADER_BAR (parent), button); g_object_unref (button); } - - return object; } static void diff --git a/gtk/gtkrecentchooserdialog.c b/gtk/gtkrecentchooserdialog.c index f4a3043db4..ff58ff72c1 100644 --- a/gtk/gtkrecentchooserdialog.c +++ b/gtk/gtkrecentchooserdialog.c @@ -92,9 +92,7 @@ static void gtk_recent_chooser_dialog_class_init (GtkRecentChooserDialogClass *k static void gtk_recent_chooser_dialog_init (GtkRecentChooserDialog *dialog); static void gtk_recent_chooser_dialog_finalize (GObject *object); -static GObject *gtk_recent_chooser_dialog_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_recent_chooser_dialog_constructed (GObject *object); static void gtk_recent_chooser_dialog_set_property (GObject *object, guint prop_id, @@ -119,7 +117,7 @@ gtk_recent_chooser_dialog_class_init (GtkRecentChooserDialogClass *klass) gobject_class->set_property = gtk_recent_chooser_dialog_set_property; gobject_class->get_property = gtk_recent_chooser_dialog_get_property; - gobject_class->constructor = gtk_recent_chooser_dialog_constructor; + gobject_class->constructed = gtk_recent_chooser_dialog_constructed; gobject_class->finalize = gtk_recent_chooser_dialog_finalize; _gtk_recent_chooser_install_properties (gobject_class); @@ -193,20 +191,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS g_list_free (children); } -static GObject * -gtk_recent_chooser_dialog_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_recent_chooser_dialog_constructed (GObject *object) { GtkRecentChooserDialogPrivate *priv; GtkWidget *content_area; - GObject *object; - object = G_OBJECT_CLASS (gtk_recent_chooser_dialog_parent_class)->constructor (type, - n_construct_properties, - construct_params); + G_OBJECT_CLASS (gtk_recent_chooser_dialog_parent_class)->constructed (object); priv = GTK_RECENT_CHOOSER_DIALOG_GET_PRIVATE (object); - + if (priv->manager) priv->chooser = g_object_new (GTK_TYPE_RECENT_CHOOSER_WIDGET, "recent-manager", priv->manager, @@ -227,8 +220,6 @@ gtk_recent_chooser_dialog_constructor (GType type, _gtk_recent_chooser_set_delegate (GTK_RECENT_CHOOSER (object), GTK_RECENT_CHOOSER (priv->chooser)); - - return object; } static void diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c index 5d6eb803d4..d3ca056d9e 100644 --- a/gtk/gtkrecentchoosermenu.c +++ b/gtk/gtkrecentchoosermenu.c @@ -120,9 +120,7 @@ enum { static void gtk_recent_chooser_menu_finalize (GObject *object); static void gtk_recent_chooser_menu_dispose (GObject *object); -static GObject *gtk_recent_chooser_menu_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_recent_chooser_menu_constructed (GObject *object); static void gtk_recent_chooser_iface_init (GtkRecentChooserIface *iface); @@ -219,7 +217,7 @@ gtk_recent_chooser_menu_class_init (GtkRecentChooserMenuClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - gobject_class->constructor = gtk_recent_chooser_menu_constructor; + gobject_class->constructed = gtk_recent_chooser_menu_constructed; gobject_class->dispose = gtk_recent_chooser_menu_dispose; gobject_class->finalize = gtk_recent_chooser_menu_finalize; gobject_class->set_property = gtk_recent_chooser_menu_set_property; @@ -322,20 +320,13 @@ gtk_recent_chooser_menu_dispose (GObject *object) G_OBJECT_CLASS (gtk_recent_chooser_menu_parent_class)->dispose (object); } -static GObject * -gtk_recent_chooser_menu_constructor (GType type, - guint n_params, - GObjectConstructParam *params) +static void +gtk_recent_chooser_menu_constructed (GObject *object) { - GtkRecentChooserMenu *menu; - GtkRecentChooserMenuPrivate *priv; - GObjectClass *parent_class; - GObject *object; - - parent_class = G_OBJECT_CLASS (gtk_recent_chooser_menu_parent_class); - object = parent_class->constructor (type, n_params, params); - menu = GTK_RECENT_CHOOSER_MENU (object); - priv = menu->priv; + GtkRecentChooserMenu *menu = GTK_RECENT_CHOOSER_MENU (object); + GtkRecentChooserMenuPrivate *priv = menu->priv; + + G_OBJECT_CLASS (gtk_recent_chooser_menu_parent_class)->constructed (object); g_assert (priv->manager); @@ -361,8 +352,6 @@ gtk_recent_chooser_menu_constructor (GType type, /* (re)populate the menu */ gtk_recent_chooser_menu_populate (menu); - - return object; } static void diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 8b6fbc35e3..c8479ea4ff 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -113,9 +113,7 @@ struct _GtkScaleButtonPrivate GtkAdjustment *adjustment; /* needed because it must be settable in init() */ }; -static GObject* gtk_scale_button_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_scale_button_constructed (GObject *object); static void gtk_scale_button_dispose (GObject *object); static void gtk_scale_button_finalize (GObject *object); static void gtk_scale_button_set_property (GObject *object, @@ -162,7 +160,7 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass) GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass); GtkBindingSet *binding_set; - gobject_class->constructor = gtk_scale_button_constructor; + gobject_class->constructed = gtk_scale_button_constructed; gobject_class->finalize = gtk_scale_button_finalize; gobject_class->dispose = gtk_scale_button_dispose; gobject_class->set_property = gtk_scale_button_set_property; @@ -362,26 +360,17 @@ gtk_scale_button_init (GtkScaleButton *button) gtk_widget_add_events (GTK_WIDGET (button), GDK_SCROLL_MASK); } -static GObject * -gtk_scale_button_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_scale_button_constructed (GObject *object) { - GObject *object; - GtkScaleButton *button; - GtkScaleButtonPrivate *priv; + GtkScaleButton *button = GTK_SCALE_BUTTON (object); + GtkScaleButtonPrivate *priv = button->priv; - object = G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructor (type, n_construct_properties, construct_params); - - button = GTK_SCALE_BUTTON (object); - - priv = button->priv; + G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructed (object); /* set button text and size */ priv->size = GTK_ICON_SIZE_SMALL_TOOLBAR; gtk_scale_button_update_icon (button); - - return object; } static void diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index af3fecd9e9..043b00fdc4 100644 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -154,9 +154,7 @@ struct _GtkStatusIconPrivate guint visible : 1; }; -static GObject* gtk_status_icon_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params); +static void gtk_status_icon_constructed (GObject *object); static void gtk_status_icon_finalize (GObject *object); static void gtk_status_icon_set_property (GObject *object, guint prop_id, @@ -206,7 +204,7 @@ gtk_status_icon_class_init (GtkStatusIconClass *class) { GObjectClass *gobject_class = (GObjectClass *) class; - gobject_class->constructor = gtk_status_icon_constructor; + gobject_class->constructed = gtk_status_icon_constructed; gobject_class->finalize = gtk_status_icon_finalize; gobject_class->set_property = gtk_status_icon_set_property; gobject_class->get_property = gtk_status_icon_get_property; @@ -959,30 +957,20 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) #endif } -static GObject* -gtk_status_icon_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_params) +static void +gtk_status_icon_constructed (GObject *object) { - GObject *object; -#ifdef GDK_WINDOWING_X11 - GtkStatusIcon *status_icon; - GtkStatusIconPrivate *priv; -#endif - - object = G_OBJECT_CLASS (gtk_status_icon_parent_class)->constructor (type, - n_construct_properties, - construct_params); + G_OBJECT_CLASS (gtk_status_icon_parent_class)->constructed (object); #ifdef GDK_WINDOWING_X11 - status_icon = GTK_STATUS_ICON (object); - priv = status_icon->priv; + { + GtkStatusIcon *status_icon = GTK_STATUS_ICON (object); + GtkStatusIconPrivate *priv = status_icon->priv; - if (priv->visible && priv->tray_icon) - gtk_widget_show (priv->tray_icon); + if (priv->visible && priv->tray_icon) + gtk_widget_show (priv->tray_icon); + } #endif - - return object; } static void diff --git a/gtk/gtktreemenu.c b/gtk/gtktreemenu.c index 0cbf64e8db..288a659251 100644 --- a/gtk/gtktreemenu.c +++ b/gtk/gtktreemenu.c @@ -52,9 +52,7 @@ #include "deprecated/gtktearoffmenuitem.h" /* GObjectClass */ -static GObject *gtk_tree_menu_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); +static void gtk_tree_menu_constructed (GObject *object); static void gtk_tree_menu_dispose (GObject *object); static void gtk_tree_menu_finalize (GObject *object); static void gtk_tree_menu_set_property (GObject *object, @@ -227,7 +225,7 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) tree_menu_path_quark = g_quark_from_static_string ("gtk-tree-menu-path"); - object_class->constructor = gtk_tree_menu_constructor; + object_class->constructed = gtk_tree_menu_constructed; object_class->dispose = gtk_tree_menu_dispose; object_class->finalize = gtk_tree_menu_finalize; object_class->set_property = gtk_tree_menu_set_property; @@ -397,20 +395,13 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) /**************************************************************** * GObjectClass * ****************************************************************/ -static GObject * -gtk_tree_menu_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_tree_menu_constructed (GObject *object) { - GObject *object; - GtkTreeMenu *menu; - GtkTreeMenuPrivate *priv; + GtkTreeMenu *menu = GTK_TREE_MENU (object); + GtkTreeMenuPrivate *priv = menu->priv; - object = G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - menu = GTK_TREE_MENU (object); - priv = menu->priv; + G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->constructed (object); if (!priv->area) { @@ -424,8 +415,6 @@ gtk_tree_menu_constructor (GType type, priv->size_changed_id = g_signal_connect (priv->context, "notify", G_CALLBACK (context_size_changed_cb), menu); - - return object; } static void diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index df833c0f36..87fc72b4ae 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -71,9 +71,7 @@ static void gtk_tree_view_column_get_property (GObject GParamSpec *pspec); static void gtk_tree_view_column_finalize (GObject *object); static void gtk_tree_view_column_dispose (GObject *object); -static GObject *gtk_tree_view_column_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); +static void gtk_tree_view_column_constructed (GObject *object); /* GtkCellLayout implementation */ static void gtk_tree_view_column_ensure_cell_area (GtkTreeViewColumn *column, @@ -226,7 +224,7 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class) class->clicked = NULL; - object_class->constructor = gtk_tree_view_column_constructor; + object_class->constructed = gtk_tree_view_column_constructed; object_class->finalize = gtk_tree_view_column_finalize; object_class->dispose = gtk_tree_view_column_dispose; object_class->set_property = gtk_tree_view_column_set_property; @@ -476,22 +474,14 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column) priv->title = g_strdup (""); } -static GObject * -gtk_tree_view_column_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) +static void +gtk_tree_view_column_constructed (GObject *object) { - GtkTreeViewColumn *tree_column; - GObject *object; + GtkTreeViewColumn *tree_column = GTK_TREE_VIEW_COLUMN (object); - object = G_OBJECT_CLASS (gtk_tree_view_column_parent_class)->constructor - (type, n_construct_properties, construct_properties); - - tree_column = (GtkTreeViewColumn *) object; + G_OBJECT_CLASS (gtk_tree_view_column_parent_class)->constructed (object); gtk_tree_view_column_ensure_cell_area (tree_column, NULL); - - return object; } static void diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index e48d552a11..a59e37913d 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -372,9 +372,7 @@ struct _GtkWindowGeometryInfo }; -static GObject *gtk_window_constructor (GType type, - guint n_params, - GObjectConstructParam *params); +static void gtk_window_constructed (GObject *object); static void gtk_window_dispose (GObject *object); static void gtk_window_finalize (GObject *object); static void gtk_window_destroy (GtkWidget *widget); @@ -657,7 +655,7 @@ gtk_window_class_init (GtkWindowClass *klass) quark_gtk_window_icon_info = g_quark_from_static_string ("gtk-window-icon-info"); quark_gtk_buildable_accels = g_quark_from_static_string ("gtk-window-buildable-accels"); - gobject_class->constructor = gtk_window_constructor; + gobject_class->constructed = gtk_window_constructed; gobject_class->dispose = gtk_window_dispose; gobject_class->finalize = gtk_window_finalize; @@ -1565,17 +1563,14 @@ gtk_window_init (GtkWindow *window) priv->scale = gtk_widget_get_scale_factor (widget); } -static GObject * -gtk_window_constructor (GType type, - guint n_params, - GObjectConstructParam *params) +static void +gtk_window_constructed (GObject *object) { - GObject *object; - GtkWindowPrivate *priv; + GtkWindow *window = GTK_WINDOW (object); + GtkWindowPrivate *priv = window->priv; - object = G_OBJECT_CLASS (gtk_window_parent_class)->constructor (type, n_params, params); + G_OBJECT_CLASS (gtk_window_parent_class)->constructed (object); - priv = GTK_WINDOW (object)->priv; if (priv->type == GTK_WINDOW_TOPLEVEL) { priv->multipress_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (object)); @@ -1585,8 +1580,6 @@ gtk_window_constructor (GType type, g_signal_connect (priv->multipress_gesture, "stopped", G_CALLBACK (multipress_gesture_stopped_cb), object); } - - return object; } static void