seahorse r2763 - in trunk: . libcryptui libcryptui/tests
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2763 - in trunk: . libcryptui libcryptui/tests
- Date: Thu, 5 Feb 2009 04:05:41 +0000 (UTC)
Author: nnielsen
Date: Thu Feb 5 04:05:41 2009
New Revision: 2763
URL: http://svn.gnome.org/viewvc/seahorse?rev=2763&view=rev
Log:
Revert accidental deletion of libcryptui test program deletion in svn commit [2716]
Added:
trunk/libcryptui/tests/
trunk/libcryptui/tests/.gitignore
trunk/libcryptui/tests/Makefile.am
trunk/libcryptui/tests/cryptui-test-ui.c
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/libcryptui/Makefile.am
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Feb 5 04:05:41 2009
@@ -583,6 +583,7 @@
gkr/Makefile
libcryptui/cryptui.pc
libcryptui/Makefile
+libcryptui/tests/Makefile
libegg/Makefile
libseahorse/Makefile
pgp/Makefile
Modified: trunk/libcryptui/Makefile.am
==============================================================================
--- trunk/libcryptui/Makefile.am (original)
+++ trunk/libcryptui/Makefile.am Thu Feb 5 04:05:41 2009
@@ -1,3 +1,11 @@
+if WITH_TESTS
+TESTS_DIR = tests
+else
+TESTS_DIR =
+endif
+
+SUBDIRS = . $(TESTS_DIR)
+
# -----------------------------------------------------------------
# LIBRARY HEADERS
#
Added: trunk/libcryptui/tests/.gitignore
==============================================================================
--- (empty file)
+++ trunk/libcryptui/tests/.gitignore Thu Feb 5 04:05:41 2009
@@ -0,0 +1,7 @@
+.libs
+.deps
+.cvsignore
+Makefile
+Makefile.in
+cryptui-test
+
Added: trunk/libcryptui/tests/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/libcryptui/tests/Makefile.am Thu Feb 5 04:05:41 2009
@@ -0,0 +1,19 @@
+
+noinst_PROGRAMS= \
+ cryptui-test
+
+# ------------------------------------------------------------------------------
+# UI TEST PROGRAMS
+
+cryptui_test_SOURCES = cryptui-test-ui.c
+cryptui_test_LDADD = $(LIBCRYPTUI_LIBS) \
+ $(top_builddir)/libcryptui/libcryptui.la
+
+# ------------------------------------------------------------------------------
+# COMMON
+
+INCLUDES = -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/libcryptui \
+ -DLIBCRYPTUI_API_SUBJECT_TO_CHANGE \
+ $(LIBCRYPTUI_CFLAGS)
Added: trunk/libcryptui/tests/cryptui-test-ui.c
==============================================================================
--- (empty file)
+++ trunk/libcryptui/tests/cryptui-test-ui.c Thu Feb 5 04:05:41 2009
@@ -0,0 +1,134 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2005 Stefan Walter
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "config.h"
+#include <gtk/gtk.h>
+
+#include "cryptui.h"
+#include "cryptui-keyset.h"
+#include "cryptui-key-store.h"
+#include "cryptui-key-combo.h"
+#include "cryptui-key-list.h"
+#include "cryptui-key-chooser.h"
+
+static void
+show_ui_dialog (CryptUIKeyset *keyset)
+{
+ GtkWidget *dialog;
+ GtkComboBox *combo;
+ GtkTreeView *list;
+ GtkContainer *box;
+ CryptUIKeyStore *combo_store;
+ CryptUIKeyStore *list_store;
+
+ dialog = gtk_dialog_new_with_buttons ("CryptUI Test", NULL, GTK_DIALOG_MODAL,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
+
+ box = GTK_CONTAINER (gtk_vbox_new (FALSE, 6));
+ gtk_container_set_border_width (box, 6);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), GTK_WIDGET (box));
+
+ list_store = cryptui_key_store_new (keyset, TRUE, NULL);
+ list = cryptui_key_list_new (list_store, CRYPTUI_KEY_LIST_CHECKS);
+ gtk_container_add (box, GTK_WIDGET (list));
+
+ combo_store = cryptui_key_store_new (keyset, FALSE, "No Key Selected");
+ combo = cryptui_key_combo_new (combo_store);
+ gtk_container_add (box, GTK_WIDGET (combo));
+
+ gtk_widget_show_all (dialog);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ g_object_unref (combo_store);
+ g_object_unref (list_store);
+}
+
+static void
+show_chooser_dialog (CryptUIKeyset *keyset)
+{
+ gchar **recipients, **k;
+ gchar *signer;
+
+ recipients = cryptui_prompt_recipients (keyset, "Choose Recipients", &signer);
+
+ if (recipients) {
+ for (k = recipients; *k; k++)
+ g_print ("RECIPIENT: %s\n", *k);
+ g_strfreev (recipients);
+ g_print ("SIGNER: %s\n", signer);
+ g_free (signer);
+ }
+}
+
+static void
+print_keyset (CryptUIKeyset *keyset)
+{
+ GList *keys, *l;
+ gboolean cache = FALSE;
+ gchar *name;
+ guint flags;
+
+ keys = cryptui_keyset_get_keys (keyset);
+
+ for(l = keys; l; l = g_list_next (l)) {
+ g_print ("key: %s\n", (gchar*)l->data);
+
+ /* Test half of them cached, half not */
+ if (cache)
+ cryptui_keyset_cache_key (keyset, (gchar*)l->data);
+ cache = !cache;
+
+ name = cryptui_keyset_key_display_name (keyset, (gchar*)l->data);
+ g_print (" name: %s\n", name);
+ g_free (name);
+
+ name = cryptui_keyset_key_display_id (keyset, (gchar*)l->data);
+ g_print (" id: %s\n", name);
+ g_free (name);
+
+ flags = cryptui_keyset_key_flags (keyset, (gchar*)l->data);
+ g_print (" flags: %d\n", flags);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ CryptUIKeyset *keyset;
+ const gchar *arg = "normal";
+
+ gtk_init(&argc, &argv);
+
+ keyset = cryptui_keyset_new ("openpgp", TRUE);
+ if (argc > 1)
+ arg = argv[1];
+
+ if (g_ascii_strcasecmp (arg, "plain") == 0)
+ show_ui_dialog (keyset);
+ else if (g_ascii_strcasecmp (arg, "normal") == 0)
+ show_chooser_dialog (keyset);
+ else if (g_ascii_strcasecmp (arg, "keyset") == 0)
+ print_keyset (keyset);
+ else
+ g_warning ("must specify something valid to display");
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]