diff options
author | Dan Winship <danw@gnome.org> | 2014-05-15 14:24:56 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-08-01 14:34:40 -0400 |
commit | 8ca2998d81ca7534c59262b10f5bf3c480177b88 (patch) | |
tree | 964e32c42f1e8358fffe09b163bc2cb87963df4e /libnm/nm-dhcp6-config.c | |
parent | a0e9a4bd45f25548f1fe580ddaf96ca6ff567721 (diff) | |
download | NetworkManager-8ca2998d81ca7534c59262b10f5bf3c480177b88.tar.gz |
libnm: add init_dbus() virtual method to NMObject
Rather than having each object type override constructed() to call
_nm_object_register_properties(), have NMObject call a virtual method
on the subclass to ask it to register them.
Move some code around in nm-client.c and nm-object.c so that all
D-Bus-related initialization happens in init_dbus(), and
non-D-Bus-related stuff stays in construct().
(This simplifies the next commit.)
Diffstat (limited to 'libnm/nm-dhcp6-config.c')
-rw-r--r-- | libnm/nm-dhcp6-config.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libnm/nm-dhcp6-config.c b/libnm/nm-dhcp6-config.c index bea41d4e4a..dc639d3acd 100644 --- a/libnm/nm-dhcp6-config.c +++ b/libnm/nm-dhcp6-config.c @@ -72,15 +72,18 @@ demarshal_dhcp6_options (NMObject *object, GParamSpec *pspec, GValue *value, gpo } static void -register_properties (NMDhcp6Config *config) +init_dbus (NMObject *object) { - NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (config); + NMDhcp6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { { NM_DHCP6_CONFIG_OPTIONS, &priv->options, demarshal_dhcp6_options }, { NULL }, }; - _nm_object_register_properties (NM_OBJECT (config), + NM_OBJECT_CLASS (nm_dhcp6_config_parent_class)->init_dbus (object); + + priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DHCP6_CONFIG); + _nm_object_register_properties (object, priv->proxy, property_info); } @@ -94,8 +97,6 @@ constructed (GObject *object) priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DHCP6_CONFIG); - register_properties (NM_DHCP6_CONFIG (object)); } static void @@ -135,6 +136,7 @@ static void nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class) { GObjectClass *object_class = G_OBJECT_CLASS (config_class); + NMObjectClass *nm_object_class = NM_OBJECT_CLASS (config_class); g_type_class_add_private (config_class, sizeof (NMDhcp6ConfigPrivate)); @@ -143,6 +145,8 @@ nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class) object_class->get_property = get_property; object_class->finalize = finalize; + nm_object_class->init_dbus = init_dbus; + /* properties */ /** |