[libnma: 4/7] cert-chooser: some style fixes and minor cleanups
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnma: 4/7] cert-chooser: some style fixes and minor cleanups
- Date: Thu, 13 Feb 2020 16:51:24 +0000 (UTC)
commit 7994eca92399ace82824bab237d9eecf101cbe11
Author: Thomas Haller <thaller redhat com>
Date: Thu Feb 13 15:53:19 2020 +0100
cert-chooser: some style fixes and minor cleanups
src/nma-cert-chooser.c | 5 ++++-
src/nma-file-cert-chooser.c | 32 +++++++++++++++-----------------
2 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/src/nma-cert-chooser.c b/src/nma-cert-chooser.c
index bd8fd71e..2777767d 100644
--- a/src/nma-cert-chooser.c
+++ b/src/nma-cert-chooser.c
@@ -150,6 +150,7 @@ nma_cert_chooser_set_cert (NMACertChooser *cert_chooser,
nma_cert_chooser_clear_cert (cert_chooser);
return;
}
+
uri = value_with_scheme_to_uri (value, scheme);
nma_cert_chooser_set_cert_uri (cert_chooser, uri);
}
@@ -255,6 +256,7 @@ nma_cert_chooser_clear_cert (NMACertChooser *cert_chooser)
const NMACertChooserVtable *vtable;
g_return_if_fail (NMA_IS_CERT_CHOOSER (cert_chooser));
+
vtable = NMA_CERT_CHOOSER_GET_VTABLE (cert_chooser);
if (vtable->clear_cert)
vtable->clear_cert (cert_chooser);
@@ -327,7 +329,8 @@ nma_cert_chooser_set_key (NMACertChooser *cert_chooser,
if (!value) {
nma_cert_chooser_clear_key (cert_chooser);
return;
- }
+ }
+
uri = value_with_scheme_to_uri (value, scheme);
nma_cert_chooser_set_key_uri (cert_chooser, uri);
}
diff --git a/src/nma-file-cert-chooser.c b/src/nma-file-cert-chooser.c
index 89c1792d..40c0599f 100644
--- a/src/nma-file-cert-chooser.c
+++ b/src/nma-file-cert-chooser.c
@@ -213,31 +213,31 @@ static void
cert_changed_cb (GtkFileChooserButton *file_chooser_button, gpointer user_data)
{
NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (NMA_CERT_CHOOSER (user_data));
- gboolean sensitive = FALSE;
- gboolean is_pkcs12 = FALSE;
- gs_free char *cert = NULL;
- gs_free char *key = NULL;
if (gtk_widget_get_visible (priv->key_button)) {
+ gboolean sensitive = FALSE;
+ gs_free char *cert = NULL;
+
cert = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->cert_button));
if (cert && *cert) {
- is_pkcs12 = nm_utils_file_is_pkcs12 (cert);
- if (is_pkcs12) {
+ if (nm_utils_file_is_pkcs12 (cert)) {
+ gs_free char *key = NULL;
+
key = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->key_button));
- if (!key || !nm_streq0(cert, key)) {
+ if (!nm_streq0 (cert, key))
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->key_button),
cert);
- }
}
else {
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (priv->key_button));
sensitive = TRUE;
}
- } else {
+ } else
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (priv->key_button));
- }
+
gtk_widget_set_sensitive (priv->key_button, sensitive);
gtk_widget_set_sensitive (priv->key_button_label, sensitive);
}
+
g_signal_emit_by_name (user_data, "changed");
}
@@ -246,18 +246,16 @@ key_changed_cb (GtkFileChooserButton *file_chooser_button, gpointer user_data)
{
NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (NMA_CERT_CHOOSER (user_data));
gboolean sensitive = FALSE;
- gboolean is_pkcs12 = FALSE;
gs_free char *key = NULL;
- gs_free char *cert = NULL;
key = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->key_button));
if (key && *key) {
- is_pkcs12 = nm_utils_file_is_pkcs12 (key);
- if (is_pkcs12) {
+ if (nm_utils_file_is_pkcs12 (key)) {
+ gs_free char *cert = NULL;
+
cert = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->cert_button));
- if (!cert || !nm_streq0(cert, key)) {
+ if (!nm_streq0 (cert, key))
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->cert_button), key);
- }
gtk_widget_set_sensitive (priv->key_button, FALSE);
gtk_widget_set_sensitive (priv->key_button_label, FALSE);
}
@@ -266,7 +264,7 @@ key_changed_cb (GtkFileChooserButton *file_chooser_button, gpointer user_data)
gtk_entry_set_text (GTK_ENTRY (priv->key_password), "");
gtk_widget_set_sensitive (priv->key_password, sensitive);
gtk_widget_set_sensitive (priv->key_password_label, sensitive);
- widget_unset_error(priv->key_password);
+ widget_unset_error (priv->key_password);
g_signal_emit_by_name (user_data, "changed");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]