gnome-keyring [PATCH 9/9] ui: add PKCS#11 object chooser demo
- From: Lubomir Rintel <lkundrak v3 sk>
- To: gnome-keyring-list gnome org
- Cc: David Woodhouse <dwmw2 infradead org>, Prashant Tyagi <prashanttyagi221295 gmail com>, Lubomir Rintel <lkundrak v3 sk>
- Subject: gnome-keyring [PATCH 9/9] ui: add PKCS#11 object chooser demo
- Date: Tue, 13 Dec 2016 19:20:10 +0100
---
ui/Makefile.am | 7 ++++++-
ui/frob-object-chooser.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 ui/frob-object-chooser.c
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 10d6ee0..73b6103 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -310,7 +310,8 @@ noinst_PROGRAMS += \
frob-request \
frob-system-prompt \
frob-unlock \
- frob-unlock-options
+ frob-unlock-options \
+ frob-object-chooser
frob_certificate_SOURCES = ui/frob-certificate.c
frob_certificate_CFLAGS = $(ui_CFLAGS)
@@ -356,3 +357,7 @@ frob_unlock_LDADD = $(ui_LIBS)
frob_unlock_options_SOURCES = ui/frob-unlock-options.c
frob_unlock_options_CFLAGS = $(ui_CFLAGS)
frob_unlock_options_LDADD = $(ui_LIBS)
+
+frob_object_chooser_SOURCES = ui/frob-object-chooser.c
+frob_object_chooser_CFLAGS = $(ui_CFLAGS)
+frob_object_chooser_LDADD = $(ui_LIBS)
diff --git a/ui/frob-object-chooser.c b/ui/frob-object-chooser.c
new file mode 100644
index 0000000..db8f9ce
--- /dev/null
+++ b/ui/frob-object-chooser.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 Lubomir Rintel
+ *
+ * This program 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.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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 program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gcr/gcr.h"
+
+#include "ui/gcr-object-chooser-dialog.h"
+
+#include <gtk/gtk.h>
+
+int
+main(int argc, char *argv[])
+{
+ GtkWidget *dialog;
+
+ gtk_init (&argc, &argv);
+ g_set_prgname ("frob-object-chooser");
+
+ dialog = gcr_object_chooser_dialog_new ("Choose a certificate", NULL,
+ GTK_DIALOG_USE_HEADER_BAR,
+ "_Cancel", GTK_RESPONSE_CANCEL,
+ "_Select", GTK_RESPONSE_ACCEPT,
+ NULL, NULL);
+ if (argc > 1) {
+ gcr_object_chooser_set_uri (GCR_OBJECT_CHOOSER (dialog), argv[1]);
+ }
+
+ switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
+ case GTK_RESPONSE_ACCEPT:
+ g_printerr ("selected: %s\n", gcr_object_chooser_get_uri (GCR_OBJECT_CHOOSER (dialog)));
+ break;
+ default:
+ g_printerr ("cancelled\n");
+ }
+ gtk_widget_destroy (dialog);
+
+ return 0;
+}
--
2.9.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]