[network-manager-applet/nma-0-9-10] libnm-gtk: use Bluetooth name for disambiguation
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nma-0-9-10] libnm-gtk: use Bluetooth name for disambiguation
- Date: Mon, 8 Dec 2014 18:57:37 +0000 (UTC)
commit 3d3d5e854b0cd1158e3f422a39ae96de773db137
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Nov 22 15:25:46 2014 -0500
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)
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 a031ec4..f9b4d4f 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.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]