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.
This commit is contained in:
Robert Ancell 2019-11-08 16:33:44 +13:00 committed by Georges Basile Stavracas Neto
parent 131e89e690
commit f806854560
4 changed files with 42 additions and 38 deletions

View file

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

View file

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

View file

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

View file

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