[network-manager-applet: 2/3] editor: hide device MAC from combo when NULL



commit de10ae4a42e5bfdd01cdd0eaac7cef43b5840723
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Tue Jan 3 23:18:28 2017 +0100

    editor: hide device MAC from combo when NULL
    
    Hide the device MAC address from the device combo when the device
    doesn't have a permanent MAC.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380424

 src/connection-editor/ce-page.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 2e9e130..68c0e04 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -370,14 +370,18 @@ _get_device_list (CEPage *self,
                if (mac_property)
                        g_object_get (G_OBJECT (dev), mac_property, &mac, NULL);
 
+               if (mac && !mac[0])
+                       nm_clear_g_free (&mac);
+
                if (set_ifname && mac_property)
-                       item = g_strdup_printf ("%s (%s)", ifname, mac);
+                       item = g_strdup_printf ("%s%s%s%s", ifname, NM_PRINT_FMT_QUOTED (mac, " (", mac, ")", 
""));
                else
                        item = g_strdup (set_ifname ? ifname : mac);
 
-               g_ptr_array_add (interfaces, item);
-               if (mac_property)
-                       g_free (mac);
+               if (item)
+                       g_ptr_array_add (interfaces, item);
+
+               g_free (mac);
        }
        g_ptr_array_add (interfaces, NULL);
 


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