diff options
author | Ryan Lortie <desrt@desrt.ca> | 2014-11-22 15:25:46 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2014-11-24 15:10:48 -0500 |
commit | 74d110a9326da1644788f16a4a6e3ed1631592e8 (patch) | |
tree | 00641b2fa7265c61b8ad1bc652d0c2e8091a05af | |
parent | 2014927869cb92be2c9e360f1a6a4b118b866403 (diff) | |
download | network-manager-applet-74d110a9326da1644788f16a4a6e3ed1631592e8.tar.gz |
libnm-gtk: use Bluetooth name for disambiguation
Currently if we have two paired bluetooth devices,
nma_utils_disambiguate_device_names() will disambiguate them by their
hardware address. This is not very helpful, so detect this case and use
the Bluetooth device name instead.
This function is used by System Settings when showing the list of
network devices.
https://bugzilla.gnome.org/show_bug.cgi?id=740553
-rw-r--r-- | src/libnm-gtk/nm-ui-utils.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c index 69ede41e..170afd9a 100644 --- a/src/libnm-gtk/nm-ui-utils.c +++ b/src/libnm-gtk/nm-ui-utils.c @@ -28,6 +28,7 @@ #include <gudev/gudev.h> #include <nm-device.h> +#include <nm-device-bt.h> #include "nm-ui-utils.h" @@ -512,6 +513,25 @@ nma_utils_disambiguate_device_names (NMDevice **devices, if (!find_duplicates (names, duplicates, num_devices)) goto done; + /* If dealing with Bluetooth devices, try to distinguish them by + * device name. + */ + for (i = 0; i < num_devices; i++) { + if (duplicates[i] && NM_IS_DEVICE_BT (devices[i])) { + const char *devname = nm_device_bt_get_name (NM_DEVICE_BT (devices[i])); + + if (!devname) + continue; + + g_free (names[i]); + names[i] = g_strdup_printf ("%s (%s)", + nma_utils_get_device_type_name (devices[i]), + devname); + } + } + if (!find_duplicates (names, duplicates, num_devices)) + goto done; + /* We have multiple identical network cards, so we have to differentiate * them by interface name. */ |