[gnome-control-center/benzea/ignore-more-network-devices: 7/7] network: Don't shorten names of bluetooth connections



commit 8e175bb5620335be1dac442c128b8d69d6f9651b
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Mar 21 14:24:04 2019 +0100

    network: Don't shorten names of bluetooth connections
    
    This prevents a single bluetooth connection to be shortened to the name
    "Bluetooth", which means we end up with one "Bluetooth" device in the
    "Bluetooth" section. Rather, always use the long name of the bluetooth
    device so that the user knows what they are connecting to.

 panels/network/cc-network-panel.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 2d8676f3e..d5b80476a 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -301,7 +301,16 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
 
         titles = nm_device_disambiguate_names (nm_devices, num_devices);
         for (i = 0; i < num_devices; i++) {
-                net_object_set_title (NET_OBJECT (devices[i]), titles[i]);
+                const gchar *bt_name = NULL;
+
+                if (NM_IS_DEVICE_BT (nm_devices[i]))
+                        bt_name = nm_device_bt_get_name (NM_DEVICE_BT (nm_devices[i]));
+
+                /* For bluetooth devices, use their device name. */
+                if (bt_name)
+                        net_object_set_title (NET_OBJECT (devices[i]), bt_name);
+                else
+                        net_object_set_title (NET_OBJECT (devices[i]), titles[i]);
                 g_free (titles[i]);
         }
         g_free (titles);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]