network: Simplify helper function

This commit is contained in:
Robert Ancell 2019-11-08 09:56:00 +13:00 committed by Georges Basile Stavracas Neto
parent 0189d5001f
commit f2111a85f5
4 changed files with 24 additions and 31 deletions

View file

@ -402,7 +402,7 @@ ws_802_1x_validate (GtkComboBox *combo, GError **error)
}
void
ws_802_1x_auth_combo_changed (GtkWidget *combo,
ws_802_1x_auth_combo_changed (GtkComboBox *combo,
WirelessSecurity *self,
GtkBox *vbox,
GtkSizeGroup *size_group)
@ -441,8 +441,6 @@ ws_802_1x_auth_combo_changed (GtkWidget *combo,
void
ws_802_1x_auth_combo_init (WirelessSecurity *self,
GtkComboBox *combo,
GtkLabel *label,
GCallback auth_combo_changed_cb,
NMConnection *connection,
gboolean is_editor,
gboolean secrets_only)
@ -566,13 +564,6 @@ ws_802_1x_auth_combo_init (WirelessSecurity *self,
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (auth_model));
gtk_combo_box_set_active (combo, active < 0 ? 0 : (guint32) active);
g_signal_connect (G_OBJECT (combo), "changed", auth_combo_changed_cb, self);
if (secrets_only) {
gtk_widget_hide (GTK_WIDGET (combo));
gtk_widget_hide (GTK_WIDGET (label));
}
}
void

View file

@ -111,13 +111,11 @@ void wireless_security_clear_ciphers (NMConnection *connection);
void ws_802_1x_auth_combo_init (WirelessSecurity *sec,
GtkComboBox *combo,
GtkLabel *label,
GCallback auth_combo_changed_cb,
NMConnection *connection,
gboolean is_editor,
gboolean secrets_only);
void ws_802_1x_auth_combo_changed (GtkWidget *combo,
void ws_802_1x_auth_combo_changed (GtkComboBox *combo,
WirelessSecurity *sec,
GtkBox *vbox,
GtkSizeGroup *size_group);

View file

@ -88,13 +88,10 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
}
static void
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
auth_combo_changed_cb (WirelessSecurityDynamicWEP *self)
{
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
ws_802_1x_auth_combo_changed (combo,
parent,
ws_802_1x_auth_combo_changed (self->auth_combo,
WIRELESS_SECURITY (self),
self->method_box,
self->size_group);
}
@ -128,12 +125,17 @@ ws_dynamic_wep_new (NMConnection *connection,
ws_802_1x_auth_combo_init (parent,
self->auth_combo,
self->auth_label,
(GCallback) auth_combo_changed_cb,
connection,
is_editor,
secrets_only);
auth_combo_changed_cb (GTK_WIDGET (self->auth_combo), (gpointer) parent);
if (secrets_only) {
gtk_widget_hide (GTK_WIDGET (self->auth_combo));
gtk_widget_hide (GTK_WIDGET (self->auth_label));
}
g_signal_connect_object (G_OBJECT (self->auth_combo), "changed", G_CALLBACK (auth_combo_changed_cb), self, G_CONNECT_SWAPPED);
auth_combo_changed_cb (self);
return self;
}

View file

@ -89,13 +89,10 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
}
static void
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
auth_combo_changed_cb (WirelessSecurityWPAEAP *self)
{
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
ws_802_1x_auth_combo_changed (combo,
parent,
ws_802_1x_auth_combo_changed (self->auth_combo,
WIRELESS_SECURITY (self),
self->method_box,
self->size_group);
}
@ -129,12 +126,17 @@ ws_wpa_eap_new (NMConnection *connection,
ws_802_1x_auth_combo_init (parent,
self->auth_combo,
self->auth_label,
(GCallback) auth_combo_changed_cb,
connection,
is_editor,
secrets_only);
auth_combo_changed_cb (GTK_WIDGET (self->auth_combo), parent);
if (secrets_only) {
gtk_widget_hide (GTK_WIDGET (self->auth_combo));
gtk_widget_hide (GTK_WIDGET (self->auth_label));
}
g_signal_connect_object (G_OBJECT (self->auth_combo), "changed", G_CALLBACK (auth_combo_changed_cb), self, G_CONNECT_SWAPPED);
auth_combo_changed_cb (self);
return self;
}