diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2019-11-08 16:33:44 +1300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2019-11-27 22:05:46 +0000 |
commit | f8068545604853ff93f670776e75e69954c3ff1f (patch) | |
tree | a184a4cd040c539b0000546be9ec9e4bd4cdfaf1 | |
parent | 131e89e690526876873527834514575d7fc10d23 (diff) | |
download | gnome-control-center-f8068545604853ff93f670776e75e69954c3ff1f.tar.gz |
network: Remove a helper function
This makes more sense to be in the two cases it is used. It should be refactored away in the future.
-rw-r--r-- | panels/network/wireless-security/wireless-security.c | 28 | ||||
-rw-r--r-- | panels/network/wireless-security/wireless-security.h | 4 | ||||
-rw-r--r-- | panels/network/wireless-security/ws-dynamic-wep.c | 24 | ||||
-rw-r--r-- | panels/network/wireless-security/ws-wpa-eap.c | 24 |
4 files changed, 42 insertions, 38 deletions
diff --git a/panels/network/wireless-security/wireless-security.c b/panels/network/wireless-security/wireless-security.c index 4a388bb07..f4801a096 100644 --- a/panels/network/wireless-security/wireless-security.c +++ b/panels/network/wireless-security/wireless-security.c @@ -261,34 +261,6 @@ ws_802_1x_auth_combo_get_eap (GtkComboBox *combo) } void -ws_802_1x_auth_combo_changed (GtkComboBox *combo, - GtkBox *vbox, - GtkSizeGroup *size_group) -{ - EAPMethod *eap; - GList *elt, *children; - GtkWidget *eap_default_field; - - /* Remove any previous wireless security widgets */ - children = gtk_container_get_children (GTK_CONTAINER (vbox)); - for (elt = children; elt; elt = g_list_next (elt)) - gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data)); - - eap = ws_802_1x_auth_combo_get_eap (GTK_COMBO_BOX (combo)); - g_assert (eap); - - gtk_widget_unparent (GTK_WIDGET (eap)); - if (size_group) - eap_method_add_to_size_group (eap, size_group); - gtk_container_add (GTK_CONTAINER (vbox), g_object_ref (GTK_WIDGET (eap))); - - /* Refocus the EAP method's default widget */ - eap_default_field = eap_method_get_default_field (eap); - if (eap_default_field) - gtk_widget_grab_focus (eap_default_field); -} - -void ws_802_1x_auth_combo_init (WirelessSecurity *self, GtkComboBox *combo, NMConnection *connection, diff --git a/panels/network/wireless-security/wireless-security.h b/panels/network/wireless-security/wireless-security.h index 5ba8a8b54..ffa6b3014 100644 --- a/panels/network/wireless-security/wireless-security.h +++ b/panels/network/wireless-security/wireless-security.h @@ -81,10 +81,6 @@ void ws_802_1x_auth_combo_init (WirelessSecurity *sec, gboolean is_editor, gboolean secrets_only); -void ws_802_1x_auth_combo_changed (GtkComboBox *combo, - GtkBox *vbox, - GtkSizeGroup *size_group); - #include "eap-method.h" EAPMethod *ws_802_1x_auth_combo_get_eap (GtkComboBox *combo); diff --git a/panels/network/wireless-security/ws-dynamic-wep.c b/panels/network/wireless-security/ws-dynamic-wep.c index ae3d1b3fa..1d1e2fc0a 100644 --- a/panels/network/wireless-security/ws-dynamic-wep.c +++ b/panels/network/wireless-security/ws-dynamic-wep.c @@ -103,9 +103,27 @@ adhoc_compatible (WirelessSecurity *security) static void auth_combo_changed_cb (WirelessSecurityDynamicWEP *self) { - ws_802_1x_auth_combo_changed (self->auth_combo, - self->method_box, - self->size_group); + EAPMethod *eap; + GList *elt, *children; + GtkWidget *eap_default_field; + + /* Remove any previous wireless security widgets */ + children = gtk_container_get_children (GTK_CONTAINER (self->method_box)); + for (elt = children; elt; elt = g_list_next (elt)) + gtk_container_remove (GTK_CONTAINER (self->method_box), GTK_WIDGET (elt->data)); + + eap = ws_802_1x_auth_combo_get_eap (self->auth_combo); + g_assert (eap); + + gtk_widget_unparent (GTK_WIDGET (eap)); + if (self->size_group) + eap_method_add_to_size_group (eap, self->size_group); + gtk_container_add (GTK_CONTAINER (self->method_box), g_object_ref (GTK_WIDGET (eap))); + + /* Refocus the EAP method's default widget */ + eap_default_field = eap_method_get_default_field (eap); + if (eap_default_field) + gtk_widget_grab_focus (eap_default_field); wireless_security_notify_changed (WIRELESS_SECURITY (self)); } diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c index 868235393..f8fa7ff0d 100644 --- a/panels/network/wireless-security/ws-wpa-eap.c +++ b/panels/network/wireless-security/ws-wpa-eap.c @@ -103,9 +103,27 @@ adhoc_compatible (WirelessSecurity *security) static void auth_combo_changed_cb (WirelessSecurityWPAEAP *self) { - ws_802_1x_auth_combo_changed (self->auth_combo, - self->method_box, - self->size_group); + EAPMethod *eap; + GList *elt, *children; + GtkWidget *eap_default_field; + + /* Remove any previous wireless security widgets */ + children = gtk_container_get_children (GTK_CONTAINER (self->method_box)); + for (elt = children; elt; elt = g_list_next (elt)) + gtk_container_remove (GTK_CONTAINER (self->method_box), GTK_WIDGET (elt->data)); + + eap = ws_802_1x_auth_combo_get_eap (self->auth_combo); + g_assert (eap); + + gtk_widget_unparent (GTK_WIDGET (eap)); + if (self->size_group) + eap_method_add_to_size_group (eap, self->size_group); + gtk_container_add (GTK_CONTAINER (self->method_box), g_object_ref (GTK_WIDGET (eap))); + + /* Refocus the EAP method's default widget */ + eap_default_field = eap_method_get_default_field (eap); + if (eap_default_field) + gtk_widget_grab_focus (eap_default_field); wireless_security_notify_changed (WIRELESS_SECURITY (self)); } |