network: Simplify helper function
The function took internal details of the few classes that were using it.
This commit is contained in:
parent
748a508640
commit
20097e2cbe
5 changed files with 50 additions and 43 deletions
|
@ -270,10 +270,19 @@ static void
|
|||
update_secrets (EAPMethod *parent, NMConnection *connection)
|
||||
{
|
||||
EAPMethodFAST *self = (EAPMethodFAST *) parent;
|
||||
eap_method_phase2_update_secrets_helper (parent,
|
||||
connection,
|
||||
self->inner_auth_combo,
|
||||
I_METHOD_COLUMN);
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
model = gtk_combo_box_get_model (self->inner_auth_combo);
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||
return;
|
||||
|
||||
do {
|
||||
g_autoptr(EAPMethod) eap = NULL;
|
||||
|
||||
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
||||
eap_method_update_secrets (eap, connection);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
|
|
@ -290,10 +290,19 @@ static void
|
|||
update_secrets (EAPMethod *method, NMConnection *connection)
|
||||
{
|
||||
EAPMethodPEAP *self = EAP_METHOD_PEAP (method);
|
||||
eap_method_phase2_update_secrets_helper (method,
|
||||
connection,
|
||||
self->inner_auth_combo,
|
||||
I_METHOD_COLUMN);
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
model = gtk_combo_box_get_model (self->inner_auth_combo);
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||
return;
|
||||
|
||||
do {
|
||||
g_autoptr(EAPMethod) eap = NULL;
|
||||
|
||||
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
||||
eap_method_update_secrets (eap, connection);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
|
|
@ -343,10 +343,19 @@ static void
|
|||
update_secrets (EAPMethod *method, NMConnection *connection)
|
||||
{
|
||||
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
||||
eap_method_phase2_update_secrets_helper (method,
|
||||
connection,
|
||||
self->inner_auth_combo,
|
||||
I_METHOD_COLUMN);
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
model = gtk_combo_box_get_model (self->inner_auth_combo);
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||
return;
|
||||
|
||||
do {
|
||||
g_autoptr(EAPMethod) eap = NULL;
|
||||
|
||||
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
||||
eap_method_update_secrets (eap, connection);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
|
|
@ -83,6 +83,15 @@ eap_method_validate (EAPMethod *self, GError **error)
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
eap_method_update_secrets (EAPMethod *self, NMConnection *connection)
|
||||
{
|
||||
g_return_if_fail (self != NULL);
|
||||
|
||||
if (EAP_METHOD_GET_IFACE (self)->update_secrets)
|
||||
EAP_METHOD_GET_IFACE (self)->update_secrets (self, connection);
|
||||
}
|
||||
|
||||
void
|
||||
eap_method_add_to_size_group (EAPMethod *self, GtkSizeGroup *group)
|
||||
{
|
||||
|
@ -103,32 +112,6 @@ eap_method_fill_connection (EAPMethod *self,
|
|||
return (*(EAP_METHOD_GET_IFACE (self)->fill_connection)) (self, connection, flags);
|
||||
}
|
||||
|
||||
void
|
||||
eap_method_phase2_update_secrets_helper (EAPMethod *self,
|
||||
NMConnection *connection,
|
||||
GtkComboBox *combo,
|
||||
guint32 column)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (connection != NULL);
|
||||
g_return_if_fail (combo != NULL);
|
||||
|
||||
/* Let each EAP phase2 method try to update its secrets */
|
||||
model = gtk_combo_box_get_model (combo);
|
||||
if (gtk_tree_model_get_iter_first (model, &iter)) {
|
||||
do {
|
||||
g_autoptr(EAPMethod) eap = NULL;
|
||||
|
||||
gtk_tree_model_get (model, &iter, column, &eap, -1);
|
||||
if (eap && EAP_METHOD_GET_IFACE (eap)->update_secrets)
|
||||
EAP_METHOD_GET_IFACE (eap)->update_secrets (self, connection);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
eap_method_validate_filepicker (GtkFileChooser *chooser,
|
||||
guint32 item_type,
|
||||
|
|
|
@ -47,6 +47,8 @@ const gchar *eap_method_get_password_flags_name (EAPMethod *method);
|
|||
|
||||
gboolean eap_method_get_phase2 (EAPMethod *method);
|
||||
|
||||
void eap_method_update_secrets (EAPMethod *method, NMConnection *connection);
|
||||
|
||||
gboolean eap_method_validate (EAPMethod *method, GError **error);
|
||||
|
||||
void eap_method_add_to_size_group (EAPMethod *method, GtkSizeGroup *group);
|
||||
|
@ -71,11 +73,6 @@ gboolean eap_method_validate_filepicker (GtkFileChooser *chooser,
|
|||
NMSetting8021xCKFormat *out_format,
|
||||
GError **error);
|
||||
|
||||
void eap_method_phase2_update_secrets_helper (EAPMethod *method,
|
||||
NMConnection *connection,
|
||||
GtkComboBox *combo,
|
||||
guint32 column);
|
||||
|
||||
gboolean eap_method_ca_cert_required (GtkToggleButton *id_ca_cert_is_not_required_checkbutton,
|
||||
GtkFileChooser *id_ca_cert_chooser);
|
||||
void eap_method_ca_cert_not_required_toggled (GtkToggleButton *id_ca_cert_is_not_required_checkbox,
|
||||
|
|
Loading…
Add table
Reference in a new issue