summaryrefslogtreecommitdiff
path: root/libnm/nm-vpn-connection.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-vpn-connection.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-vpn-connection.c')
-rw-r--r--libnm/nm-vpn-connection.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c
index d50fb74f35..d816dde6f7 100644
--- a/libnm/nm-vpn-connection.c
+++ b/libnm/nm-vpn-connection.c
@@ -124,28 +124,21 @@ nm_vpn_connection_init (NMVpnConnection *connection)
}
static void
-register_properties (NMVpnConnection *connection)
+init_dbus (NMObject *object)
{
- NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
+ NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_VPN_CONNECTION_BANNER, &priv->banner },
{ NM_VPN_CONNECTION_VPN_STATE, &priv->vpn_state },
{ NULL },
};
- _nm_object_register_properties (NM_OBJECT (connection),
+ NM_OBJECT_CLASS (nm_vpn_connection_parent_class)->init_dbus (object);
+
+ priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_VPN_CONNECTION);
+ _nm_object_register_properties (object,
priv->proxy,
property_info);
-}
-
-static void
-constructed (GObject *object)
-{
- NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
-
- G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructed (object);
-
- priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_VPN_CONNECTION);
dbus_g_object_register_marshaller (g_cclosure_marshal_generic,
G_TYPE_NONE,
@@ -157,8 +150,6 @@ constructed (GObject *object)
G_CALLBACK (vpn_state_changed_proxy),
object,
NULL);
-
- register_properties (NM_VPN_CONNECTION (object));
}
static void
@@ -199,14 +190,16 @@ static void
nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (connection_class);
+ NMObjectClass *nm_object_class = NM_OBJECT_CLASS (connection_class);
g_type_class_add_private (connection_class, sizeof (NMVpnConnectionPrivate));
/* virtual methods */
- object_class->constructed = constructed;
object_class->get_property = get_property;
object_class->finalize = finalize;
+ nm_object_class->init_dbus = init_dbus;
+
/* properties */
/**