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-device-modem.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-device-modem.c')
-rw-r--r-- | libnm/nm-device-modem.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libnm/nm-device-modem.c b/libnm/nm-device-modem.c index 7d286190f3..400ef58cf6 100644 --- a/libnm/nm-device-modem.c +++ b/libnm/nm-device-modem.c @@ -186,32 +186,24 @@ nm_device_modem_init (NMDeviceModem *device) } static void -register_properties (NMDeviceModem *device) +init_dbus (NMObject *object) { - NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device); + NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { { NM_DEVICE_MODEM_MODEM_CAPABILITIES, &priv->caps }, { NM_DEVICE_MODEM_CURRENT_CAPABILITIES, &priv->current_caps }, { NULL }, }; - _nm_object_register_properties (NM_OBJECT (device), + NM_OBJECT_CLASS (nm_device_modem_parent_class)->init_dbus (object); + + priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_MODEM); + _nm_object_register_properties (object, priv->proxy, property_info); } static void -constructed (GObject *object) -{ - NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (object); - - G_OBJECT_CLASS (nm_device_modem_parent_class)->constructed (object); - - priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_MODEM); - register_properties (NM_DEVICE_MODEM (object)); -} - -static void get_property (GObject *object, guint prop_id, GValue *value, @@ -248,15 +240,17 @@ static void nm_device_modem_class_init (NMDeviceModemClass *modem_class) { GObjectClass *object_class = G_OBJECT_CLASS (modem_class); + NMObjectClass *nm_object_class = NM_OBJECT_CLASS (modem_class); NMDeviceClass *device_class = NM_DEVICE_CLASS (modem_class); g_type_class_add_private (modem_class, sizeof (NMDeviceModemPrivate)); /* virtual methods */ - object_class->constructed = constructed; object_class->get_property = get_property; object_class->dispose = dispose; + nm_object_class->init_dbus = init_dbus; + device_class->get_type_description = get_type_description; device_class->connection_compatible = connection_compatible; device_class->get_setting_type = get_setting_type; |