about summary refs log tree commit diff
path: root/libnm/nm-device.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
committerMichael Biebl <biebl@debian.org>2015-08-28 01:13:48 +0200
commit81836c2d44802b4cca833d7775dd627e0797a7e2 (patch)
tree91154e6cefc0465306603f51ec0010d9963bbea4 /libnm/nm-device.c
parent50a58f0fabd8a34c1b6108a107e08abe3c1ccd24 (diff)
Imported Upstream version 1.0.6 upstream/1.0.6
Diffstat (limited to 'libnm/nm-device.c')
-rw-r--r--libnm/nm-device.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index cd14c0e9..d3ac705c 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -81,6 +81,7 @@ typedef struct {
 	char *driver_version;
 	char *firmware_version;
 	char *type_description;
+	NMMetered metered;
 	NMDeviceCapabilities capabilities;
 	gboolean managed;
 	gboolean firmware_missing;
@@ -130,6 +131,7 @@ enum {
 	PROP_AVAILABLE_CONNECTIONS,
 	PROP_PHYSICAL_PORT_ID,
 	PROP_MTU,
+	PROP_METERED,
 
 	LAST_PROP
 };
@@ -193,6 +195,7 @@ init_dbus (NMObject *object)
 		{ NM_DEVICE_AVAILABLE_CONNECTIONS, &priv->available_connections, NULL, NM_TYPE_REMOTE_CONNECTION },
 		{ NM_DEVICE_PHYSICAL_PORT_ID,  &priv->physical_port_id },
 		{ NM_DEVICE_MTU,               &priv->mtu },
+		{ NM_DEVICE_METERED,           &priv->metered },
 
 		/* Properties that exist in D-Bus but that we don't track */
 		{ "ip4-address", NULL },
@@ -449,6 +452,9 @@ get_property (GObject *object,
 	case PROP_MTU:
 		g_value_set_uint (value, nm_device_get_mtu (device));
 		break;
+	case PROP_METERED:
+		g_value_set_uint (value, nm_device_get_metered (device));
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -793,6 +799,20 @@ nm_device_class_init (NMDeviceClass *device_class)
 		                    G_PARAM_READABLE |
 		                    G_PARAM_STATIC_STRINGS));
 
+	/**
+	 * NMDevice:metered:
+	 *
+	 * Whether the device is metered.
+	 *
+	 * Since: 1.0.6
+	 **/
+	g_object_class_install_property
+		(object_class, PROP_METERED,
+		 g_param_spec_uint (NM_DEVICE_METERED, "", "",
+		                    0, G_MAXUINT32, NM_METERED_UNKNOWN,
+		                    G_PARAM_READABLE |
+		                    G_PARAM_STATIC_STRINGS));
+
 	/* signals */
 
 	/**
@@ -1884,6 +1904,24 @@ nm_device_get_mtu (NMDevice *device)
 }
 
 /**
+ * nm_device_get_metered:
+ * @device: a #NMDevice
+ *
+ * Gets the metered setting of a #NMDevice.
+ *
+ * Returns: the metered setting.
+ *
+ * Since: 1.0.6
+ **/
+NMMetered
+nm_device_get_metered (NMDevice *device)
+{
+	g_return_val_if_fail (NM_IS_DEVICE (device), NM_METERED_UNKNOWN);
+
+	return NM_DEVICE_GET_PRIVATE (device)->metered;
+}
+
+/**
  * nm_device_is_software:
  * @device: a #NMDevice
  *