about summary refs log tree commit diff
path: root/libnm-glib/nm-device-bond.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-glib/nm-device-bond.c')
-rw-r--r--libnm-glib/nm-device-bond.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/libnm-glib/nm-device-bond.c b/libnm-glib/nm-device-bond.c
index 6261db91..b2af2ec3 100644
--- a/libnm-glib/nm-device-bond.c
+++ b/libnm-glib/nm-device-bond.c
@@ -56,10 +56,6 @@ enum {
 	LAST_PROP
 };
 
-#define DBUS_PROP_HW_ADDRESS "HwAddress"
-#define DBUS_PROP_CARRIER "Carrier"
-#define DBUS_PROP_SLAVES "Slaves"
-
 /**
  * nm_device_bond_error_quark:
  *
@@ -144,7 +140,7 @@ nm_device_bond_get_carrier (NMDeviceBond *device)
  * Gets the devices currently slaved to @device.
  *
  * Returns: (element-type NMClient.Device): the #GPtrArray containing
- * #NMDevice<!-- -->s that are slaves of @device. This is the internal
+ * #NMDevices that are slaves of @device. This is the internal
  * copy used by the device, and must not be modified.
  *
  * Since: 0.9.6.4
@@ -165,8 +161,6 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
 	NMSettingBond *s_bond;
 	const char *ctype, *dev_iface_name, *bond_iface_name;
 
-	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
 	s_con = nm_connection_get_setting_connection (connection);
 	g_assert (s_con);
 
@@ -194,7 +188,19 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
 
 	/* FIXME: check slaves? */
 
-	return TRUE;
+	return NM_DEVICE_CLASS (nm_device_bond_parent_class)->connection_compatible (device, connection, error);
+}
+
+static GType
+get_setting_type (NMDevice *device)
+{
+	return NM_TYPE_SETTING_BOND;
+}
+
+static const char *
+get_hw_address (NMDevice *device)
+{
+	return nm_device_bond_get_hw_address (NM_DEVICE_BOND (device));
 }
 
 /***********************************************************/
@@ -224,17 +230,11 @@ register_properties (NMDeviceBond *device)
 static void
 constructed (GObject *object)
 {
-	NMDeviceBondPrivate *priv;
+	NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
 
 	G_OBJECT_CLASS (nm_device_bond_parent_class)->constructed (object);
 
-	priv = NM_DEVICE_BOND_GET_PRIVATE (object);
-
-	priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
-	                                         NM_DBUS_SERVICE,
-	                                         nm_object_get_path (NM_OBJECT (object)),
-	                                         NM_DBUS_INTERFACE_DEVICE_BOND);
-
+	priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BOND);
 	register_properties (NM_DEVICE_BOND (object));
 }
 
@@ -246,7 +246,7 @@ dispose (GObject *object)
 	g_clear_object (&priv->proxy);
 
 	if (priv->slaves) {
-		g_ptr_array_foreach (priv->slaves, (GFunc) g_object_unref, NULL);
+		g_ptr_array_set_free_func (priv->slaves, g_object_unref);
 		g_ptr_array_free (priv->slaves, TRUE);
 		priv->slaves = NULL;
 	}
@@ -304,6 +304,8 @@ nm_device_bond_class_init (NMDeviceBondClass *eth_class)
 	object_class->finalize = finalize;
 	object_class->get_property = get_property;
 	device_class->connection_compatible = connection_compatible;
+	device_class->get_setting_type = get_setting_type;
+	device_class->get_hw_address = get_hw_address;
 
 	/* properties */