[network-manager-applet/th/lr/pkcs11: 2/2] fixup! cert-chooser: refactor to delegate file/pkcs11 operations from NMACertChooser



commit 3fa60c69b8ca522e015dce001e1876453ef03d4a
Author: Thomas Haller <thaller redhat com>
Date:   Thu Mar 16 11:27:40 2017 +0100

    fixup! cert-chooser: refactor to delegate file/pkcs11 operations from NMACertChooser

 src/libnm-gtk/libnm-gtk.ver           |    2 ++
 src/libnma/libnma.ver                 |    2 ++
 src/libnma/nma-cert-chooser-private.h |    7 -------
 src/libnma/nma-cert-chooser.c         |   32 ++++++++++++++++++++++++++++++++
 src/libnma/nma-cert-chooser.h         |    6 ++++++
 src/libnma/nma-file-cert-chooser.c    |    6 +++---
 src/libnma/nma-pkcs11-cert-chooser.c  |    5 +++--
 7 files changed, 48 insertions(+), 12 deletions(-)
---
diff --git a/src/libnm-gtk/libnm-gtk.ver b/src/libnm-gtk/libnm-gtk.ver
index 6e9d3b1..9702180 100644
--- a/src/libnm-gtk/libnm-gtk.ver
+++ b/src/libnm-gtk/libnm-gtk.ver
@@ -22,10 +22,12 @@ global:
        nma_cert_chooser_get_cert_password;
        nma_cert_chooser_get_cert_password_flags;
        nma_cert_chooser_get_cert_uri;
+       nma_cert_chooser_get_flags;
        nma_cert_chooser_get_key;
        nma_cert_chooser_get_key_password;
        nma_cert_chooser_get_key_password_flags;
        nma_cert_chooser_get_key_uri;
+       nma_cert_chooser_get_title;
        nma_cert_chooser_get_type;
        nma_cert_chooser_new;
        nma_cert_chooser_set_cert;
diff --git a/src/libnma/libnma.ver b/src/libnma/libnma.ver
index b1efa74..8573dbc 100644
--- a/src/libnma/libnma.ver
+++ b/src/libnma/libnma.ver
@@ -77,10 +77,12 @@ global:
        nma_cert_chooser_get_cert_password;
        nma_cert_chooser_get_cert_password_flags;
        nma_cert_chooser_get_cert_uri;
+       nma_cert_chooser_get_flags;
        nma_cert_chooser_get_key;
        nma_cert_chooser_get_key_password;
        nma_cert_chooser_get_key_password_flags;
        nma_cert_chooser_get_key_uri;
+       nma_cert_chooser_get_title;
        nma_cert_chooser_get_type;
        nma_cert_chooser_new;
        nma_cert_chooser_set_cert;
diff --git a/src/libnma/nma-cert-chooser-private.h b/src/libnma/nma-cert-chooser-private.h
index 6883500..20ea978 100644
--- a/src/libnma/nma-cert-chooser-private.h
+++ b/src/libnma/nma-cert-chooser-private.h
@@ -99,8 +99,6 @@ struct _NMACertChooserClass {
  * @update_key_password_storage: Update key password storage.
  * @get_key_password_flags: Returns secret flags corresponding to the key
  *   password if one is present.
- * @set_title: Setup the title property
- * @set_flags: Setup the flags property
  */
 struct _NMACertChooserVtable {
        void                 (*init)                         (NMACertChooser *cert_chooser);
@@ -144,11 +142,6 @@ struct _NMACertChooserVtable {
                                                              NMSetting *setting,
                                                              const char *password_flags_name);
        NMSettingSecretFlags (*get_key_password_flags)       (NMACertChooser *cert_chooser);
-
-       void         (*set_title)                            (NMACertChooser *cert_chooser,
-                                                             const gchar *title);
-       void         (*set_flags)                            (NMACertChooser *cert_chooser,
-                                                             NMACertChooserFlags flags);
 };
 
 extern const NMACertChooserVtable nma_cert_chooser_vtable_file;
diff --git a/src/libnma/nma-cert-chooser.c b/src/libnma/nma-cert-chooser.c
index ff38b83..cc9a42b 100644
--- a/src/libnma/nma-cert-chooser.c
+++ b/src/libnma/nma-cert-chooser.c
@@ -603,6 +603,38 @@ nma_cert_chooser_get_key_password_flags (NMACertChooser *cert_chooser)
        return NMA_CERT_CHOOSER_GET_VTABLE (cert_chooser)->get_key_password_flags (cert_chooser);
 }
 
