[gnome-control-center] network: cleanup: Rework disabled toggle button



commit 408f2775ec7666fe2f7ccff00493f2d5a826fafd
Author: Carlo Caione <carlo endlessm com>
Date:   Fri Jul 20 11:26:05 2018 +0100

    network: cleanup: Rework disabled toggle button
    
    The disable toggle button isn't special and there is no real need for it
    to not be managed as all the other radio buttons.

 panels/network/connection-editor/ce-page-ip4.c | 16 +++++++---------
 panels/network/connection-editor/ce-page-ip6.c | 21 +++++++++------------
 2 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index d403c202d..17d490f05 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -604,16 +604,14 @@ ui_to_setting (CEPageIP4 *self)
         gchar *dns_text = NULL;
         guint i;
 
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio)))
                 method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
-        } else {
-                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio)))
-                        method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
-                else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)))
-                        method = NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL;
-                else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)))
-                        method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
-        }
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio)))
+                method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)))
+                method = NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL;
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)))
+                method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
 
         addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
         if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index a2bdcb542..7775f8c95 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -542,19 +542,16 @@ ui_to_setting (CEPageIP6 *self)
         gchar *dns_text = NULL;
         guint i;
 
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio)))
                 method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
-        } else {
-                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio))) {
-                        method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
-                } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio))) {
-                        method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
-                } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->dhcp_radio))) {
-                        method = NM_SETTING_IP6_CONFIG_METHOD_DHCP;
-                } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio))) {
-                        method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
-                }
-        }
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)))
+                method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)))
+                method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->dhcp_radio)))
+                method = NM_SETTING_IP6_CONFIG_METHOD_DHCP;
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio)))
+                method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
 
         nm_setting_ip_config_clear_addresses (self->setting);
         if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {


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