summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-remote-connection.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2011-12-20 15:15:42 -0500
committerDan Williams <dcbw@redhat.com>2012-02-03 10:33:43 -0600
commit9fd98ef91b90d9ea56440c2915280ea9d5d01ef2 (patch)
tree17188480e64aa02ca2b2fb56f8de2965a5609fed /libnm-glib/nm-remote-connection.c
parentad5daa098c308ae58a6d54c453c73451044598fc (diff)
libnm-glib: implement GInitable/GAsyncInitable in NMObject
Implement GInitable and GAsyncInitable in NMObject, with implementations that synchronously or asynchonously load all properties, and change _nm_object_ensure_inited() to run g_initable_init(). Update the object/object-array property handling to initialize the objects after creating them (synchronously or asynchronously, according to the situation), so that they will have all of their properties preloaded before they are ever visible to the caller. Move the non-blocking/non-failable parts of various objects' constructor() methods to constructed(), and move the blocking/failable parts to init(), and implement init_async() methods with non-blocking versions of the blocking methods. Make nm_device_new() and nm_client_new() call _nm_object_ensure_inited(), to preserve the behaviour formerly enforced by their construct() methods, that properties are guaranteed to be initialized before any signals involving them are emitted.
Diffstat (limited to 'libnm-glib/nm-remote-connection.c')
-rw-r--r--libnm-glib/nm-remote-connection.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 91d3d469f..d8bcfd97f 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -382,18 +382,11 @@ nm_remote_connection_new (DBusGConnection *bus,
NULL);
}
-static GObject *
-constructor (GType type,
- guint n_construct_params,
- GObjectConstructParam *construct_params)
+static void
+constructed (GObject *object)
{
- GObject *object;
NMRemoteConnectionPrivate *priv;
- object = G_OBJECT_CLASS (nm_remote_connection_parent_class)->constructor (type, n_construct_params, construct_params);
- if (!object)
- return NULL;
-
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
g_assert (priv->bus);
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
@@ -414,7 +407,6 @@ constructor (GType type,
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
init_get_settings_cb, object, NULL,
G_TYPE_INVALID);
- return object;
}
static void
@@ -486,7 +478,7 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->dispose = dispose;
- object_class->constructor = constructor;
+ object_class->constructed = constructed;
/* Properties */
g_object_class_install_property