diff options
| author | Michael Biebl <biebl@debian.org> | 2016-08-03 22:59:23 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-08-03 22:59:23 +0200 |
| commit | d6201f5d8daada3d64a0a3e0038e14eebec683ce (patch) | |
| tree | 035500728cc23e7ee5368c3fd605270265a077f7 /libnm-glib/nm-device.c | |
| parent | 73e152af6e3fb4f5848bfb8394484026ff119003 (diff) | |
Imported Upstream version 1.2.4 upstream/1.2.4
Diffstat (limited to 'libnm-glib/nm-device.c')
| -rw-r--r-- | libnm-glib/nm-device.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 3392d230..48ad8897 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -1769,6 +1769,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); @@ -1776,6 +1777,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; |