libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)

Abuse the 'name' property for this, for now, so we don't have to grab
a free slot from NMDeviceClass.

https://bugzilla.gnome.org/show_bug.cgi?id=592819
This commit is contained in:
Dan Williams 2016-06-15 16:40:49 -05:00
parent 68d48fa507
commit fdf5b6941a
2 changed files with 20 additions and 0 deletions

View file

@ -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;

View file

@ -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;