network: Make function for common code
This commit is contained in:
parent
34cb560009
commit
0189d5001f
1 changed files with 19 additions and 20 deletions
|
@ -360,20 +360,31 @@ wireless_security_clear_ciphers (NMConnection *connection)
|
||||||
nm_setting_wireless_security_clear_groups (s_wireless_sec);
|
nm_setting_wireless_security_clear_groups (s_wireless_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EAPMethod *
|
||||||
|
get_active_method (GtkComboBox *combo)
|
||||||
|
{
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
EAPMethod *eap;
|
||||||
|
|
||||||
|
model = gtk_combo_box_get_model (combo);
|
||||||
|
if (!gtk_combo_box_get_active_iter (combo, &iter))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
|
||||||
|
return eap;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ws_802_1x_add_to_size_group (GtkSizeGroup *size_group,
|
ws_802_1x_add_to_size_group (GtkSizeGroup *size_group,
|
||||||
GtkLabel *label,
|
GtkLabel *label,
|
||||||
GtkComboBox *combo)
|
GtkComboBox *combo)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
g_autoptr(EAPMethod) eap = NULL;
|
g_autoptr(EAPMethod) eap = NULL;
|
||||||
|
|
||||||
gtk_size_group_add_widget (size_group, GTK_WIDGET (label));
|
gtk_size_group_add_widget (size_group, GTK_WIDGET (label));
|
||||||
|
|
||||||
model = gtk_combo_box_get_model (combo);
|
eap = get_active_method (combo);
|
||||||
gtk_combo_box_get_active_iter (combo, &iter);
|
|
||||||
gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
|
|
||||||
g_assert (eap);
|
g_assert (eap);
|
||||||
eap_method_add_to_size_group (eap, size_group);
|
eap_method_add_to_size_group (eap, size_group);
|
||||||
}
|
}
|
||||||
|
@ -381,14 +392,10 @@ ws_802_1x_add_to_size_group (GtkSizeGroup *size_group,
|
||||||
gboolean
|
gboolean
|
||||||
ws_802_1x_validate (GtkComboBox *combo, GError **error)
|
ws_802_1x_validate (GtkComboBox *combo, GError **error)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
g_autoptr(EAPMethod) eap = NULL;
|
g_autoptr(EAPMethod) eap = NULL;
|
||||||
gboolean valid = FALSE;
|
gboolean valid = FALSE;
|
||||||
|
|
||||||
model = gtk_combo_box_get_model (combo);
|
eap = get_active_method (combo);
|
||||||
gtk_combo_box_get_active_iter (combo, &iter);
|
|
||||||
gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
|
|
||||||
g_assert (eap);
|
g_assert (eap);
|
||||||
valid = eap_method_validate (eap, error);
|
valid = eap_method_validate (eap, error);
|
||||||
return valid;
|
return valid;
|
||||||
|
@ -402,8 +409,6 @@ ws_802_1x_auth_combo_changed (GtkWidget *combo,
|
||||||
{
|
{
|
||||||
g_autoptr(EAPMethod) eap = NULL;
|
g_autoptr(EAPMethod) eap = NULL;
|
||||||
GList *elt, *children;
|
GList *elt, *children;
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
GtkWidget *eap_widget;
|
GtkWidget *eap_widget;
|
||||||
GtkWidget *eap_default_widget = NULL;
|
GtkWidget *eap_default_widget = NULL;
|
||||||
|
|
||||||
|
@ -412,9 +417,7 @@ ws_802_1x_auth_combo_changed (GtkWidget *combo,
|
||||||
for (elt = children; elt; elt = g_list_next (elt))
|
for (elt = children; elt; elt = g_list_next (elt))
|
||||||
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));
|
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));
|
||||||
|
|
||||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
eap = get_active_method (GTK_COMBO_BOX (combo));
|
||||||
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
|
|
||||||
gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
|
|
||||||
g_assert (eap);
|
g_assert (eap);
|
||||||
|
|
||||||
eap_widget = eap_method_get_widget (eap);
|
eap_widget = eap_method_get_widget (eap);
|
||||||
|
@ -580,13 +583,9 @@ ws_802_1x_fill_connection (GtkComboBox *combo,
|
||||||
NMSetting8021x *s_8021x;
|
NMSetting8021x *s_8021x;
|
||||||
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
|
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
|
||||||
g_autoptr(EAPMethod) eap = NULL;
|
g_autoptr(EAPMethod) eap = NULL;
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
/* Get the EAPMethod object */
|
/* Get the EAPMethod object */
|
||||||
model = gtk_combo_box_get_model (combo);
|
eap = get_active_method (combo);
|
||||||
gtk_combo_box_get_active_iter (combo, &iter);
|
|
||||||
gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
|
|
||||||
g_assert (eap);
|
g_assert (eap);
|
||||||
|
|
||||||
/* Get previous pasword flags, if any. Otherwise default to agent-owned secrets */
|
/* Get previous pasword flags, if any. Otherwise default to agent-owned secrets */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue