Commit 8ca2998d authored by Dan Winship's avatar Dan Winship

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.)
parent a0e9a4bd
......@@ -460,9 +460,9 @@ demarshal_ssid (NMObject *object, GParamSpec *pspec, GValue *value, gpointer fie
}
static void
register_properties (NMAccessPoint *ap)
init_dbus (NMObject *object)
{
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_ACCESS_POINT_FLAGS, &priv->flags },
{ NM_ACCESS_POINT_WPA_FLAGS, &priv->wpa_flags },
......@@ -477,37 +477,30 @@ register_properties (NMAccessPoint *ap)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (ap),
NM_OBJECT_CLASS (nm_access_point_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_ACCESS_POINT);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMAccessPointPrivate *priv;
G_OBJECT_CLASS (nm_access_point_parent_class)->constructed (object);
priv = NM_ACCESS_POINT_GET_PRIVATE (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_ACCESS_POINT);
register_properties (NM_ACCESS_POINT (object));
}
static void
nm_access_point_class_init (NMAccessPointClass *ap_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (ap_class);
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
/* virtual methods */
object_class->constructed = constructed;
object_class->get_property = get_property;
object_class->dispose = dispose;
object_class->finalize = finalize;
nm_object_class->init_dbus = init_dbus;
/* properties */
/**
......
......@@ -563,9 +563,9 @@ get_property (GObject *object,
}
static void
register_properties (NMActiveConnection *connection)
init_dbus (NMObject *object)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection },
{ NM_ACTIVE_CONNECTION_ID, &priv->id },
......@@ -586,36 +586,30 @@ register_properties (NMActiveConnection *connection)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (connection),
NM_OBJECT_CLASS (nm_active_connection_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_active_connection_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
register_properties (NM_ACTIVE_CONNECTION (object));
}
static void
nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (ap_class);
g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate));
/* virtual methods */
object_class->constructed = constructed;
object_class->get_property = get_property;
object_class->dispose = dispose;
object_class->finalize = finalize;
nm_object_class->init_dbus = init_dbus;
/* properties */
/**
......
......@@ -170,10 +170,14 @@ wireless_enabled_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
poke_wireless_devices_with_rf_status (NM_CLIENT (object));
}
static void client_recheck_permissions (DBusGProxy *proxy, gpointer user_data);
static void active_connections_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
static void object_creation_failed_cb (GObject *object, GError *error, char *failed_path);
static void
register_properties (NMClient *client)
init_dbus (NMObject *object)
{
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (client);
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_CLIENT_VERSION, &priv->version },
{ NM_CLIENT_STATE, &priv->state },
......@@ -193,9 +197,38 @@ register_properties (NMClient *client)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (client),
NM_OBJECT_CLASS (nm_client_parent_class)->init_dbus (object);
priv->client_proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE);
_nm_object_register_properties (object,
priv->client_proxy,
property_info);
/* Permissions */
dbus_g_proxy_add_signal (priv->client_proxy, "CheckPermissions", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->client_proxy,
"CheckPermissions",
G_CALLBACK (client_recheck_permissions),
object,
NULL);
if (_nm_object_is_connection_private (NM_OBJECT (object)))
priv->manager_running = TRUE;
else {
priv->bus_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
g_assert (priv->bus_proxy);
dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->bus_proxy,
"NameOwnerChanged",
G_CALLBACK (proxy_name_owner_changed),
object, NULL);
}
}
#define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network"
......@@ -1775,7 +1808,6 @@ constructor (GType type,
static void
constructed (GObject *object)
{
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object);
GError *error = NULL;
if (!nm_utils_init (&error)) {
......@@ -1786,36 +1818,6 @@ constructed (GObject *object)
G_OBJECT_CLASS (nm_client_parent_class)->constructed (object);
priv->client_proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE);
register_properties (NM_CLIENT (object));
/* Permissions */
dbus_g_proxy_add_signal (priv->client_proxy, "CheckPermissions", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->client_proxy,
"CheckPermissions",
G_CALLBACK (client_recheck_permissions),
object,
NULL);
if (_nm_object_is_connection_private (NM_OBJECT (object)))
priv->manager_running = TRUE;
else {
priv->bus_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
g_assert (priv->bus_proxy);
dbus_g_proxy_add_signal (priv->bus_proxy, "NameOwnerChanged",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->bus_proxy,
"NameOwnerChanged",
G_CALLBACK (proxy_name_owner_changed),
object, NULL);
}
g_signal_connect (object, "notify::" NM_CLIENT_WIRELESS_ENABLED,
G_CALLBACK (wireless_enabled_cb), NULL);
......@@ -2126,6 +2128,7 @@ static void
nm_client_class_init (NMClientClass *client_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (client_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (client_class);
g_type_class_add_private (client_class, sizeof (NMClientPrivate));
......@@ -2137,6 +2140,8 @@ nm_client_class_init (NMClientClass *client_class)
object_class->dispose = dispose;
object_class->finalize = finalize;
nm_object_class->init_dbus = init_dbus;
/* properties */
/**
......
......@@ -121,30 +121,22 @@ nm_device_adsl_init (NMDeviceAdsl *device)
}
static void
register_properties (NMDeviceAdsl *device)
init_dbus (NMObject *object)
{
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (device);
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_ADSL_CARRIER, &priv->carrier },
{ NM_DEVICE_ADSL_CARRIER, &priv->carrier },
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_adsl_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_ADSL);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_adsl_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_ADSL);
register_properties (NM_DEVICE_ADSL (object));
}
static void
dispose (GObject *object)
{
......@@ -190,15 +182,18 @@ static void
nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (adsl_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (adsl_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (adsl_class);
g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate));
/* 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;
......
......@@ -183,9 +183,9 @@ nm_device_bond_init (NMDeviceBond *device)
}
static void
register_properties (NMDeviceBond *device)
init_dbus (NMObject *object)
{
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device);
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_BOND_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_BOND_CARRIER, &priv->carrier },
......@@ -193,22 +193,14 @@ register_properties (NMDeviceBond *device)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_bond_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_BOND);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_bond_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BOND);
register_properties (NM_DEVICE_BOND (object));
}
static void
dispose (GObject *object)
{
......@@ -265,15 +257,18 @@ static void
nm_device_bond_class_init (NMDeviceBondClass *eth_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (eth_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (eth_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (eth_class);
g_type_class_add_private (eth_class, sizeof (NMDeviceBondPrivate));
/* 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;
......
......@@ -183,9 +183,9 @@ nm_device_bridge_init (NMDeviceBridge *device)
}
static void
register_properties (NMDeviceBridge *device)
init_dbus (NMObject *object)
{
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device);
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_BRIDGE_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_BRIDGE_CARRIER, &priv->carrier },
......@@ -193,22 +193,14 @@ register_properties (NMDeviceBridge *device)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_bridge_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_BRIDGE);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_bridge_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BRIDGE);
register_properties (NM_DEVICE_BRIDGE (object));
}
static void
dispose (GObject *object)
{
......@@ -265,15 +257,18 @@ static void
nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (bridge_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (bridge_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (bridge_class);
g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate));
/* 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;
......
......@@ -221,9 +221,9 @@ nm_device_bt_init (NMDeviceBt *device)
}
static void
register_properties (NMDeviceBt *device)
init_dbus (NMObject *object)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_BT_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_BT_NAME, &priv->name },
......@@ -231,22 +231,14 @@ register_properties (NMDeviceBt *device)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_bt_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_bt_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH);
register_properties (NM_DEVICE_BT (object));
}
static void
dispose (GObject *object)
{
......@@ -298,15 +290,18 @@ static void
nm_device_bt_class_init (NMDeviceBtClass *bt_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (bt_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (bt_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (bt_class);
g_type_class_add_private (bt_class, sizeof (NMDeviceBtPrivate));
/* 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;
......
......@@ -220,9 +220,9 @@ nm_device_ethernet_init (NMDeviceEthernet *device)
}
static void
register_properties (NMDeviceEthernet *device)
init_dbus (NMObject *object)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_ETHERNET_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, &priv->perm_hw_address },
......@@ -231,22 +231,14 @@ register_properties (NMDeviceEthernet *device)
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_ethernet_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_WIRED);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_WIRED);
register_properties (NM_DEVICE_ETHERNET (object));
}
static void
dispose (GObject *object)
{
......@@ -301,15 +293,18 @@ static void
nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (eth_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (eth_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (eth_class);
g_type_class_add_private (eth_class, sizeof (NMDeviceEthernetPrivate));
/* 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;
......
......@@ -139,31 +139,23 @@ nm_device_generic_init (NMDeviceGeneric *device)
}
static void
register_properties (NMDeviceGeneric *device)
init_dbus (NMObject *object)
{
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (device);
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_GENERIC_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_GENERIC_TYPE_DESCRIPTION, &priv->type_description },
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_generic_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_GENERIC);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_generic_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_GENERIC);
register_properties (NM_DEVICE_GENERIC (object));
}
static void
dispose (GObject *object)
{
......@@ -212,15 +204,17 @@ static void
nm_device_generic_class_init (NMDeviceGenericClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate));
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->get_type_description = get_type_description;
device_class->get_hw_address = get_hw_address;
device_class->connection_compatible = connection_compatible;
......
......@@ -172,31 +172,23 @@ nm_device_infiniband_init (NMDeviceInfiniband *device)
}
static void
register_properties (NMDeviceInfiniband *device)
init_dbus (NMObject *object)
{
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (device);
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_DEVICE_INFINIBAND_HW_ADDRESS, &priv->hw_address },
{ NM_DEVICE_INFINIBAND_CARRIER, &priv->carrier },
{ NULL },
};
_nm_object_register_properties (NM_OBJECT (device),
NM_OBJECT_CLASS (nm_device_infiniband_parent_class)->init_dbus (object);
priv->proxy = _nm_object_new_proxy (object, NULL, NM_DBUS_INTERFACE_DEVICE_INFINIBAND);
_nm_object_register_properties (object,
priv->proxy,
property_info);
}
static void
constructed (GObject *object)
{
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
G_OBJECT_CLASS (nm_device_infiniband_parent_class)->constructed (object);
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_INFINIBAND);
register_properties (NM_DEVICE_INFINIBAND (object));
}
static void
dispose (GObject *object)
{
......@@ -244,15 +236,18 @@ static void
nm_device_infiniband_class_init (NMDeviceInfinibandClass *eth_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (eth_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (eth_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (eth_class);
g_type_class_add_private (eth_class, sizeof (NMDeviceInfinibandPrivate));
/* 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;
......
......@@ -186,31 +186,23 @@ 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,
......@@ -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;
......
......@@ -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,22 +179,14 @@ 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));