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.
This commit is contained in:
Carlo Caione 2018-07-20 11:26:05 +01:00 committed by Robert Ancell
parent 5bcbe07299
commit 408f2775ec
2 changed files with 16 additions and 21 deletions

View file

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

View file

@ -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)) {