[network-manager-applet/lr/pkcs11: 6/14] WIP libnma: add a file certificate chooser



commit 75bf89858181517fba121d91dacb59f20c655cfc
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Wed Feb 22 18:43:53 2017 +0100

    WIP libnma: add a file certificate chooser

 Makefile.am                        |    9 +-
 src/libnma/libnma.ver              |    1 +
 src/libnma/nma-cert-chooser.c      |    6 +-
 src/libnma/nma-file-cert-chooser.c |  475 ++++++++++++++++++++++++++++++++++++
 src/libnma/nma-file-cert-chooser.h |   50 ++++
 5 files changed, 537 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 12dcc21..6bf4eba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -350,7 +350,7 @@ libnm_gtk_h_pub = \
        src/libnm-gtk/nm-mobile-providers.h \
        src/libnm-gtk/nm-vpn-password-dialog.h \
        src/libnma/nma-cert-chooser.h \
-       src/libnm-gtk/nm-vpn-password-dialog.h
+       src/libnma/nma-file-cert-chooser.h
 
 libnm_gtk_c_real = \
        src/libnm-gtk/nm-wifi-dialog.c \
@@ -360,6 +360,7 @@ libnm_gtk_c_real = \
        src/libnm-gtk/nm-mobile-providers.c \
        src/libnm-gtk/nm-vpn-password-dialog.c \
        src/libnma/nma-cert-chooser.c \
+       src/libnma/nma-file-cert-chooser.c \
        src/libnm-gtk/init.c
 
 src_libnm_gtk_libnmgtkdir = $(includedir)/libnm-gtk
@@ -480,7 +481,8 @@ libnma_h_pub = \
        src/libnma/nma-mobile-providers.h \
        src/libnma/nma-vpn-password-dialog.h \
        src/libnma/nma-ui-utils.h \
-       src/libnma/nma-cert-chooser.h
+       src/libnma/nma-cert-chooser.h \
+       src/libnma/nma-file-cert-chooser.h
 
 libnma_c_real = \
        src/libnma/nma-wifi-dialog.c \
@@ -489,7 +491,8 @@ libnma_c_real = \
        src/libnma/nma-vpn-password-dialog.c \
        src/libnma/nma-ui-utils.c \
        src/libnma/init.c \
-       src/libnma/nma-cert-chooser.c
+       src/libnma/nma-cert-chooser.c \
+       src/libnma/nma-file-cert-chooser.c
 
 src_libnma_libnmadir = $(includedir)/libnma
 
diff --git a/src/libnma/libnma.ver b/src/libnma/libnma.ver
index b142132..8783ada 100644
--- a/src/libnma/libnma.ver
+++ b/src/libnma/libnma.ver
@@ -90,4 +90,5 @@ global:
        nma_cert_chooser_update_cert_password_storage;
        nma_cert_chooser_update_key_password_storage;
        nma_cert_chooser_validate;
+       nma_file_cert_chooser_get_type;
 } libnma_1_2_0;
diff --git a/src/libnma/nma-cert-chooser.c b/src/libnma/nma-cert-chooser.c
index b4277e9..fc70801 100644
--- a/src/libnma/nma-cert-chooser.c
+++ b/src/libnma/nma-cert-chooser.c
@@ -31,6 +31,7 @@
 #include <errno.h>
 
 #include "nma-cert-chooser.h"