+/**
+ * nma_cert_chooser_get_title:
+ * @cert_chooser: certificate chooser instance
+ *
+ * Returns: (transfer none): the title property.
+ *
+ * Since: 1.8.0
+ */
+const char *
+nma_cert_chooser_get_title (NMACertChooser *cert_chooser)
+{
+       g_return_val_if_fail (NMA_IS_CERT_CHOOSER (cert_chooser), NULL);
+
+       return NMA_CERT_CHOOSER_GET_PRIVATE (cert_chooser)->title;
+}
+
+/**
+ * nma_cert_chooser_get_flags:
+ * @cert_chooser: certificate chooser instance
+ *
+ * Returns: the flags property.
+ *
+ * Since: 1.8.0
+ */
+NMACertChooserFlags
+nma_cert_chooser_get_flags (NMACertChooser *cert_chooser)
+{
+       g_return_val_if_fail (NMA_IS_CERT_CHOOSER (cert_chooser), 0);
+
+       return NMA_CERT_CHOOSER_GET_PRIVATE (cert_chooser)->flags;
+}
+
 static void
 constructed (GObject *object)
 {
diff --git a/src/libnma/nma-cert-chooser.h b/src/libnma/nma-cert-chooser.h
index b48fbe8..b306cfd 100644
--- a/src/libnma/nma-cert-chooser.h
+++ b/src/libnma/nma-cert-chooser.h
@@ -160,6 +160,12 @@ void                 nma_cert_chooser_update_key_password_storage  (NMACertChoos
 NMA_AVAILABLE_IN_1_8
 NMSettingSecretFlags nma_cert_chooser_get_key_password_flags       (NMACertChooser *cert_chooser);
 
+NMA_AVAILABLE_IN_1_8
+const char          *nma_cert_chooser_get_title                    (NMACertChooser *cert_chooser);
+
+NMA_AVAILABLE_IN_1_8
+NMACertChooserFlags  nma_cert_chooser_get_flags                    (NMACertChooser *cert_chooser);
+
 G_END_DECLS
 
 #endif /* NMA_CERT_CHOOSER_H */
diff --git a/src/libnma/nma-file-cert-chooser.c b/src/libnma/nma-file-cert-chooser.c
index 9f85717..6d4ecc1 100644
--- a/src/libnma/nma-file-cert-chooser.c
+++ b/src/libnma/nma-file-cert-chooser.c
@@ -382,14 +382,14 @@ init (NMACertChooser *cert_chooser)
        gtk_grid_attach (GTK_GRID (cert_chooser), priv->cert_button_label, 0, 0, 1, 1);
        gtk_widget_show (priv->cert_button_label);
        gtk_widget_set_no_show_all (priv->cert_button_label, TRUE);
+
+       set_title (cert_chooser, nma_cert_chooser_get_title (cert_chooser));
+       set_flags (cert_chooser, nma_cert_chooser_get_flags (cert_chooser));
 }
 
 const NMACertChooserVtable nma_cert_chooser_vtable_file = {
        .init = init,
 
-       .set_title = set_title,
-       .set_flags = set_flags,
-
        .set_cert_uri = set_cert_uri,
        .get_cert_uri = get_cert_uri,
        .set_key_uri = set_key_uri,
diff --git a/src/libnma/nma-pkcs11-cert-chooser.c b/src/libnma/nma-pkcs11-cert-chooser.c
index 852be2e..b97984f 100644
--- a/src/libnma/nma-pkcs11-cert-chooser.c
+++ b/src/libnma/nma-pkcs11-cert-chooser.c
@@ -510,13 +510,14 @@ init (NMACertChooser *cert_chooser)
        gtk_widget_set_sensitive (priv->cert_password_label, FALSE);
        gtk_widget_show (priv->cert_password_label);
        gtk_widget_set_no_show_all (priv->cert_password_label, TRUE);
+
+       set_title (cert_chooser, nma_cert_chooser_get_title (cert_chooser));
+       set_flags (cert_chooser, nma_cert_chooser_get_flags (cert_chooser));
 }
 
 const NMACertChooserVtable nma_cert_chooser_vtable_pkcs11 = {
        .init = init,
 
-       .set_title = set_title,
-       .set_flags = set_flags,
        .set_cert_uri = set_cert_uri,
        .get_cert_uri = get_cert_uri,
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]