summaryrefslogtreecommitdiff
path: root/libnm/nm-device-olpc-mesh.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-05-15 14:24:56 -0400
committerDan Winship <danw@gnome.org>2014-08-01 14:34:40 -0400
commit8ca2998d81ca7534c59262b10f5bf3c480177b88 (patch)
tree964e32c42f1e8358fffe09b163bc2cb87963df4e /libnm/nm-device-olpc-mesh.c
parenta0e9a4bd45f25548f1fe580ddaf96ca6ff567721 (diff)
downloadNetworkManager-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-olpc-mesh.c')
-rw-r--r--libnm/nm-device-olpc-mesh.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/libnm/nm-device-olpc-mesh.c b/libnm/nm-device-olpc-mesh.c
index b51d656a3a..2416e3810a 100644
--- a/libnm/nm-device-olpc-mesh.c
+++ b/libnm/nm-device-olpc-mesh.c
@@ -169,9 +169,9 @@ nm_device_olpc_mesh_init (NMDeviceOlpcMesh *device)
}
static void
-register_properties (NMDeviceOlpcMesh *device)
+init_dbus (NMObject *object)
{
- NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (device);
+ NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_OLPC_MESH_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_OLPC_MESH_COMPANION, &priv->companion, NULL, NM_TYPE_DEVICE_WIFI },
@@ -179,23 +179,15 @@ register_properties (NMDeviceOlpcMesh *device)
{ NULL },
};
- _nm_object_register_properties (NM_OBJECT (device),
+ NM_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->init_dbus (object);
+
+ priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH);
+ _nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
-constructed (GObject *object)
-{
- NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
-
- G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->constructed (object);
-
- priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH);
- register_properties (NM_DEVICE_OLPC_MESH (object));
-}
-
-static void
dispose (GObject *object)
{
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
@@ -246,15 +238,18 @@ static void
nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *olpc_mesh_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (olpc_mesh_class);
+ NMObjectClass *nm_object_class = NM_OBJECT_CLASS (olpc_mesh_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (olpc_mesh_class);
g_type_class_add_private (olpc_mesh_class, sizeof (NMDeviceOlpcMeshPrivate));
/* virtual methods */
- object_class->constructed = constructed;
object_class->dispose = dispose;
object_class->finalize = finalize;
object_class->get_property = get_property;
+
+ nm_object_class->init_dbus = init_dbus;
+
device_class->connection_compatible = connection_compatible;
device_class->get_setting_type = get_setting_type;
device_class->get_hw_address = get_hw_address;