network: Simplify helper function
This commit is contained in:
parent
0189d5001f
commit
f2111a85f5
4 changed files with 24 additions and 31 deletions
|
@ -402,7 +402,7 @@ ws_802_1x_validate (GtkComboBox *combo, GError **error)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ws_802_1x_auth_combo_changed (GtkWidget *combo,
|
ws_802_1x_auth_combo_changed (GtkComboBox *combo,
|
||||||
WirelessSecurity *self,
|
WirelessSecurity *self,
|
||||||
GtkBox *vbox,
|
GtkBox *vbox,
|
||||||
GtkSizeGroup *size_group)
|
GtkSizeGroup *size_group)
|
||||||
|
@ -441,8 +441,6 @@ ws_802_1x_auth_combo_changed (GtkWidget *combo,
|
||||||
void
|
void
|
||||||
ws_802_1x_auth_combo_init (WirelessSecurity *self,
|
ws_802_1x_auth_combo_init (WirelessSecurity *self,
|
||||||
GtkComboBox *combo,
|
GtkComboBox *combo,
|
||||||
GtkLabel *label,
|
|
||||||
GCallback auth_combo_changed_cb,
|
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
gboolean is_editor,
|
gboolean is_editor,
|
||||||
gboolean secrets_only)
|
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_model (combo, GTK_TREE_MODEL (auth_model));
|
||||||
gtk_combo_box_set_active (combo, active < 0 ? 0 : (guint32) active);
|
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
|
void
|
||||||
|
|
|
@ -111,13 +111,11 @@ void wireless_security_clear_ciphers (NMConnection *connection);
|
||||||
|
|
||||||
void ws_802_1x_auth_combo_init (WirelessSecurity *sec,
|
void ws_802_1x_auth_combo_init (WirelessSecurity *sec,
|
||||||
GtkComboBox *combo,
|
GtkComboBox *combo,
|
||||||
GtkLabel *label,
|
|
||||||
GCallback auth_combo_changed_cb,
|
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
gboolean is_editor,
|
gboolean is_editor,
|
||||||
gboolean secrets_only);
|
gboolean secrets_only);
|
||||||
|
|
||||||
void ws_802_1x_auth_combo_changed (GtkWidget *combo,
|
void ws_802_1x_auth_combo_changed (GtkComboBox *combo,
|
||||||
WirelessSecurity *sec,
|
WirelessSecurity *sec,
|
||||||
GtkBox *vbox,
|
GtkBox *vbox,
|
||||||
GtkSizeGroup *size_group);
|
GtkSizeGroup *size_group);
|
||||||
|
|
|
@ -88,13 +88,10 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
|
auth_combo_changed_cb (WirelessSecurityDynamicWEP *self)
|
||||||
{
|
{
|
||||||
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
|
ws_802_1x_auth_combo_changed (self->auth_combo,
|
||||||
WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
|
WIRELESS_SECURITY (self),
|
||||||
|
|
||||||
ws_802_1x_auth_combo_changed (combo,
|
|
||||||
parent,
|
|
||||||
self->method_box,
|
self->method_box,
|
||||||
self->size_group);
|
self->size_group);
|
||||||
}
|
}
|
||||||
|
@ -128,12 +125,17 @@ ws_dynamic_wep_new (NMConnection *connection,
|
||||||
|
|
||||||
ws_802_1x_auth_combo_init (parent,
|
ws_802_1x_auth_combo_init (parent,
|
||||||
self->auth_combo,
|
self->auth_combo,
|
||||||
self->auth_label,
|
|
||||||
(GCallback) auth_combo_changed_cb,
|
|
||||||
connection,
|
connection,
|
||||||
is_editor,
|
is_editor,
|
||||||
secrets_only);
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,13 +89,10 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
|
auth_combo_changed_cb (WirelessSecurityWPAEAP *self)
|
||||||
{
|
{
|
||||||
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
|
ws_802_1x_auth_combo_changed (self->auth_combo,
|
||||||
WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
|
WIRELESS_SECURITY (self),
|
||||||
|
|
||||||
ws_802_1x_auth_combo_changed (combo,
|
|
||||||
parent,
|
|
||||||
self->method_box,
|
self->method_box,
|
||||||
self->size_group);
|
self->size_group);
|
||||||
}
|
}
|
||||||
|
@ -129,12 +126,17 @@ ws_wpa_eap_new (NMConnection *connection,
|
||||||
|
|
||||||
ws_802_1x_auth_combo_init (parent,
|
ws_802_1x_auth_combo_init (parent,
|
||||||
self->auth_combo,
|
self->auth_combo,
|
||||||
self->auth_label,
|
|
||||||
(GCallback) auth_combo_changed_cb,
|
|
||||||
connection,
|
connection,
|
||||||
is_editor,
|
is_editor,
|
||||||
secrets_only);
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue