[gnome-control-center] network: Remove a helper function



commit f8068545604853ff93f670776e75e69954c3ff1f
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Nov 8 16:33:44 2019 +1300

    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.

 .../network/wireless-security/wireless-security.c  | 28 ----------------------
 .../network/wireless-security/wireless-security.h  |  4 ----
 panels/network/wireless-security/ws-dynamic-wep.c  | 24 ++++++++++++++++---
 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
@@ -260,34 +260,6 @@ ws_802_1x_auth_combo_get_eap (GtkComboBox *combo)
        return eap;
 }
 
-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,
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));
 }


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