[spice-gtk 2/2] Implement GObject::constructed rather than ::constructor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few classes are implementing GObject::constructor, which is more
cumbersome to use than ::constructed. Other classes use ::constructed
rather than ::constructor. This commit removes the last uses of
::constructor.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 src/spice-gtk-session.c | 20 ++++----------------
 src/spice-widget.c      | 20 ++++----------------
 src/usb-device-widget.c | 19 ++++---------------
 3 files changed, 12 insertions(+), 47 deletions(-)

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 312cf599..31f60dc4 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -236,25 +236,15 @@ static void spice_gtk_session_init(SpiceGtkSession *self)
                                   G_CALLBACK(keymap_modifiers_changed), self, 0);
 }
 
-static GObject *
-spice_gtk_session_constructor(GType                  gtype,
-                              guint                  n_properties,
-                              GObjectConstructParam *properties)
+static void
+spice_gtk_session_constructed(GObject *gobject)
 {
-    GObject *obj;
     SpiceGtkSession *self;
     SpiceGtkSessionPrivate *s;
     GList *list;
     GList *it;
 
-    {
-        /* Always chain up to the parent constructor */
-        GObjectClass *parent_class;
-        parent_class = G_OBJECT_CLASS(spice_gtk_session_parent_class);
-        obj = parent_class->constructor(gtype, n_properties, properties);
-    }
-
-    self = SPICE_GTK_SESSION(obj);
+    self = SPICE_GTK_SESSION(gobject);
     s = self->priv;
     if (!s->session)
         g_error("SpiceGtKSession constructed without a session");
@@ -268,8 +258,6 @@ spice_gtk_session_constructor(GType                  gtype,
         channel_new(s->session, it->data, (gpointer*)self);
     }
     g_list_free(list);
-
-    return obj;
 }
 
 static void spice_gtk_session_dispose(GObject *gobject)
@@ -405,7 +393,7 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
-    gobject_class->constructor  = spice_gtk_session_constructor;
+    gobject_class->constructed  = spice_gtk_session_constructed;
     gobject_class->dispose      = spice_gtk_session_dispose;
     gobject_class->finalize     = spice_gtk_session_finalize;
     gobject_class->get_property = spice_gtk_session_get_property;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 5365222f..316043a9 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -686,25 +686,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS
     d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms);
 }
 
-static GObject *
-spice_display_constructor(GType                  gtype,
-                          guint                  n_properties,
-                          GObjectConstructParam *properties)
+static void
+spice_display_constructed(GObject *gobject)
 {
-    GObject *obj;
     SpiceDisplay *display;
     SpiceDisplayPrivate *d;
     GList *list;
     GList *it;
 
-    {
-        /* Always chain up to the parent constructor */
-        GObjectClass *parent_class;
-        parent_class = G_OBJECT_CLASS(spice_display_parent_class);
-        obj = parent_class->constructor(gtype, n_properties, properties);
-    }
-
-    display = SPICE_DISPLAY(obj);
+    display = SPICE_DISPLAY(gobject);
     d = display->priv;
 
     if (!d->session)
@@ -730,8 +720,6 @@ spice_display_constructor(GType                  gtype,
     spice_g_signal_connect_object(d->session, "notify::inhibit-keyboard-grab",
                                   G_CALLBACK(session_inhibit_keyboard_grab_changed),
                                   display, 0);
-
-    return obj;
 }
 
 /**
@@ -2191,7 +2179,7 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
     gtkwidget_class->realize = realize;
     gtkwidget_class->unrealize = unrealize;
 
-    gobject_class->constructor = spice_display_constructor;
+    gobject_class->constructed = spice_display_constructed;
     gobject_class->dispose = spice_display_dispose;
     gobject_class->finalize = spice_display_finalize;
     gobject_class->get_property = spice_display_get_property;
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 747887cb..a3c09101 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -180,10 +180,8 @@ spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget *self,
     gtk_widget_show_all(priv->info_bar);
 }
 
-static GObject *spice_usb_device_widget_constructor(
-    GType gtype, guint n_properties, GObjectConstructParam *properties)
+static void spice_usb_device_widget_constructed(GObject *gobject)
 {
-    GObject *obj;
     SpiceUsbDeviceWidget *self;
     SpiceUsbDeviceWidgetPrivate *priv;
     GPtrArray *devices = NULL;
@@ -191,14 +189,7 @@ static GObject *spice_usb_device_widget_constructor(
     gchar *str;
     int i;
 
-    {
-        /* Always chain up to the parent constructor */
-        GObjectClass *parent_class;
-        parent_class = G_OBJECT_CLASS(spice_usb_device_widget_parent_class);
-        obj = parent_class->constructor(gtype, n_properties, properties);
-    }
-
-    self = SPICE_USB_DEVICE_WIDGET(obj);
+    self = SPICE_USB_DEVICE_WIDGET(gobject);
     priv = self->priv;
     if (!priv->session)
         g_error("SpiceUsbDeviceWidget constructed without a session");
@@ -216,7 +207,7 @@ static GObject *spice_usb_device_widget_constructor(
                                               GTK_MESSAGE_WARNING,
                                               "dialog-warning");
         g_clear_error(&err);
-        return obj;
+        return;
     }
 
     g_signal_connect(priv->manager, "device-added",
@@ -237,8 +228,6 @@ static GObject *spice_usb_device_widget_constructor(
 
 end:
     spice_usb_device_widget_update_status(self);
-
-    return obj;
 }
 
 static void spice_usb_device_widget_finalize(GObject *object)
@@ -269,7 +258,7 @@ static void spice_usb_device_widget_class_init(
 
     g_type_class_add_private (klass, sizeof (SpiceUsbDeviceWidgetPrivate));
 
-    gobject_class->constructor  = spice_usb_device_widget_constructor;
+    gobject_class->constructed  = spice_usb_device_widget_constructed;
     gobject_class->finalize     = spice_usb_device_widget_finalize;
     gobject_class->get_property = spice_usb_device_widget_get_property;
     gobject_class->set_property = spice_usb_device_widget_set_property;
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]