[gnome-control-center] network: Move Security page to the end



commit 18a42a00b8268fbda6f43b28f094567f9b04580d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun May 21 16:12:29 2017 -0300

    network: Move Security page to the end
    
    Per the mockups at [1], the Security page is the last
    visible page.
    
    This patch also adds a small code refactoring to avoid
    multiple string comparisons.
    
    [1] 
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/network/aday2/network-wires.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779841

 .../connection-editor/net-connection-editor.c      |   23 +++++++++++++-------
 1 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index 44fcc67..d08d011 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -505,6 +505,9 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
         GSList *pages, *l;
         NMSettingConnection *sc;
         const gchar *type;
+        gboolean is_wired;
+        gboolean is_wifi;
+        gboolean is_vpn;
 
         editor->is_new_connection = !nm_client_get_connection_by_uuid (editor->client,
                                                                        nm_connection_get_uuid (connection));
@@ -527,19 +530,18 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
         sc = nm_connection_get_setting_connection (connection);
         type = nm_setting_connection_get_connection_type (sc);
 
+        is_wired = g_str_equal (type, NM_SETTING_WIRED_SETTING_NAME);
+        is_wifi = g_str_equal (type, NM_SETTING_WIRELESS_SETTING_NAME);
+        is_vpn = g_str_equal (type, NM_SETTING_VPN_SETTING_NAME);
+
         if (!editor->is_new_connection)
                 add_page (editor, ce_page_details_new (editor->connection, editor->client, editor->device, 
editor->ap, editor));
 
-        if (strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME) == 0)
-                add_page (editor, ce_page_security_new (editor->connection, editor->client));
-        else if (strcmp (type, NM_SETTING_WIRED_SETTING_NAME) == 0)
-                add_page (editor, ce_page_8021x_security_new (editor->connection, editor->client));
-
-        if (strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME) == 0)
+        if (is_wifi)
                 add_page (editor, ce_page_wifi_new (editor->connection, editor->client));
-        else if (strcmp (type, NM_SETTING_WIRED_SETTING_NAME) == 0)
+        else if (is_wired)
                 add_page (editor, ce_page_ethernet_new (editor->connection, editor->client));
-        else if (strcmp (type, NM_SETTING_VPN_SETTING_NAME) == 0)
+        else if (is_vpn)
                 add_page (editor, ce_page_vpn_new (editor->connection, editor->client));
         else {
                 /* Unsupported type */
@@ -550,6 +552,11 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
         add_page (editor, ce_page_ip4_new (editor->connection, editor->client));
         add_page (editor, ce_page_ip6_new (editor->connection, editor->client));
 
+        if (is_wifi)
+                add_page (editor, ce_page_security_new (editor->connection, editor->client));
+        else if (is_wired)
+                add_page (editor, ce_page_8021x_security_new (editor->connection, editor->client));
+
         pages = g_slist_copy (editor->initializing_pages);
         for (l = pages; l; l = l->next) {
                 CEPage *page = l->data;


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