about summary refs log tree commit diff
path: root/libnm/nm-device.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-08-03 23:00:16 +0200
committerMichael Biebl <biebl@debian.org>2016-08-03 23:00:16 +0200
commit511e94811644318cc196e197616fdc558030e8e3 (patch)
tree1ea5c895be190982cc686d43ebed62ae33d60426 /libnm/nm-device.c
parentfb15332b981b5637ae4aeadc546e2f46bf333cd1 (diff)
parentd6201f5d8daada3d64a0a3e0038e14eebec683ce (diff)
Merge tag 'upstream/1.2.4'
Upstream version 1.2.4
Diffstat (limited to 'libnm/nm-device.c')
-rw-r--r--libnm/nm-device.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 496dd87a..b3dc01b2 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -1722,6 +1722,7 @@ get_description (NMDevice *device)
 	char *pdown;
 	char *vdown;
 	GString *str;
+	GParamSpec *name_prop;
 
 	dev_product = nm_device_get_product (device);
 	priv->short_product = fixup_desc_string (dev_product);
@@ -1729,6 +1730,15 @@ get_description (NMDevice *device)
 	dev_vendor = nm_device_get_vendor (device);
 	priv->short_vendor = fixup_desc_string (dev_vendor);
 
+	/* Grab device's preferred name, if any */
+	name_prop = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (device)), "name");
+	if (name_prop) {
+		g_object_get (device, "name", &priv->description, NULL);
+		if (priv->description && priv->description[0])
+			return;
+		g_clear_pointer (&priv->description, g_free);
+	}
+
 	if (!dev_product || !dev_vendor) {
 		priv->description = g_strdup (nm_device_get_iface (device));
 		return;