summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-11-22 15:25:46 -0500
committerDan Williams <dcbw@redhat.com>2014-12-08 12:45:51 -0600
commit3d3d5e854b0cd1158e3f422a39ae96de773db137 (patch)
treee1d7ea4f2d22fb6511c70b49dc7a63a27249f022
parent70c966f41a52e24419ff6d3d8dda3846a1030f84 (diff)
downloadnetwork-manager-applet-3d3d5e854b0cd1158e3f422a39ae96de773db137.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 (cherry picked from commit 74d110a9326da1644788f16a4a6e3ed1631592e8)
-rw-r--r--src/libnm-gtk/nm-ui-utils.c20
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 a031ec47..f9b4d4fd 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.
*/