[network-manager-applet] libnm-gtk: use Bluetooth name for disambiguation
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] libnm-gtk: use Bluetooth name for disambiguation
- Date: Mon, 24 Nov 2014 20:11:05 +0000 (UTC)
commit 74d110a9326da1644788f16a4a6e3ed1631592e8
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
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 69ede41..170afd9 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]