summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2019-11-12 12:00:25 +1300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-11-27 22:05:46 +0000
commitacc8aff5d0b6ccd65afca21db8565051ad3f393e (patch)
treecd9697a3f2c663635f30eb92be1367f596398082
parent63c3f3e0a4cde4bfa7a67da813cf84cdc506bedc (diff)
downloadgnome-control-center-acc8aff5d0b6ccd65afca21db8565051ad3f393e.tar.gz
network: Remove certificate helper function
It didn't really save any code.
-rw-r--r--panels/network/wireless-security/eap-method-peap.c13
-rw-r--r--panels/network/wireless-security/eap-method-tls.c10
-rw-r--r--panels/network/wireless-security/eap-method-ttls.c12
-rw-r--r--panels/network/wireless-security/eap-method.c21
-rw-r--r--panels/network/wireless-security/eap-method.h2
5 files changed, 23 insertions, 35 deletions
diff --git a/panels/network/wireless-security/eap-method-peap.c b/panels/network/wireless-security/eap-method-peap.c
index 22ad04c3b..5487a5e51 100644
--- a/panels/network/wireless-security/eap-method-peap.c
+++ b/panels/network/wireless-security/eap-method-peap.c
@@ -90,10 +90,15 @@ validate (EAPMethod *method, GError **error)
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-PEAP CA certificate: %s"), local_error->message);
return FALSE;
}
- if (eap_method_ca_cert_required (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
- GTK_FILE_CHOOSER (self->ca_cert_button))) {
- g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-PEAP CA certificate: no certificate specified"));
- return FALSE;
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) {
+ g_autofree gchar *filename = NULL;
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
+ if (filename == NULL) {
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-PEAP CA certificate: no certificate specified"));
+ return FALSE;
+ }
}
return eap_method_validate (get_inner_method (self), error);
diff --git a/panels/network/wireless-security/eap-method-tls.c b/panels/network/wireless-security/eap-method-tls.c
index 3e55b64cb..fadd6e066 100644
--- a/panels/network/wireless-security/eap-method-tls.c
+++ b/panels/network/wireless-security/eap-method-tls.c
@@ -91,10 +91,12 @@ validate (EAPMethod *method, GError **error)
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TLS CA certificate: %s"), ca_cert_error->message);
ret = FALSE;
}
- } else if (eap_method_ca_cert_required (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
- GTK_FILE_CHOOSER (self->ca_cert_button))) {
- widget_set_error (GTK_WIDGET (self->ca_cert_button));
- if (ret) {
+ } else if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) {
+ g_autofree gchar *filename = NULL;
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
+ if (filename == NULL) {
+ widget_set_error (GTK_WIDGET (self->ca_cert_button));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TLS CA certificate: no certificate specified"));
ret = FALSE;
}
diff --git a/panels/network/wireless-security/eap-method-ttls.c b/panels/network/wireless-security/eap-method-ttls.c
index ae6aa0629..198b08a18 100644
--- a/panels/network/wireless-security/eap-method-ttls.c
+++ b/panels/network/wireless-security/eap-method-ttls.c
@@ -101,10 +101,14 @@ validate (EAPMethod *method, GError **error)
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: %s"), local_error->message);
return FALSE;
}
- if (eap_method_ca_cert_required (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
- GTK_FILE_CHOOSER (self->ca_cert_button))) {
- g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: no certificate specified"));
- return FALSE;
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check))) {
+ g_autofree gchar *filename = NULL;
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
+ if (filename == NULL) {
+ g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: no certificate specified"));
+ return FALSE;
+ }
}
return eap_method_validate (get_inner_method (self), error);
diff --git a/panels/network/wireless-security/eap-method.c b/panels/network/wireless-security/eap-method.c
index f0bb8a138..c392da8f5 100644
--- a/panels/network/wireless-security/eap-method.c
+++ b/panels/network/wireless-security/eap-method.c
@@ -382,27 +382,6 @@ eap_method_is_encrypted_private_key (const char *path)
return is_encrypted;
}
-/* Some methods (PEAP, TLS, TTLS) require a CA certificate. The user can choose
- * not to provide such a certificate. This method whether the checkbox
- * id_ca_cert_not_required_checkbutton is checked or id_ca_cert_chooser has a certificate
- * selected.
- */
-gboolean
-eap_method_ca_cert_required (GtkToggleButton *id_ca_cert_not_required_checkbutton, GtkFileChooser *id_ca_cert_chooser)
-{
- g_assert (id_ca_cert_not_required_checkbutton && id_ca_cert_chooser);
-
- if (!gtk_toggle_button_get_active (id_ca_cert_not_required_checkbutton)) {
- g_autofree gchar *filename = NULL;
-
- filename = gtk_file_chooser_get_filename (id_ca_cert_chooser);
- if (!filename)
- return TRUE;
- }
- return FALSE;
-}
-
-
void
eap_method_ca_cert_not_required_toggled (GtkToggleButton *id_ca_cert_not_required_checkbutton, GtkFileChooser *id_ca_cert_chooser)
{
diff --git a/panels/network/wireless-security/eap-method.h b/panels/network/wireless-security/eap-method.h
index 42c392f02..f51f309c9 100644
--- a/panels/network/wireless-security/eap-method.h
+++ b/panels/network/wireless-security/eap-method.h
@@ -75,8 +75,6 @@ gboolean eap_method_validate_filepicker (GtkFileChooser *chooser,
NMSetting8021xCKFormat *out_format,
GError **error);
-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,
GtkFileChooser *id_ca_cert_chooser);