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
This commit is contained in:
Georges Basile Stavracas Neto 2017-05-21 16:12:29 -03:00
parent 3458566f7c
commit 18a42a00b8

View file

@ -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;