[virt-tools-list] [PATCH virt-viewer v2 2/3] Use 'constructed' vfunc instead of 'constructor'

Jonathon Jongsma jjongsma at redhat.com
Thu Mar 19 16:16:11 UTC 2015


We don't need the added complexity of 'constructor', since we only want
to do some final initializing after all of the properties have been set,
etc. So just use the simpler 'constructed'.
---
 src/virt-viewer-app.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 4f05b51..2153d54 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1798,16 +1798,10 @@ virt_viewer_update_smartcard_accels(VirtViewerApp *self)
     }
 }
 
-static GObject *
-virt_viewer_app_constructor (GType gtype,
-                             guint n_properties,
-                             GObjectConstructParam *properties)
+static void
+virt_viewer_app_constructed (GObject *object)
 {
-    GObject *obj;
-    VirtViewerApp *self;
-
-    obj = G_OBJECT_CLASS (virt_viewer_app_parent_class)->constructor (gtype, n_properties, properties);
-    self = VIRT_VIEWER_APP(obj);
+    VirtViewerApp *self = VIRT_VIEWER_APP(object);
 
     self->priv->main_window = virt_viewer_app_window_new(self, 0);
     self->priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(self->priv->main_window));
@@ -1825,8 +1819,6 @@ virt_viewer_app_constructor (GType gtype,
     gtk_accel_map_add_entry("<virt-viewer>/view/zoom-out", GDK_minus, GDK_CONTROL_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/view/zoom-in", GDK_plus, GDK_CONTROL_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/send/secure-attention", GDK_End, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-
-    return obj;
 }
 
 static void
@@ -1836,7 +1828,7 @@ virt_viewer_app_class_init (VirtViewerAppClass *klass)
 
     g_type_class_add_private (klass, sizeof (VirtViewerAppPrivate));
 
-    object_class->constructor = virt_viewer_app_constructor;
+    object_class->constructed = virt_viewer_app_constructed;
     object_class->get_property = virt_viewer_app_get_property;
     object_class->set_property = virt_viewer_app_set_property;
     object_class->dispose = virt_viewer_app_dispose;
-- 
2.1.0




More information about the virt-tools-list mailing list