+#include "nma-file-cert-chooser.h"
 
 enum {
        CERT_VALIDATE,
@@ -497,5 +498,8 @@ nma_cert_chooser_get_key_password_flags (NMACertChooser *cert_chooser)
 GtkWidget *
 nma_cert_chooser_new (const gchar *title, NMACertChooserFlags flags)
 {
-       g_return_val_if_reached (NULL);
+       if (flags & NMA_CERT_CHOOSER_FLAG_PEM)
+               return nma_file_cert_chooser_new (title, flags);
+
+       return nma_file_cert_chooser_new (title, flags);
 }
diff --git a/src/libnma/nma-file-cert-chooser.c b/src/libnma/nma-file-cert-chooser.c
new file mode 100644
index 0000000..39ea81c
--- /dev/null
+++ b/src/libnma/nma-file-cert-chooser.c
@@ -0,0 +1,475 @@
+/* NetworkManager Applet -- allow user control over networking
+ *
+ * Dan Williams <dcbw redhat com>
+ * Lubomir Rintel <lkundrak v3 sk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2015,2017 Red Hat, Inc.
+ */
+
+#include <config.h>
+
+#include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "nm-default.h"
+#include "nma-file-cert-chooser.h"
+#ifdef LIBNM_BUILD
+#include "nma-ui-utils.h"
+#else
+#include "nm-ui-utils.h"
+#endif
+#include "utils.h"
+
+void nma_cert_chooser_interface_init (NMACertChooserInterface *iface);
+
+typedef struct {
+       GtkWidget *key_button_label;
+       GtkWidget *key_password_label;
+       GtkWidget *cert_button_label;
+       GtkWidget *key_button;
+       GtkWidget *key_password;
+       GtkWidget *cert_button;
+} NMAFileCertChooserPrivate;
+
+#define NMA_FILE_CERT_CHOOSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                              NMA_TYPE_FILE_CERT_CHOOSER, \
+                                              NMAFileCertChooserPrivate))
+
+G_DEFINE_TYPE_WITH_CODE (NMAFileCertChooser, nma_file_cert_chooser, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_CERT_CHOOSER,
+                                                nma_cert_chooser_interface_init))
+
+static gboolean
+file_has_extension (const char *filename, const char *extensions[])
+{
+       char *p, *ext;
+       int i = 0;
+       gboolean found = FALSE;
+
+       p = strrchr (filename, '.');
+       if (!p)
+               return FALSE;
+
+       ext = g_ascii_strdown (p, -1);
+       if (ext) {
+               while (extensions[i]) {
+                       if (!strcmp (ext, extensions[i++])) {
+                               found = TRUE;
+                               break;
+                       }
+               }
+       }
+       g_free (ext);
+
+       return found;
+}
+
+static gboolean
+cert_filter (const GtkFileFilterInfo *filter_info, gpointer data)
+{
+       const char *extensions[] = { ".der", ".pem", ".crt", ".cer", ".p12", NULL };
+
+       if (!filter_info->filename)
+               return FALSE;
+
+       if (!file_has_extension (filter_info->filename, extensions))
+               return FALSE;
+
+       return TRUE;
+}
+
+static gboolean
+privkey_filter (const GtkFileFilterInfo *filter_info, gpointer user_data)
+{
+       const char *extensions[] = { ".der", ".pem", ".p12", ".key", NULL };
+
+       if (!filter_info->filename)
+               return FALSE;
+
+       if (!file_has_extension (filter_info->filename, extensions))
+               return FALSE;
+
+       return TRUE;
+}
+
+static void
+set_key_password (NMACertChooser *cert_chooser, const gchar *password)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       g_return_if_fail (priv->key_password != NULL);
+       gtk_entry_set_text (GTK_ENTRY (priv->key_password), password);
+}
+
+static const gchar *
+get_key_password (NMACertChooser *cert_chooser)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       g_return_val_if_fail (priv->key_password != NULL, NULL);
+       return gtk_entry_get_text (GTK_ENTRY (priv->key_password));
+}
+
+static void
+set_key (NMACertChooser *cert_chooser, const gchar *value, NMSetting8021xCKScheme scheme)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       if (value) {
+               if (scheme != NM_SETTING_802_1X_CK_SCHEME_PATH) {
+                       g_warning ("The key '%s' uses an unknown scheme %d\n", value, scheme);
+                       return;
+               }
+               gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->key_button), value);
+       }
+}
+
+static gchar *
+get_key (NMACertChooser *cert_chooser, NMSetting8021xCKScheme *scheme)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       g_return_val_if_fail (scheme != NULL, NULL);
+       g_return_val_if_fail (priv->key_button != NULL, NULL);
+       *scheme = NM_SETTING_802_1X_CK_SCHEME_PATH;
+       return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->key_button));
+}
+
+static void
+set_cert (NMACertChooser *cert_chooser, const gchar *value, NMSetting8021xCKScheme scheme)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       if (value) {
+               if (scheme != NM_SETTING_802_1X_CK_SCHEME_PATH) {
+                       g_warning ("The certificate '%s' uses an unknown scheme %d\n", value, scheme);
+                       return;
+               }
+               gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->cert_button), value);
+       }
+}
+
+static gchar *
+get_cert (NMACertChooser *cert_chooser, NMSetting8021xCKScheme *scheme)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       g_return_val_if_fail (scheme != NULL, NULL);
+       *scheme = NM_SETTING_802_1X_CK_SCHEME_PATH;
+       return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (priv->cert_button));
+}
+
+
+static void
+add_to_size_group (NMACertChooser *cert_chooser, GtkSizeGroup *group)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       gtk_size_group_add_widget (group, priv->cert_button_label);
+       if (priv->key_button_label)
+               gtk_size_group_add_widget (group, priv->key_button_label);
+       if (priv->key_password_label)
+               gtk_size_group_add_widget (group, priv->key_password_label);
+}
+
+static gboolean
+validate (NMACertChooser *cert_chooser, GError **error)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+       GError *local = NULL;
+
+       g_signal_emit_by_name (cert_chooser, "cert-validate", &local);
+       if (local) {
+               widget_set_error (priv->cert_button);
+               g_propagate_error (error, local);
+               return FALSE;
+       } else {
+               widget_unset_error (priv->cert_button);
+       }
+
+       if (priv->key_button) {
+               g_signal_emit_by_name (cert_chooser, "key-validate", &local);
+               if (local) {
+                       widget_set_error (priv->key_button);
+                       g_propagate_error (error, local);
+                       return FALSE;
+               } else {
+                       widget_unset_error (priv->key_button);
+               }
+
+               g_signal_emit_by_name (cert_chooser, "key-password-validate", &local);
+               if (local) {
+                       widget_set_error (priv->key_password);
+                       g_propagate_error (error, local);
+                       return FALSE;
+               } else {
+                       widget_unset_error (priv->key_password);
+               }
+       }
+
+       return TRUE;
+}
+
+static void
+setup_key_password_storage (NMACertChooser *cert_chooser,
+                            NMSettingSecretFlags initial_flags,
+                            NMSetting *setting,
+                            const char *password_flags_name,
+                            gboolean with_not_required,
+                            gboolean ask_mode)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       nma_utils_setup_password_storage (priv->key_password,
+                                         initial_flags,
+                                         setting,
+                                         password_flags_name,
+                                         with_not_required,
+                                         ask_mode);
+}
+
+static void
+update_key_password_storage (NMACertChooser *cert_chooser,
+                             NMSettingSecretFlags secret_flags,
+                             NMSetting *setting,
+                             const char *password_flags_name)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       nma_utils_update_password_storage (priv->key_password,
+                                          secret_flags,
+                                          setting,
+                                          password_flags_name);
+}
+
+
+static NMSettingSecretFlags
+get_key_password_flags (NMACertChooser *cert_chooser)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+
+       return nma_utils_menu_to_secret_flags (priv->key_password);
+}
+
+void
+nma_cert_chooser_interface_init (NMACertChooserInterface *iface)
+{
+       iface->set_cert = set_cert;
+       iface->get_cert = get_cert;
+       iface->set_key = set_key;
+       iface->get_key = get_key;
+       iface->set_key_password = set_key_password;
+       iface->get_key_password = get_key_password;
+
+       iface->add_to_size_group = add_to_size_group;
+       iface->validate = validate;
+
+       iface->setup_key_password_storage = setup_key_password_storage;
+       iface->update_key_password_storage = update_key_password_storage;
+       iface->get_key_password_flags = get_key_password_flags;
+}
+
+static void
+reset_filter (GtkWidget *widget, GParamSpec *spec, gpointer user_data)
+{
+       if (!gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (widget))) {
+               g_signal_handlers_block_by_func (widget, reset_filter, user_data);
+               gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (widget), GTK_FILE_FILTER (user_data));
+               g_signal_handlers_unblock_by_func (widget, reset_filter, user_data);
+       }
+}
+
+static void
+cert_changed_cb (GtkFileChooserButton *file_chooser_button, gpointer user_data)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (user_data);
+
+       if (priv->key_button) {
+               gtk_widget_set_sensitive (priv->key_button, TRUE);
+               gtk_widget_set_sensitive (priv->key_button_label, TRUE);
+       }
+       g_signal_emit_by_name (user_data, "changed");
+}
+
+static void
+key_changed_cb (GtkFileChooserButton *file_chooser_button, gpointer user_data)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (user_data);
+
+       gtk_widget_set_sensitive (priv->key_password, TRUE);
+       gtk_widget_set_sensitive (priv->key_password_label, TRUE);
+       g_signal_emit_by_name (user_data, "changed");
+}
+
+static void
+key_password_changed_cb (GtkEntry *entry, gpointer user_data)
+{
+       g_signal_emit_by_name (user_data, "changed");
+}
+
+static void
+show_toggled_cb (GtkCheckButton *button, gpointer user_data)
+{
+       NMAFileCertChooserPrivate *priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (user_data);
+
+       gtk_entry_set_visibility (GTK_ENTRY (priv->key_password),
+                                 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
+}
+
+GtkWidget *
+nma_file_cert_chooser_new (const gchar *title, NMACertChooserFlags flags)
+{
+       GtkWidget *self;
+       NMAFileCertChooserPrivate *priv;
+       GtkFileFilter *filter;
+       gchar *text;
+       GtkWidget *show_password;
+
+       self = g_object_new (NMA_TYPE_FILE_CERT_CHOOSER, NULL);
+       priv = NMA_FILE_CERT_CHOOSER_GET_PRIVATE (self);
+
+       gtk_grid_insert_column (GTK_GRID (self), 2);
+       gtk_grid_set_row_spacing (GTK_GRID (self), 6);
+       gtk_grid_set_column_spacing (GTK_GRID (self), 12);
+
+       if ((flags & NMA_CERT_CHOOSER_FLAG_CERT) == 0) {
+               /* The key chooser */
+               gtk_grid_insert_row (GTK_GRID (self), 0);
+
+               filter = gtk_file_filter_new ();
+               gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, privkey_filter, NULL, NULL);
+               gtk_file_filter_set_name (filter, _("DER, PEM, or PKCS#12 private keys (*.der, *.pem, *.p12, 
*.key)"));
+
+               text = g_strdup_printf (_("Choose a key for %s certificate"), title);
+               priv->key_button = g_object_new (GTK_TYPE_FILE_CHOOSER_BUTTON,
+                                                 "action", GTK_FILE_CHOOSER_ACTION_OPEN,
+                                                 "title", text,
+                                                 "filter", filter,
+                                                 "local-only", TRUE,
+                                                 NULL);
+               g_free (text);
+               gtk_grid_attach (GTK_GRID (self), priv->key_button, 1, 0, 1, 1);
+               gtk_widget_set_hexpand (priv->key_button, TRUE);
+               gtk_widget_set_sensitive (priv->key_button, FALSE);
+               if ((flags & NMA_CERT_CHOOSER_FLAG_PASSWORDS) == 0)
+                       gtk_widget_show (priv->key_button);
+
+               g_signal_connect (priv->key_button, "selection-changed",
+                                 G_CALLBACK (key_changed_cb), self);
+
+               text = g_strdup_printf (_("%s private _key:"), title);
+               priv->key_button_label = gtk_label_new_with_mnemonic (text);
+               gtk_label_set_xalign (GTK_LABEL (priv->key_button_label), 0);
+               gtk_label_set_mnemonic_widget (GTK_LABEL (priv->key_button_label), priv->key_button);
+               gtk_grid_attach (GTK_GRID (self), priv->key_button_label, 0, 0, 1, 1);
+               gtk_widget_set_sensitive (priv->key_button_label, FALSE);
+               if ((flags & NMA_CERT_CHOOSER_FLAG_PASSWORDS) == 0)
+                       gtk_widget_show (priv->key_button_label);
+               g_free (text);
+
+               /* The key password entry */
+               gtk_grid_insert_row (GTK_GRID (self), 1);
+
+               priv->key_password = gtk_entry_new ();
+               gtk_entry_set_visibility (GTK_ENTRY (priv->key_password), FALSE);
+               gtk_grid_attach (GTK_GRID (self), priv->key_password, 1, 1, 1, 1);
+               gtk_widget_set_hexpand (priv->key_password, TRUE);
+               gtk_widget_set_sensitive (priv->key_password, FALSE);
+               gtk_widget_show (priv->key_password);
+
+               g_signal_connect (priv->key_password, "changed",
+                                 G_CALLBACK (key_password_changed_cb), self);
+
+               text = g_strdup_printf (_("%s key _password:"), title);
+               priv->key_password_label = gtk_label_new_with_mnemonic (text);
+               gtk_label_set_xalign (GTK_LABEL (priv->key_password_label), 0);
+               gtk_label_set_mnemonic_widget (GTK_LABEL (priv->key_password_label), priv->key_password);
+               gtk_grid_attach (GTK_GRID (self), priv->key_password_label, 0, 1, 1, 1);
+               gtk_widget_set_sensitive (priv->key_password_label, FALSE);
+               gtk_widget_show (priv->key_password_label);
+               g_free (text);
+
+               /* Show password */
+               gtk_grid_insert_row (GTK_GRID (self), 2);
+               show_password = gtk_check_button_new_with_mnemonic ("Sho_w password");
+               gtk_grid_attach (GTK_GRID (self), show_password, 1, 2, 1, 1);
+               gtk_widget_show (show_password);
+               g_signal_connect (show_password, "toggled",
+                                 G_CALLBACK (show_toggled_cb), self);
+       }
+
+       /* The certificate chooser */
+       gtk_grid_insert_row (GTK_GRID (self), 0);
+
+       filter = gtk_file_filter_new ();
+       gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME, cert_filter, NULL, NULL);
+       gtk_file_filter_set_name (filter, _("PEM certificates (*.pem, *.crt, *.cer)"));
+
+       text = g_strdup_printf (_("Choose %s certificate"), title);
+       priv->cert_button = g_object_new (GTK_TYPE_FILE_CHOOSER_BUTTON,
+                                         "action", GTK_FILE_CHOOSER_ACTION_OPEN,
+                                         "title", text,
+                                         "filter", filter,
+                                         "local-only", TRUE,
+                                         NULL);
+       g_free (text);
+       gtk_grid_attach (GTK_GRID (self), priv->cert_button, 1, 0, 1, 1);
+       gtk_widget_set_hexpand (priv->cert_button, TRUE);
+       if ((flags & NMA_CERT_CHOOSER_FLAG_PASSWORDS) == 0)
+               gtk_widget_show (priv->cert_button);
+
+       /* For some reason, GTK+ calls set_current_filter (..., NULL) from 
+        * gtkfilechooserdefault.c::show_and_select_files_finished_loading() on our
+        * dialog; so force-reset the filter to what we want it to be whenever
+        * it gets cleared.
+        */
+       g_signal_connect (priv->cert_button, "notify::filter",
+                         G_CALLBACK (reset_filter), filter);
+
+       g_signal_connect (priv->cert_button, "selection-changed",
+                         G_CALLBACK (cert_changed_cb), self);
+
+       text = g_strdup_printf (_("%s _certificate:"), title);
+       priv->cert_button_label = gtk_label_new_with_mnemonic (text);
+       gtk_label_set_xalign (GTK_LABEL (priv->cert_button_label), 0);
+       gtk_label_set_mnemonic_widget (GTK_LABEL (priv->cert_button_label), priv->cert_button);
+       gtk_grid_attach (GTK_GRID (self), priv->cert_button_label, 0, 0, 1, 1);
+       if ((flags & NMA_CERT_CHOOSER_FLAG_PASSWORDS) == 0)
+               gtk_widget_show (priv->cert_button_label);
+       g_free (text);
+
+       return self;
+}
+
+static void
+nma_file_cert_chooser_class_init (NMAFileCertChooserClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       g_type_class_add_private (object_class, sizeof (NMAFileCertChooserPrivate));
+}
+
+static void
+nma_file_cert_chooser_init (NMAFileCertChooser *file_cert_chooser)
+{
+}
diff --git a/src/libnma/nma-file-cert-chooser.h b/src/libnma/nma-file-cert-chooser.h
new file mode 100644
index 0000000..171595f
--- /dev/null
+++ b/src/libnma/nma-file-cert-chooser.h
@@ -0,0 +1,50 @@
+/* NetworkManager Applet -- allow user control over networking
+ *
+ * Lubomir Rintel <lkundrak v3 sk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2015,2017 Red Hat, Inc.
+ */
+
+#ifndef NMA_FILE_CERT_CHOOSER_H
+#define NMA_FILE_CERT_CHOOSER_H
+
+#include <gtk/gtk.h>
+#include "nma-cert-chooser.h"
+
+G_BEGIN_DECLS
+
+#define NMA_TYPE_FILE_CERT_CHOOSER                   (nma_file_cert_chooser_get_type ())
+#define NMA_FILE_CERT_CHOOSER(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
NMA_TYPE_FILE_CERT_CHOOSER, NMACertChooser))
+#define NMA_IS_FILE_CERT_CHOOSER(obj)                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
NMA_TYPE_FILE_CERT_CHOOSER))
+#define NMA_FILE_CERT_CHOOSER_GET_INTERFACE(obj)     (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
NMA_TYPE_FILE_CERT_CHOOSER, NMACertChooserInterface))
+
+typedef struct {
+       GtkGrid parent;
+} NMAFileCertChooser;
+
+typedef struct {
+       GtkGridClass parent_class;
+} NMAFileCertChooserClass;
+
+GType nma_file_cert_chooser_get_type (void);
+
+GtkWidget *nma_file_cert_chooser_new (const gchar *title, NMACertChooserFlags flags);
+
+G_END_DECLS
+
+#endif /* NMA_FILE_CERT_CHOOSER_H */


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