diff options
author | Dan Winship <danw@gnome.org> | 2011-12-20 15:15:42 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-02-03 10:33:43 -0600 |
commit | 9fd98ef91b90d9ea56440c2915280ea9d5d01ef2 (patch) | |
tree | 17188480e64aa02ca2b2fb56f8de2965a5609fed /libnm-glib/nm-ip4-config.c | |
parent | ad5daa098c308ae58a6d54c453c73451044598fc (diff) | |
download | NetworkManager-9fd98ef91b90d9ea56440c2915280ea9d5d01ef2.tar.gz |
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-ip4-config.c')
-rw-r--r-- | libnm-glib/nm-ip4-config.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c index 3ea5db0506..56678545e8 100644 --- a/libnm-glib/nm-ip4-config.c +++ b/libnm-glib/nm-ip4-config.c @@ -132,32 +132,23 @@ register_properties (NMIP4Config *config) property_info); } -static GObject* -constructor (GType type, - guint n_construct_params, - GObjectConstructParam *construct_params) +static void +constructed (GObject *object) { - NMObject *object; DBusGConnection *connection; NMIP4ConfigPrivate *priv; - object = (NMObject *) G_OBJECT_CLASS (nm_ip4_config_parent_class)->constructor (type, - n_construct_params, - construct_params); - if (!object) - return NULL; + G_OBJECT_CLASS (nm_ip4_config_parent_class)->constructed (object); priv = NM_IP4_CONFIG_GET_PRIVATE (object); - connection = nm_object_get_connection (object); + connection = nm_object_get_connection (NM_OBJECT (object)); priv->proxy = dbus_g_proxy_new_for_name (connection, NM_DBUS_SERVICE, - nm_object_get_path (object), + nm_object_get_path (NM_OBJECT (object)), NM_DBUS_INTERFACE_IP4_CONFIG); register_properties (NM_IP4_CONFIG (object)); - - return G_OBJECT (object); } static void @@ -226,7 +217,7 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) g_type_class_add_private (config_class, sizeof (NMIP4ConfigPrivate)); /* virtual methods */ - object_class->constructor = constructor; + object_class->constructed = constructed; object_class->get_property = get_property; object_class->finalize = finalize; |