[Gpa-commits] r990 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 5 19:59:53 CEST 2009


Author: werner
Date: 2009-05-05 19:59:47 +0200 (Tue, 05 May 2009)
New Revision: 990

Added:
   trunk/src/keymanager.c
   trunk/src/keymanager.h
Removed:
   trunk/src/keyring.c
   trunk/src/keyring.h
Modified:
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/cm-openpgp.c
   trunk/src/fileman.c
   trunk/src/gpa.c
   trunk/src/gpa.h
   trunk/src/icons.c
   trunk/src/icons.h
   trunk/src/server.c
Log:
Started rework of the keyring editor; now called key manager.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/ChangeLog	2009-05-05 17:59:47 UTC (rev 990)
@@ -1,5 +1,16 @@
+2009-05-05  Werner Koch  <wk at g10code.com>
+
+	* keyring.h: Rename to keymanager.h and rewrite.
+	* keyring.c: Rename to keymanager.c and rewrte as proper GObject.
+	* gpa.c (gpa_open_keyring_editor): Adjust for changed keymanager.
+	Rename to gpa_open_key_manager.
+	(quit_if_no_window): Ditto.
+	(keyringeditor): Remove.
+
 2009-05-04  Werner Koch  <wk at g10code.com>
 
+	* fileman.c (DIM): Remove as it is already in gpa.h.
+
 	* keylist.h (struct _GpaKeyList): Add field DISPOSED.
 	* keylist.c (gpa_keylist_get_type): Remove casts.
 	(gpa_keylist_class_init): Use correct function prototype.

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/Makefile.am	2009-05-05 17:59:47 UTC (rev 990)
@@ -78,7 +78,7 @@
 	      verifydlg.c verifydlg.h \
               recipientdlg.c recipientdlg.h \
               selectkeydlg.c selectkeydlg.h \
-	      keyring.c keyring.h \
+	      keymanager.c keymanager.h \
 	      gpa-key-details.c gpa-key-details.h \
 	      ownertrustdlg.c ownertrustdlg.h \
 	      keysigndlg.c keysigndlg.h \

Modified: trunk/src/cm-openpgp.c
===================================================================
--- trunk/src/cm-openpgp.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/cm-openpgp.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -592,7 +592,7 @@
       char *message = g_strdup_printf 
         (_("Error saving the changed values.\n"
            "(%s <%s>)"), gpg_strerror (err), gpg_strsource (err));
-      gpa_cm_object_alert_dialog (card, message);
+      gpa_cm_object_alert_dialog (GPA_CM_OBJECT (card), message);
       xfree (message);
     }
   xfree (command);

Modified: trunk/src/fileman.c
===================================================================
--- trunk/src/fileman.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/fileman.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -49,11 +49,6 @@
 #include "gpafileverifyop.h"
 
 
-/* FIXME:  Move to a gloabl file.  */
-#ifndef DIM
-#define DIM(array) (sizeof (array) / sizeof (*array))
-#endif
-
 #if ! GTK_CHECK_VERSION (2, 10, 0)
 #define GTK_STOCK_SELECT_ALL "gtk-select-all"
 #endif

Modified: trunk/src/gpa.c
===================================================================
--- trunk/src/gpa.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/gpa.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -32,7 +32,7 @@
 
 #include "get-path.h"
 #include "gpa.h"
-#include "keyring.h"
+#include "keymanager.h"
 #include "fileman.h"
 #include "clipboard.h"
 #include "cardman.h"
@@ -61,7 +61,7 @@
 /* Local variables.  */
 typedef struct
 {
-  gboolean start_keyring_editor;
+  gboolean start_key_manager;
   gboolean start_file_manager;
   gboolean start_card_manager;
   gboolean start_clipboard;
@@ -76,13 +76,12 @@
 /* The copyright notice.  */
 static const char *copyright = 
 "Copyright (C) 2000-2002 Miguel Coca, G-N-U GmbH, Intevation GmbH.\n"
-"Copyright (C) 2008 g10 Code GmbH.\n"
+"Copyright (C) 2008, 2009 g10 Code GmbH.\n"
 "This program comes with ABSOLUTELY NO WARRANTY.\n"
 "This is free software, and you are welcome to redistribute it\n"
 "under certain conditions.  See the file COPYING for details.\n";
 
 
-static GtkWidget *keyringeditor = NULL;
 static GtkWidget *backend_config_dialog = NULL;
 
 
@@ -95,8 +94,8 @@
     { "version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
       (gpointer) &print_version,
       N_("Output version information and exit"), NULL, },
-    { "keyring", 'k', 0, G_OPTION_ARG_NONE, &args.start_keyring_editor,
-      N_("Open keyring editor (default)"), NULL },
+    { "keyring", 'k', 0, G_OPTION_ARG_NONE, &args.start_key_manager,
+      N_("Open key manager (default)"), NULL },
     { "files", 'f', 0, G_OPTION_ARG_NONE, &args.start_file_manager,
       N_("Open file manager"), NULL },
     { "card", 'C', 0, G_OPTION_ARG_NONE, &args.start_card_manager,
@@ -170,8 +169,8 @@
 static void
 quit_if_no_window (void)
 {
-  if (!keyringeditor 
-      && !args.start_only_server
+  if (!args.start_only_server
+      && !gpa_key_manager_is_open ()
       && !gpa_file_manager_is_open ()
       && !gpa_clipboard_is_open ()
 #ifdef BUILD_CARD_MANAGER
@@ -192,19 +191,20 @@
 }
 
 
-/* Show the keyring editor dialog.  */
+/* Show the key manager dialog.  */
 void
-gpa_open_keyring_editor (GtkAction *action, void *data)
+gpa_open_key_manager (GtkAction *action, void *data)
 {
-  if (! keyringeditor)
-    {
-      keyringeditor = keyring_editor_new ();
-      g_signal_connect (G_OBJECT (keyringeditor), "destroy",
-			G_CALLBACK (close_main_window), &keyringeditor);
-      gtk_widget_show_all (keyringeditor);
-    }
+  GtkWidget *widget;
+  gboolean created;
 
-  gtk_window_present (GTK_WINDOW (keyringeditor));
+  widget = gpa_key_manager_get_instance (&created);
+  if (created)
+    g_signal_connect (G_OBJECT (widget), "destroy",
+                      G_CALLBACK (quit_if_no_window), NULL);
+
+  gtk_widget_show_all (widget);
+  gtk_window_present (GTK_WINDOW (widget));
 }
 
 
@@ -213,7 +213,9 @@
 gpa_open_clipboard (GtkAction *action, void *data)
 {
   /* FIXME: Shouldn't this connect only happen if the instance is
-     created the first time?  Looks like a memory leak to me.  */
+     created the first time?  Looks like a memory leak to me.  Right:
+     although the closure is ref counted an inetrnal data object will
+     get allocated.  */
   g_signal_connect (G_OBJECT (gpa_clipboard_get_instance ()), "destroy",
 		    G_CALLBACK (quit_if_no_window), NULL);
   gtk_widget_show_all (gpa_clipboard_get_instance ());
@@ -399,8 +401,8 @@
   if (args.start_only_server)
     cms_hack = 1; 
 
-  /* Start the keyring editor by default.  */
-  if (!args.start_keyring_editor 
+  /* Start the key manger by default.  */
+  if (!args.start_key_manager
       && !args.start_file_manager
       && !args.start_clipboard
       && !args.start_settings
@@ -408,7 +410,7 @@
       && !args.start_card_manager
 #endif
       )
-    args.start_keyring_editor = TRUE;
+    args.start_key_manager = TRUE;
 
   /* Note: We can not use GPGME's engine info, as that returns NULL
      (default) for home_dir.  Consider improving GPGME to get it from
@@ -455,10 +457,10 @@
     }
   else
     {
-      /* Don't open the keyring editor if any files are given on the
-         command line.  Ditto for the clipboard.   */
-      if (args.start_keyring_editor && (optind >= argc))
-	gpa_open_keyring_editor (NULL, NULL);
+      /* Don't open the key manager if any files are given on the
+         command line.  Ditto for the clipboard.  */
+      if (args.start_key_manager && (optind >= argc))
+	gpa_open_key_manager (NULL, NULL);
 
       if (args.start_clipboard && (optind >= argc))
 	gpa_open_clipboard (NULL, NULL);

Modified: trunk/src/gpa.h
===================================================================
--- trunk/src/gpa.h	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/gpa.h	2009-05-05 17:59:47 UTC (rev 990)
@@ -54,7 +54,7 @@
 extern gboolean disable_ticker;
 
 /* Show the keyring editor dialog.  */
-void gpa_open_keyring_editor (GtkAction *action, void *data);
+void gpa_open_key_manager (GtkAction *action, void *data);
 
 /* Show the filemanager dialog.  */
 void gpa_open_filemanager (GtkAction *action, void *data);
@@ -70,8 +70,8 @@
   {
       { "Windows", NULL, N_("_Windows"), NULL },
 
-      { "WindowsKeyringEditor", GPA_STOCK_KEYRING, NULL, NULL,
-	N_("Open the keyring editor"), G_CALLBACK (gpa_open_keyring_editor) },
+      { "WindowsKeyringEditor", GPA_STOCK_KEYMAN, NULL, NULL,
+	N_("Open the keyring editor"), G_CALLBACK (gpa_open_key_manager) },
       { "WindowsFileManager", GPA_STOCK_FILEMAN, NULL, NULL,
 	N_("Open the file manager"), G_CALLBACK (gpa_open_filemanager) },
       { "WindowsClipboard", GPA_STOCK_CLIPBOARD, NULL, NULL,

Modified: trunk/src/icons.c
===================================================================
--- trunk/src/icons.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/icons.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -63,13 +63,13 @@
   { GPA_STOCK_DECRYPT, decrypt_xpm },
   { GPA_STOCK_SIGN, sign_xpm },
   { GPA_STOCK_VERIFY, verify_xpm },
-  { GPA_STOCK_KEYRING, keyringeditor_xpm },
+  { GPA_STOCK_KEYMAN_SIMPLE, keyringeditor_xpm },
   { GPA_STOCK_EXPORT, export_xpm },
   { GPA_STOCK_IMPORT, import_xpm },
   { GPA_STOCK_BRIEF, brief_xpm },
   { GPA_STOCK_DETAILED, detailed_xpm },
   { GPA_STOCK_EDIT, edit_xpm },
-  { GPA_STOCK_KEYRING_EDITOR, keyring_xpm },
+  { GPA_STOCK_KEYMAN, keyring_xpm },
   { "gpa_blue_key", gpa_blue_key_xpm },
   { "gpa_yellow_key", gpa_yellow_key_xpm },
   { GPA_STOCK_PUBLIC_KEY, blue_key_xpm },
@@ -205,7 +205,7 @@
       { GPA_STOCK_DECRYPT, N_("_Decrypt"), 0, 0, PACKAGE },
       { GPA_STOCK_BRIEF, N_("_Brief"), 0, 0, PACKAGE },
       { GPA_STOCK_DETAILED, N_("_Detailed"), 0, 0, PACKAGE },
-      { GPA_STOCK_KEYRING, N_("_Keyring Editor"), 0, 0, PACKAGE },
+      { GPA_STOCK_KEYMAN,   N_("_Keyring Manager"), 0, 0, PACKAGE },
       { GPA_STOCK_CLIPBOARD, N_("_Clipboard"), 0, 0, PACKAGE },
       { GPA_STOCK_FILEMAN, N_("_File Manager"), 0, 0, PACKAGE },
       { GPA_STOCK_CARDMAN, N_("_Card Manager"), 0, 0, PACKAGE }

Modified: trunk/src/icons.h
===================================================================
--- trunk/src/icons.h	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/icons.h	2009-05-05 17:59:47 UTC (rev 990)
@@ -34,20 +34,19 @@
 #define GPA_STOCK_DECRYPT "gpa-decrypt"
 
 /* Windows items.  */
-#define GPA_STOCK_KEYRING_EDITOR "gpa-keyring"
-/* Simplified version of GPA_STOCK_KEYRING_EDITOR.  */
-#define GPA_STOCK_KEYRING "gpa-keyringeditor"
-#define GPA_STOCK_FILEMAN "gpa-fileman"
-#define GPA_STOCK_CLIPBOARD "gpa-clipboard"
-#define GPA_STOCK_CARDMAN "gpa-cardman"
+#define GPA_STOCK_KEYMAN        "gpa-keyring"
+#define GPA_STOCK_KEYMAN_SIMPLE "gpa-keyringeditor"
+#define GPA_STOCK_FILEMAN       "gpa-fileman"
+#define GPA_STOCK_CLIPBOARD     "gpa-clipboard"
+#define GPA_STOCK_CARDMAN       "gpa-cardman"
 
-/* Toolbar in keyring editor.  */
-#define GPA_STOCK_BRIEF "gpa-brief"
+/* Toolbar in key manager.  */
+#define GPA_STOCK_BRIEF    "gpa-brief"
 #define GPA_STOCK_DETAILED "gpa-detailed"
-#define GPA_STOCK_EDIT "gpa-edit"
-#define GPA_STOCK_IMPORT "gpa-import"
-#define GPA_STOCK_EXPORT "gpa-export"
-#define GPA_STOCK_BACKUP "gpa-backup"
+#define GPA_STOCK_EDIT     "gpa-edit"
+#define GPA_STOCK_IMPORT   "gpa-import"
+#define GPA_STOCK_EXPORT   "gpa-export"
+#define GPA_STOCK_BACKUP   "gpa-backup"
 
 #define GPA_STOCK_SECRET_CARDKEY "gpa-secret-cardkey"
 #define GPA_STOCK_SECRET_KEY "gpa-secret-key"

Copied: trunk/src/keymanager.c (from rev 989, trunk/src/keyring.c)
===================================================================
--- trunk/src/keyring.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/keymanager.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -0,0 +1,1494 @@
+/* keymanager.c  -  The Key Manager.
+ * Copyright (C) 2000, 2001 G-N-U GmbH.
+ * Copyright (C) 2005, 2008, 2009 g10 Code GmbH.
+ *
+ * This file is part of GPA.
+ *
+ * GPA is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>. 
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <gpgme.h>
+
+#include "gpa.h"
+#include "gtktools.h"
+#include "icons.h"
+#include "helpmenu.h"
+#include "gpawidgets.h"
+#include "ownertrustdlg.h"
+#include "keysigndlg.h"
+#include "keygendlg.h"
+#include "keygenwizard.h"
+#include "keyeditdlg.h"
+#include "keydeletedlg.h"
+#include "keylist.h"
+#include "siglist.h"
+#include "gpgmetools.h"
+#include "gpgmeedit.h"
+#include "keytable.h"
+#include "server-access.h"
+#include "options.h"
+#include "convert.h"
+
+#include "gpasubkeylist.h"
+
+#include "gpakeydeleteop.h"
+#include "gpakeysignop.h"
+#include "gpakeytrustop.h"
+
+#include "gpaexportfileop.h"
+#include "gpaexportclipop.h"
+#include "gpaexportserverop.h"
+
+#include "gpaimportfileop.h"
+#include "gpaimportclipop.h"
+#include "gpaimportserverop.h"
+
+#include "gpabackupop.h"
+
+#include "gpagenkeyadvop.h"
+#include "gpagenkeysimpleop.h"
+
+#include "gpa-key-details.h"
+
+#include "keymanager.h"
+
+
+#if ! GTK_CHECK_VERSION (2, 10, 0)
+#define GTK_STOCK_SELECT_ALL "gtk-select-all"
+#endif
+
+
+/* Object's class definition.  */
+struct _GpaKeyManagerClass 
+{
+  GtkWindowClass parent_class;
+};
+
+
+/* Object definition.  */
+struct _GpaKeyManager
+{
+  GtkWindow parent_instance;
+
+  /* The central list of keys.  */
+  GpaKeyList *keylist;
+
+  /* The "Show Ownertrust" toggle button.  */
+  GtkWidget *toggle_show;
+
+  /* The details widget.  */
+  GtkWidget *details;
+
+  /* Idle handler id for updates of the details widget.  Will be
+     nonzero whenever a handler is currently set and zero
+     otherwise.  */
+  guint details_idle_id;
+  
+  /* Labels in the status bar.  */
+  GtkWidget *status_label;
+  GtkWidget *status_key_user;
+  GtkWidget *status_key_id;
+
+  /* The popup menu.  */
+  GtkWidget *popup_menu;
+
+  /* List of sensitive widgets.  See below.  */
+  GList *selection_sensitive_actions;
+
+  /* The currently selected key.  */
+  gpgme_key_t current_key;
+
+  /* Context used for retrieving the current key.  */
+  GpaContext *ctx;
+
+  /* Hack: warn the selection callback to ignore changes. Don't, ever,
+     assign a value directly.  Raise and lower it with increments.  */
+  int freeze_selection;
+};
+
+
+/* There is only one instance of the card manager class.  Use a global
+   variable to keep track of it.  */
+static GpaKeyManager *this_instance;
+
+
+/* Prototype of a sensitivity callback.  Return TRUE if the widget
+   should be sensitive, FALSE otherwise.  The parameter is a pointer
+   to the instance.  */
+typedef gboolean (*sensitivity_func_t) (gpointer);
+
+
+/* Local prototypes */
+static int idle_update_details (gpointer param);
+static void keyring_update_details (GpaKeyManager *self);
+
+static void gpa_key_manager_finalize (GObject *object);
+
+
+
+/************************************************************ 
+ *******************   Implementation   *********************
+ ************************************************************/
+
+/* A simple sensitivity callback mechanism.
+
+   The basic idea is that buttons (and other widgets like menu items
+   as well) should know when they should be sensitive or not.  The
+   implementation here is very simple and quite specific for the
+   key manager's needs.
+  
+   We maintain a list of sensitive widgets each of which has a
+   sensitivity callback associated with them as the "gpa_sensitivity"
+   data.  The callback returns TRUE when the widget should be
+   sensitive and FALSE otherwise.
+  
+   Whenever the selection in the key list widget changes we call
+   update_selection_sensitive_actions which iterates through the
+   widgets in the list, calls the sensitivity callback and changes the
+   widget's sensitivity accordingly.  */
+
+
+/* Add widget to the list of sensitive widgets of editor.  */
+static void
+add_selection_sensitive_action (GpaKeyManager *self,
+                                GtkAction *action,
+                                sensitivity_func_t callback)
+{
+  g_object_set_data (G_OBJECT (action), "gpa_sensitivity", callback);
+  self->selection_sensitive_actions
+    = g_list_append (self->selection_sensitive_actions, action);
+}
+
+
+/* Update the sensitivity of the widget data and pass param through to
+   the sensitivity callback.  Usable as iterator function in
+   g_list_foreach.  */
+static void
+update_selection_sensitive_action (gpointer data, gpointer param)
+{
+  sensitivity_func_t func;
+
+  func = g_object_get_data (G_OBJECT (data), "gpa_sensitivity");
+  gtk_action_set_sensitive (GTK_ACTION (data), func (param));
+}
+
+
+/* Call update_selection_sensitive_widget for all widgets in the list
+   of sensitive widgets and pass self through as the user data
+   parameter.  */
+static void
+update_selection_sensitive_actions (GpaKeyManager *self)
+{
+  g_list_foreach (self->selection_sensitive_actions,
+                  update_selection_sensitive_action, self);
+}
+
+/* Disable all the widgets in the list of sensitive widgets.  To be used while
+   the selection changes.  */
+static void
+disable_selection_sensitive_actions (GpaKeyManager *self)
+{
+  GList *cur;
+  
+  cur = self->selection_sensitive_actions;
+  while (cur)
+    {
+      gtk_action_set_sensitive (GTK_ACTION (cur->data), FALSE);
+      cur = g_list_next (cur);
+    }
+}
+
+
+
+/* Helper functions to cope with selections.  */
+
+/* Return TRUE if the key list widget of the key manager has at
+   least one selected item.  Usable as a sensitivity callback.  */
+static gboolean
+key_manager_has_selection (gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  return gpa_keylist_has_selection (self->keylist);
+}
+
+
+/* Return TRUE if the key list widget of the key manager has
+   exactly one selected item.  Usable as a sensitivity callback.  */
+static gboolean
+key_manager_has_single_selection (gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  return gpa_keylist_has_single_selection (self->keylist);
+}
+
+/* Return TRUE if the key list widget of the key manager has
+   exactly one selected OpenPGP item.  Usable as a sensitivity
+   callback.  */
+static gboolean
+key_manager_has_single_selection_OpenPGP (gpointer param)
+{
+  GpaKeyManager *self = param;
+  int result = 0;
+
+  if (gpa_keylist_has_single_selection (self->keylist))
+    {
+      gpgme_key_t key = gpa_keylist_get_selected_key (self->keylist);
+      if (key && key->protocol == GPGME_PROTOCOL_OpenPGP)
+        result = 1;
+      gpgme_key_unref (key);
+    }
+
+  return result;
+}
+
+/* Return TRUE if the key list widget of the key manager has
+   exactly one selected item and it is a private key.  Usable as a
+   sensitivity callback.  */
+static gboolean
+key_manager_has_private_selected (gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  return gpa_keylist_has_single_secret_selection 
+    (GPA_KEYLIST(self->keylist));
+}
+
+
+/* Return the the currently selected key. NULL if no key is selected.  */
+static gpgme_key_t
+key_manager_current_key (GpaKeyManager *self)
+{
+  return self->current_key;
+}
+
+
+
+/* Action callbacks.  */
+
+
+static void
+gpa_key_manager_changed_wot_cb (gpointer data)
+{
+  GpaKeyManager *self = data;
+  gpa_keylist_start_reload (self->keylist);  
+}
+
+
+static void
+gpa_key_manager_changed_wot_secret_cb (gpointer data)
+{
+  GpaKeyManager *self = data;
+
+  gpa_keylist_imported_secret_key (self->keylist);
+  gpa_keylist_start_reload (self->keylist);  
+}
+
+static void
+gpa_key_manager_key_modified (GpaKeyEditDialog *dialog, gpgme_key_t key,
+				 gpointer data)
+{
+  GpaKeyManager *self = data;
+  gpa_keylist_start_reload (self->keylist);  
+}
+
+
+static void
+gpa_key_manager_new_key_cb (gpointer data, const gchar *fpr)
+{
+  GpaKeyManager *self = data;
+  
+  gpa_keylist_new_key (GPA_KEYLIST (self->keylist), fpr);
+
+  gpa_options_update_default_key (gpa_options_get_instance ());
+}
+
+
+static void
+register_key_operation (GpaKeyManager *self, GpaKeyOperation *op)
+{
+  g_signal_connect_swapped (G_OBJECT (op), "changed_wot",
+			    G_CALLBACK (gpa_key_manager_changed_wot_cb),
+			    self);
+  g_signal_connect (G_OBJECT (op), "completed",
+		    G_CALLBACK (g_object_unref), self); 
+}
+
+
+static void
+register_import_operation (GpaKeyManager *self, GpaImportOperation *op)
+{
+  g_signal_connect_swapped (G_OBJECT (op), "imported_keys",
+			    G_CALLBACK (gpa_key_manager_changed_wot_cb),
+			    self);
+  g_signal_connect_swapped 
+    (G_OBJECT (op), "imported_secret_keys",
+     G_CALLBACK (gpa_key_manager_changed_wot_secret_cb),
+     self);
+  g_signal_connect (G_OBJECT (op), "completed",
+		    G_CALLBACK (g_object_unref), self); 
+}
+
+
+static void
+register_generate_operation (GpaKeyManager *self, GpaGenKeyOperation *op)
+{
+  g_signal_connect_swapped (G_OBJECT (op), "generated_key",
+			    G_CALLBACK (gpa_key_manager_new_key_cb),
+			    self);
+  g_signal_connect (G_OBJECT (op), "completed",
+		    G_CALLBACK (g_object_unref), self); 
+}
+
+
+static void
+register_operation (GpaKeyManager *self, GpaOperation *op)
+{
+  g_signal_connect (G_OBJECT (op), "completed",
+		    G_CALLBACK (g_object_unref), self); 
+}
+
+
+/* delete the selected keys */
+static void
+key_manager_delete (GtkAction *action, GpaKeyManager *self)
+{
+  GList *selection = gpa_keylist_get_selected_keys (self->keylist);
+  GpaKeyDeleteOperation *op = gpa_key_delete_operation_new (GTK_WIDGET (self),
+							    selection);
+  register_key_operation (self, GPA_KEY_OPERATION (op));
+}
+
+
+/* Return true if the public key key has been signed by the key with
+   the id key_id, otherwise return FALSE.  */
+static gboolean
+key_has_been_signed (const gpgme_key_t key, 
+		     const gpgme_key_t signer_key)
+{
+  gboolean uid_signed, key_signed;
+  const char *signer_id;
+  gpgme_key_sig_t sig;
+  gpgme_user_id_t uid;
+
+  signer_id = signer_key->subkeys->keyid;
+  /* We consider the key signed if all user IDs have been signed.  */
+  key_signed = TRUE;
+  for (uid = key->uids; key_signed && uid; uid = uid->next)
+    {
+      uid_signed = FALSE;
+      for (sig = uid->signatures; !uid_signed && sig; sig = sig->next)
+	if (g_str_equal (signer_id, sig->keyid))
+	  uid_signed = TRUE;
+      key_signed = key_signed && uid_signed;
+    }
+  
+  return key_signed;
+}
+
+
+/* Return true if the key sign button should be sensitive, i.e. if
+   there is at least one selected key and there is a default key.  */
+static gboolean
+key_manager_can_sign (gpointer param)
+{
+  gboolean result = FALSE;
+  gpgme_key_t default_key;
+
+  default_key = gpa_options_get_default_key (gpa_options_get_instance ());
+
+  if (default_key && key_manager_has_single_selection (param))
+    {
+      /* The most important requirements have been met, now check if
+	 the selected key was already signed with the default key.  */
+      GpaKeyManager *self = param;
+      gpgme_key_t key = key_manager_current_key (self);
+      result = ! key_has_been_signed (key, default_key);
+    }
+  else if (default_key && key_manager_has_selection (param))
+    /* Always allow signing many keys at once.  */
+    result = TRUE;
+  return result;
+}
+
+
+/* sign the selected keys */
+static void
+key_manager_sign (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GList *selection;
+  GpaKeySignOperation *op;
+
+  if (! gpa_keylist_has_selection (self->keylist))
+    {
+      /* This shouldn't happen because the button should be grayed out
+	 in this case.  */
+      gpa_window_error (_("No keys selected for signing."), GTK_WIDGET (self));
+      return;
+    }
+
+  selection = gpa_keylist_get_selected_keys (self->keylist);
+  op = gpa_key_sign_operation_new (GTK_WIDGET (self), selection);
+  register_key_operation (self, GPA_KEY_OPERATION (op));
+}
+
+/* Invoke the "edit key" dialog.  */
+static void
+key_manager_edit (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  gpgme_key_t key;
+  GtkWidget *dialog;
+
+  if (! key_manager_has_private_selected (self))
+    return;
+  key = key_manager_current_key (self);
+  if (! key)
+    return;
+
+  dialog = gpa_key_edit_dialog_new (GTK_WIDGET (self), key);
+  gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+      
+  g_signal_connect (G_OBJECT (dialog), "key_modified",
+		    G_CALLBACK (gpa_key_manager_key_modified), self);
+  gtk_widget_show_all (dialog);
+}
+
+
+static void
+key_manager_trust (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GList *selection;
+  GpaKeyTrustOperation *op;
+
+  /* FIXME: Key trust operation currently does not support more than
+     one key at a time.  */
+  if (! key_manager_has_single_selection (self))
+    return;
+
+  selection = gpa_keylist_get_selected_keys (self->keylist);
+  op = gpa_key_trust_operation_new (GTK_WIDGET (self), selection);
+  register_key_operation (self, GPA_KEY_OPERATION (op));
+}
+
+
+/* Import keys.  */
+static void
+key_manager_import (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GpaImportFileOperation *op;
+
+  op = gpa_import_file_operation_new (GTK_WIDGET (self));
+  register_import_operation (self, GPA_IMPORT_OPERATION (op));
+}
+
+
+/* Export the selected keys to a file.  */
+static void
+key_manager_export (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GList *selection;
+  GpaExportFileOperation *op;
+
+  selection = gpa_keylist_get_selected_keys (self->keylist);
+  if (! selection)
+    return;
+
+  op = gpa_export_file_operation_new (GTK_WIDGET (self), selection);
+  register_operation (self, GPA_OPERATION (op));
+}
+
+
+/* Import a key from the keyserver.  */
+static void
+key_manager_retrieve (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GpaImportServerOperation *op;
+
+  op = gpa_import_server_operation_new (GTK_WIDGET (self));
+  register_import_operation (self, GPA_IMPORT_OPERATION (op));
+}
+
+
+/* Send a key to the keyserver.  */
+static void
+key_manager_send (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GList *selection;
+  GpaExportServerOperation *op;
+
+  /* FIXME: The export-to-server operation currently only supports
+     exporting one key at a time.  */
+  if (! key_manager_has_single_selection (self))
+    return;
+
+  selection = gpa_keylist_get_selected_keys (self->keylist);
+  op = gpa_export_server_operation_new (GTK_WIDGET (self), selection);
+  register_operation (self, GPA_OPERATION (op));
+}
+
+
+/* Backup the default keys.  */
+static void
+key_manager_backup (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  gpgme_key_t key;
+  GpaBackupOperation *op;
+
+  if (! key_manager_has_private_selected (self))
+    return;
+  key = key_manager_current_key (self);
+  if (! key)
+    return;
+
+  op = gpa_backup_operation_new (GTK_WIDGET (self), key);
+  register_operation (self, GPA_OPERATION (op));
+}
+
+
+/* Run the advanced key generation dialog and if the user clicked OK,
+   generate a new key pair and update the key list.  */
+static void
+key_manager_generate_key_advanced (gpointer param)
+{
+  GpaKeyManager *self = param;
+  GpaGenKeyAdvancedOperation *op;
+
+  op = gpa_gen_key_advanced_operation_new (GTK_WIDGET (self));
+  register_generate_operation (self, GPA_GEN_KEY_OPERATION (op));
+}
+
+
+/* Call the key generation wizard and update the key list if necessary */
+static void
+key_manager_generate_key_simple (gpointer param)
+{
+  GpaKeyManager *self = param;
+  GpaGenKeySimpleOperation *op;
+
+  op = gpa_gen_key_simple_operation_new (GTK_WIDGET (self));
+  register_generate_operation (self, GPA_GEN_KEY_OPERATION (op));
+}
+
+
+/* Generate a key.  */
+static void
+key_manager_generate_key (GtkAction *action, gpointer param)
+{
+  if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
+    key_manager_generate_key_simple (param);
+  else
+    key_manager_generate_key_advanced (param);
+}
+
+
+/* Update everything that has to be updated when the selection in the
+   key list changes.  */
+static void
+keyring_selection_update_actions (GpaKeyManager *self)
+{
+  update_selection_sensitive_actions (self);
+  keyring_update_details (self);
+}  
+
+
+/* Callback for key listings invoked with the "next_key" signal.  Used
+   to receive and set the new current key.  */
+static void
+key_manager_key_listed (GpaContext *ctx, gpgme_key_t key, gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  gpgme_key_unref (self->current_key);
+  self->current_key = key;
+
+  keyring_selection_update_actions (self);
+}
+
+
+/* FIXME: CHECK! Signal handler for selection changes. */
+static void
+key_manager_selection_changed (GtkTreeSelection *treeselection, 
+				  gpointer param)
+{
+  GpaKeyManager *self = param;
+  
+  /* Some other piece of the keyring wants us to ignore this signal.  */
+  if (self->freeze_selection)
+    return;
+
+  /* Update the current key.  */
+  if (self->current_key)
+    {
+      /* Remove the previous one.  */
+      gpgme_key_unref (self->current_key);
+      self->current_key = NULL;
+    }
+
+  /* Abort retrieval of the current key.  */
+  if (gpa_context_busy (self->ctx))
+    gpgme_op_keylist_end (self->ctx->ctx);
+
+  /* Load the new one.  */
+  if (gpa_keylist_has_single_selection (self->keylist)) 
+    {
+      gpg_error_t err;
+      GList *selection;
+      gpgme_key_t key;
+      int old_mode;
+
+      selection = gpa_keylist_get_selected_keys (self->keylist);
+      key = (gpgme_key_t) selection->data;
+      old_mode = gpgme_get_keylist_mode (self->ctx->ctx);
+
+      /* With all the signatures and validating for the sake of X.509.
+         Note that we should not save and restore the old protocol
+         because the protocol should not be changed before the
+         gpgme_op_keylist_end.  Saving and restoring the keylist mode
+         is okay. */
+      gpgme_set_keylist_mode (self->ctx->ctx, 
+			      (old_mode 
+                               | GPGME_KEYLIST_MODE_SIGS
+                               | GPGME_KEYLIST_MODE_VALIDATE));
+      gpgme_set_protocol (self->ctx->ctx, key->protocol);
+      err = gpgme_op_keylist_start (self->ctx->ctx, key->subkeys->fpr, 
+				    FALSE);
+      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+	gpa_gpgme_warning (err);
+
+      gpgme_set_keylist_mode (self->ctx->ctx, old_mode);
+      g_list_free (selection);
+
+      /* Make sure the actions that depend on a current key are
+	 disabled.  */
+      disable_selection_sensitive_actions (self);
+    }
+  else
+    keyring_selection_update_actions (self);
+}
+
+
+/* FIXME:  CHECK THIS!
+   Signal handler for the map signal.  If the simplified_ui flag is
+   set and there's no private key in the key ring, ask the user
+   whether he wants to generate a key.  If so, call
+   key_manager_generate_key which runs the appropriate dialog.
+   Also, if the simplified_ui flag is set, remind the user if he has
+   not yet created a backup copy of his private key.  */
+static void
+key_manager_mapped (gpointer param)
+{
+  static gboolean asked_about_key_generation = FALSE;
+  static gboolean asked_about_key_backup = FALSE;
+  GpaKeyManager *self = param;
+
+  if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
+    {
+      /* FIXME: We assume that the only reason a user might not have a
+         default key is because he has no private keys.  */
+      if (! asked_about_key_generation
+          && ! gpa_options_get_default_key (gpa_options_get_instance()))
+        {
+	  GtkWidget *dialog;
+	  GtkResponseType response;
+
+	  dialog = gtk_message_dialog_new (GTK_WINDOW (GTK_WIDGET (self)),
+					   GTK_DIALOG_MODAL,
+					   GTK_MESSAGE_QUESTION,
+					   GTK_BUTTONS_NONE,
+					   _("You do not have a private key "
+					     "yet. Do you want to generate "
+					     "one now (recommended) or do it"
+					     " later?"));
+	  gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Generate key now"),
+				  GTK_RESPONSE_OK, _("Do it _later"),
+				  GTK_RESPONSE_CANCEL, NULL);
+	  response = gtk_dialog_run (GTK_DIALOG (dialog));
+	  gtk_widget_destroy (dialog);
+          if (response == GTK_RESPONSE_OK)
+	    key_manager_generate_key (NULL, param);
+	  asked_about_key_generation = TRUE;
+        }
+      else if (!asked_about_key_backup
+               && !gpa_options_get_backup_generated 
+	       (gpa_options_get_instance ())
+               && !gpa_options_get_default_key (gpa_options_get_instance()))
+        {
+	  GtkWidget *dialog;
+	  GtkResponseType response;
+
+	  dialog = gtk_message_dialog_new (GTK_WINDOW (GTK_WIDGET (self)),
+					   GTK_DIALOG_MODAL,
+					   GTK_MESSAGE_QUESTION,
+					   GTK_BUTTONS_NONE,
+					   _("You do not have a backup copy of"
+					     " your private key yet."
+					     " Do you want to backup your key "
+					     "now (recommended) or do it "
+					     "later?"));
+	  gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Backup key now"),
+				  GTK_RESPONSE_OK, _("Do it _later"),
+				  GTK_RESPONSE_CANCEL, NULL);
+	  response = gtk_dialog_run (GTK_DIALOG (dialog));
+	  gtk_widget_destroy (dialog);
+          if (response == GTK_RESPONSE_OK)
+	    {
+	      GpaBackupOperation *op = gpa_backup_operation_new 
+		(GTK_WIDGET (self), gpa_options_get_default_key 
+		 (gpa_options_get_instance ()));
+	      register_operation (self, GPA_OPERATION (op));
+	    }
+          asked_about_key_backup = TRUE;
+        }
+    }
+}
+
+
+/* Close the key manager.  */
+static void
+key_manager_close (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  gtk_widget_destroy (GTK_WIDGET (self));
+}
+
+
+/* select all keys in the keyring */
+static void
+key_manager_select_all (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GtkTreeSelection *selection;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->keylist));
+  gtk_tree_selection_select_all (selection);
+}
+
+
+/* Paste the clipboard into the keyring.  */
+static void
+key_manager_paste (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GpaImportClipboardOperation *op;
+
+  op = gpa_import_clipboard_operation_new (GTK_WIDGET (self));
+  register_import_operation (self, GPA_IMPORT_OPERATION (op));
+}
+
+
+/* Copy the keys into the clipboard.  */
+static void
+key_manager_copy (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  GList *selection;
+  GpaExportClipboardOperation *op;
+
+  selection = gpa_keylist_get_selected_keys (self->keylist);
+  if (! selection)
+    return;
+
+  op = gpa_export_clipboard_operation_new (GTK_WIDGET (self), selection);
+  register_operation (self, GPA_OPERATION (op));
+}
+
+
+/* Reload the key list.  */
+static void
+key_manager_refresh (GtkAction *action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  
+  gpa_keylist_start_reload (self->keylist);
+}
+
+
+static void
+keyring_set_listing_cb (GtkAction *action,
+			GtkRadioAction *current_action, gpointer param)
+{
+  GpaKeyManager *self = param;
+  gint detailed;
+
+  detailed = gtk_radio_action_get_current_value
+    (GTK_RADIO_ACTION (current_action));
+
+  if (detailed)
+    {
+      gpa_keylist_set_detailed (self->keylist);
+      gpa_options_set_detailed_view (gpa_options_get_instance (), TRUE);
+    }
+  else
+    {
+      gpa_keylist_set_brief (self->keylist);
+      gpa_options_set_detailed_view (gpa_options_get_instance (), FALSE);
+    }
+}
+
+
+/* Create and return the menu bar for the key ring editor.  */
+static void
+key_manager_action_new (GpaKeyManager *self,
+			   GtkWidget **menu, GtkWidget **toolbar,
+			   GtkWidget **popup)
+{
+  static const GtkActionEntry entries[] =
+    {
+      /* Toplevel.  */
+      { "File", NULL, N_("_File"), NULL },
+      { "Edit", NULL, N_("_Edit"), NULL },
+      { "Keys", NULL, N_("_Keys"), NULL },
+      { "Server", NULL, N_("_Server"), NULL },
+
+      /* File menu.  */
+      { "FileClose", GTK_STOCK_CLOSE, NULL, NULL,
+	"FIXME", G_CALLBACK (key_manager_close) },
+      { "FileQuit", GTK_STOCK_QUIT, NULL, NULL,
+	N_("Quit the program"), G_CALLBACK (gtk_main_quit) },
+
+      /* Edit menu.  */
+      { "EditCopy", GTK_STOCK_COPY, NULL, NULL,
+	N_("Copy the selection"), G_CALLBACK (key_manager_copy) },
+      { "EditPaste", GTK_STOCK_PASTE, NULL, NULL,
+	N_("Paste the clipboard"), G_CALLBACK (key_manager_paste) },
+      { "EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, "<control>A",
+	N_("Select all certificates"),
+	G_CALLBACK (key_manager_select_all) },
+
+      /* Keys menu.  */
+      { "KeysRefresh", GTK_STOCK_REFRESH, NULL, NULL,
+	N_("Refresh the keyring"), G_CALLBACK (key_manager_refresh) },
+      { "KeysNew", GTK_STOCK_NEW, N_("_New key..."), NULL,
+	N_("Generate a new key"), G_CALLBACK (key_manager_generate_key) },
+      { "KeysDelete", GTK_STOCK_DELETE, N_("_Delete keys"), NULL,
+	N_("Remove the selected key"), G_CALLBACK (key_manager_delete) },
+      { "KeysSign", GPA_STOCK_SIGN, N_("_Sign Keys..."), NULL,
+	N_("Sign the selected key"), G_CALLBACK (key_manager_sign) },
+      { "KeysSetOwnerTrust", NULL, N_("Set _Owner Trust..."), NULL,
+	N_("Set owner trust of the selected key"),
+	G_CALLBACK (key_manager_trust) },
+      { "KeysEditPrivateKey", GPA_STOCK_EDIT, N_("_Edit Private Key..."), NULL,
+	N_("Edit the selected private key"),
+	G_CALLBACK (key_manager_edit) },
+      { "KeysImport", GPA_STOCK_IMPORT, N_("_Import Keys..."), NULL,
+	N_("Import Keys"), G_CALLBACK (key_manager_import) },
+      { "KeysExport", GPA_STOCK_EXPORT, N_("E_xport Keys..."), NULL,
+	N_("Export Keys"), G_CALLBACK (key_manager_export) },
+      { "KeysBackup", NULL, N_("_Backup..."), NULL,
+	N_("Backup key"), G_CALLBACK (key_manager_backup) },
+
+      /* Server menu.  */
+      { "ServerRetrieve", NULL, N_("_Retrieve Keys..."), NULL,
+	N_("Retrieve keys from server"),
+	G_CALLBACK (key_manager_retrieve) },
+      { "ServerSend", NULL, N_("_Send Keys..."), NULL,
+	N_("Send keys to server"), G_CALLBACK (key_manager_send) }
+    };
+
+  static const GtkRadioActionEntry radio_entries[] =
+    {
+      { "DetailsBrief", GPA_STOCK_BRIEF, NULL, NULL,
+	N_("Show Brief Keylist"), 0 },
+      { "DetailsDetailed", GPA_STOCK_DETAILED, NULL, NULL,
+	N_("Show Key Details"), 1 }
+    };
+
+  static const char *ui_description =
+    "<ui>"
+    "  <menubar name='MainMenu'>"
+    "    <menu action='File'>"
+    "      <menuitem action='FileClose'/>"
+    "      <menuitem action='FileQuit'/>"
+    "    </menu>"
+    "    <menu action='Edit'>"
+    "      <menuitem action='EditCopy'/>"
+    "      <menuitem action='EditPaste'/>"
+    "      <separator/>"
+    "      <menuitem action='EditSelectAll'/>"
+    "      <separator/>"
+    "      <menuitem action='EditPreferences'/>"
+    "      <menuitem action='EditBackendPreferences'/>"
+    "    </menu>"
+    "    <menu action='Keys'>"
+    "      <menuitem action='KeysRefresh'/>"
+    "      <separator/>"
+    "      <menuitem action='KeysNew'/>"
+    "      <menuitem action='KeysDelete'/>"
+    "      <separator/>"
+    "      <menuitem action='KeysSign'/>"
+    "      <menuitem action='KeysSetOwnerTrust'/>"
+    "      <menuitem action='KeysEditPrivateKey'/>"
+    "      <separator/>"
+    "      <menuitem action='KeysImport'/>"
+    "      <menuitem action='KeysExport'/>"
+    "      <menuitem action='KeysBackup'/>"
+    "    </menu>"
+    "    <menu action='Windows'>"
+    "      <menuitem action='WindowsKeyringEditor'/>"
+    "      <menuitem action='WindowsFileManager'/>"
+    "      <menuitem action='WindowsClipboard'/>"
+#ifdef BUILD_CARD_MANAGER
+    "      <menuitem action='WindowsCardManager'/>"
+#endif
+    "    </menu>"
+    "    <menu action='Server'>"
+    "      <menuitem action='ServerRetrieve'/>"
+    "      <menuitem action='ServerSend'/>"
+    "    </menu>"
+    "    <menu action='Help'>"
+#if 0
+    "      <menuitem action='HelpContents'/>"
+#endif
+    "      <menuitem action='HelpAbout'/>"
+    "    </menu>"
+    "  </menubar>"
+    "  <toolbar name='ToolBar'>"
+    "    <toolitem action='KeysEditPrivateKey'/>"
+    "    <toolitem action='KeysDelete'/>"
+    "    <toolitem action='KeysSign'/>"
+    "    <toolitem action='KeysImport'/>"
+    "    <toolitem action='KeysExport'/>"
+    "    <separator/>"
+    "    <toolitem action='DetailsBrief'/>"
+    "    <toolitem action='DetailsDetailed'/>"
+    "    <separator/>"
+    "    <toolitem action='EditPreferences'/>"
+    "    <separator/>"
+    "    <toolitem action='KeysRefresh'/>"
+    "    <separator/>"
+    "    <toolitem action='WindowsFileManager'/>"
+    "    <toolitem action='WindowsClipboard'/>"
+#ifdef BUILD_CARD_MANAGER
+    "    <toolitem action='WindowsCardManager'/>"
+#endif
+#if 0
+    "    <toolitem action='HelpContents'/>"
+#endif
+    "  </toolbar>"
+    "  <popup name='PopupMenu'>"
+    "    <menuitem action='EditCopy'/>"
+    "    <menuitem action='EditPaste'/>"
+    "    <menuitem action='KeysDelete'/>"
+    "    <separator/>"
+    "    <menuitem action='KeysSign'/>"
+    "    <menuitem action='KeysSetOwnerTrust'/>"
+    "    <menuitem action='KeysEditPrivateKey'/>"
+    "    <separator/>"
+    "    <menuitem action='KeysExport'/>"
+    "    <menuitem action='ServerSend'/>"
+    "    <menuitem action='KeysBackup'/>"
+    "  </popup>"
+    "</ui>";
+
+  GtkAccelGroup *accel_group;
+  GtkActionGroup *action_group;
+  GtkAction *action;
+  GtkUIManager *ui_manager;
+  GError *error;
+  int detailed;
+
+  detailed = gpa_options_get_detailed_view (gpa_options_get_instance());
+
+  action_group = gtk_action_group_new ("MenuActions");
+  gtk_action_group_set_translation_domain (action_group, PACKAGE);
+  gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries),
+				self);
+  gtk_action_group_add_radio_actions (action_group, radio_entries,
+				      G_N_ELEMENTS (radio_entries),
+				      detailed ? 1 : 0,
+				      G_CALLBACK (keyring_set_listing_cb),
+				      self);
+  gtk_action_group_add_actions (action_group, gpa_help_menu_action_entries,
+				G_N_ELEMENTS (gpa_help_menu_action_entries),
+				GTK_WIDGET (self));
+  gtk_action_group_add_actions (action_group, gpa_windows_menu_action_entries,
+				G_N_ELEMENTS (gpa_windows_menu_action_entries),
+				GTK_WIDGET (self));
+  gtk_action_group_add_actions
+    (action_group, gpa_preferences_menu_action_entries,
+     G_N_ELEMENTS (gpa_preferences_menu_action_entries), GTK_WIDGET (self));
+  ui_manager = gtk_ui_manager_new ();
+  gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+  accel_group = gtk_ui_manager_get_accel_group (ui_manager);
+  gtk_window_add_accel_group (GTK_WINDOW (GTK_WIDGET (self)), accel_group);
+  if (! gtk_ui_manager_add_ui_from_string (ui_manager, ui_description,
+					   -1, &error))
+    {
+      g_message ("building keyring menus failed: %s", error->message);
+      g_error_free (error);
+      exit (EXIT_FAILURE);
+    }
+
+  /* Fixup the icon theme labels which are too long for the toolbar.  */
+  action = gtk_action_group_get_action (action_group, "KeysEditPrivateKey");
+  g_object_set (action, "short_label", _("Edit"), NULL);
+  action = gtk_action_group_get_action (action_group, "KeysDelete");
+  g_object_set (action, "short_label", _("Delete"), NULL);
+  action = gtk_action_group_get_action (action_group, "KeysSign");
+  g_object_set (action, "short_label", _("Sign"), NULL);
+  action = gtk_action_group_get_action (action_group, "KeysExport");
+  g_object_set (action, "short_label", _("Export"), NULL);
+  action = gtk_action_group_get_action (action_group, "KeysImport");
+  g_object_set (action, "short_label", _("Import"), NULL);
+  action = gtk_action_group_get_action (action_group, "WindowsFileManager");
+  g_object_set (action, "short_label", _("Files"), NULL);
+#ifdef BUILD_CARD_MANAGER
+  action = gtk_action_group_get_action (action_group, "WindowsCardManager");
+  g_object_set (action, "short_label", _("Card"), NULL);
+#endif
+
+  /* Take care of sensitiveness of widgets.  */
+  action = gtk_action_group_get_action (action_group, "EditCopy");
+  add_selection_sensitive_action (self, action,
+                                  key_manager_has_selection);
+  action = gtk_action_group_get_action (action_group, "KeysDelete");
+  add_selection_sensitive_action (self, action,
+                                  key_manager_has_selection);
+  action = gtk_action_group_get_action (action_group, "KeysExport");
+  add_selection_sensitive_action (self, action,
+                                  key_manager_has_selection);
+
+  action = gtk_action_group_get_action (action_group, "ServerSend");
+  add_selection_sensitive_action (self, action,
+				  key_manager_has_single_selection);
+
+  action = gtk_action_group_get_action (action_group, "KeysSetOwnerTrust");
+  add_selection_sensitive_action (self, action,
+				  key_manager_has_single_selection_OpenPGP);
+
+  action = gtk_action_group_get_action (action_group, "KeysSign");
+  add_selection_sensitive_action (self, action,
+				  key_manager_can_sign);
+
+  action = gtk_action_group_get_action (action_group, "KeysEditPrivateKey");
+  add_selection_sensitive_action (self, action,
+                                  key_manager_has_private_selected);
+  action = gtk_action_group_get_action (action_group, "KeysBackup");
+  add_selection_sensitive_action (self, action,
+                                  key_manager_has_private_selected);
+
+  *menu = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
+  *toolbar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar");
+  gpa_toolbar_set_homogeneous (GTK_TOOLBAR (*toolbar), FALSE);
+
+  *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu");
+}
+
+
+/* Update the details widget according to the current selection.  This
+   means that if there is exactly one key selected, display its
+   properties in the pages, otherwise show the number of currently
+   selected keys.  */
+static int
+idle_update_details (gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  if (gpa_keylist_has_single_selection (self->keylist))
+    {
+      gpgme_key_t key = key_manager_current_key (self);
+      if (! key)
+	{
+	  /* There is a single key selected, but the current key is
+	     NULL.  This means the key has not been returned yet, so
+	     we exit the function asking GTK to run it again when
+	     there is time.  */
+	  return TRUE;
+	}
+      gpa_key_details_update (self->details, key, 1);
+    }
+  else
+    {
+      GList *selection = gpa_keylist_get_selected_keys (self->keylist);
+      gpa_key_details_update (self->details, NULL,
+                              g_list_length (selection));
+      g_list_free (selection);
+    }
+
+  /* Set the idle id to NULL to indicate that the idle handler has
+     been run.  */
+  self->details_idle_id = 0;
+  
+  /* Return false to indicate that this function shouldn't be called
+     again by GTK, only when we expicitly add it again.  */
+  return FALSE;
+}
+
+
+/* Add an idle handler to update the details, but only when none has
+   been set yet.  */
+static void
+keyring_update_details (GpaKeyManager *self)
+{
+  if (! self->details_idle_id)
+    self->details_idle_id = g_idle_add (idle_update_details, self);
+}
+
+
+
+/* Status bar handling.  */
+static GtkWidget *
+keyring_statusbar_new (GpaKeyManager *self)
+{
+  GtkWidget *hbox;
+  GtkWidget *label;
+
+  hbox = gtk_hbox_new (FALSE, 0);
+
+  label = gtk_label_new ("");
+  self->status_label = label;
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+  label = gtk_label_new ("");
+  self->status_key_id = label;
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 5);
+
+  label = gtk_label_new ("");
+  self->status_key_user = label;
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+  
+  return hbox;
+}
+
+
+/* Update the status bar.  */
+static void
+keyring_update_status_bar (GpaKeyManager *self)
+{
+  gpgme_key_t key = gpa_options_get_default_key (gpa_options_get_instance ());
+
+  if (key)
+    {
+      gchar *string;
+
+      gtk_label_set_text (GTK_LABEL (self->status_label),
+			  _("Selected default key:"));
+      string = gpa_gpgme_key_get_userid (key->uids);
+      gtk_label_set_text (GTK_LABEL (self->status_key_user), string);
+      g_free (string);
+      gtk_label_set_text (GTK_LABEL (self->status_key_id),
+                          gpa_gpgme_key_get_short_keyid (key));
+    }
+  else
+    {
+      gtk_label_set_text (GTK_LABEL (self->status_label),
+			  _("No default key selected in the preferences."));
+      gtk_label_set_text (GTK_LABEL (self->status_key_user), "");
+      gtk_label_set_text (GTK_LABEL (self->status_key_id), "");
+    }     
+}
+
+
+// FIXME: Check.
+/* The context menu of the keyring list.  This is the callback for the
+   "button_press_event" signal.  */
+static gint
+display_popup_menu (GpaKeyManager *self, GdkEvent *event, GpaKeyList *list)
+{
+  GtkMenu *menu;
+  GdkEventButton *event_button;
+
+  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (event != NULL, FALSE);
+  
+  menu = GTK_MENU (self->popup_menu);
+  
+  if (event->type == GDK_BUTTON_PRESS)
+    {
+      event_button = (GdkEventButton *) event;
+      if (event_button->button == 3)
+	{
+	  GtkTreeSelection *selection = 
+	    gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+	  GtkTreePath *path;
+	  GtkTreeIter iter;
+          /* Make sure the clicked key is selected.  */
+	  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (list), 
+					     event_button->x,
+					     event_button->y, 
+					     &path, NULL,
+					     NULL, NULL))
+	    {
+	      gtk_tree_model_get_iter (gtk_tree_view_get_model 
+				       (GTK_TREE_VIEW(list)), &iter, path);
+	      if (! gtk_tree_selection_iter_is_selected (selection, &iter))
+		{
+		  /* Block selection updates.  */
+		  self->freeze_selection++;
+		  gtk_tree_selection_unselect_all (selection);
+		  self->freeze_selection--;
+		  gtk_tree_selection_select_path (selection, path);
+		}
+	      gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 
+			      event_button->button, event_button->time);
+	    }
+	  return TRUE;
+	}
+    }
+
+  return FALSE;
+}
+
+
+/* Signal handler for the "changed_default_key" signal.  */
+static void
+keyring_default_key_changed (GpaOptions *options, gpointer param)
+{
+  GpaKeyManager *self = param;
+
+  /* Update the status bar and the selection sensitive widgets because
+     some depend on the default key.  */
+  keyring_update_status_bar (self);
+  update_selection_sensitive_actions (self);
+}
+
+
+/* Create all the widgets of this window.  */
+static void
+construct_widgets (GpaKeyManager *self)
+{
+  GtkWidget *vbox;
+  GtkWidget *label;
+  GtkWidget *scrolled;
+  GtkWidget *keylist;
+  GtkWidget *menubar;
+  GtkWidget *toolbar;
+  GtkWidget *hbox;
+  GtkWidget *icon;
+  GtkWidget *paned;
+  GtkWidget *statusbar;
+  GtkWidget *main_box;
+  GtkWidget *align;
+  gchar *markup;
+  guint pt, pb, pl, pr;
+
+  gtk_window_set_title (GTK_WINDOW (self),
+                        _("GNU Privacy Assistant - Key Manager"));
+  gtk_window_set_default_size (GTK_WINDOW (self), 680, 600);
+
+
+  g_signal_connect_swapped (G_OBJECT (self), "map",
+			    G_CALLBACK (key_manager_mapped), self);
+
+
+  vbox = gtk_vbox_new (FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (self), vbox);
+
+  /* FIXME: Check next line.  */
+  key_manager_action_new (self, &menubar, &toolbar, &self->popup_menu);
+
+  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
+
+  /* Add a fancy label that tells us: This is the key manager.  */
+  /* FIXME: We should have a common function for this.  */
+  hbox = gtk_hbox_new (FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
+  
+  icon = gtk_image_new_from_stock (GPA_STOCK_KEYMAN_SIMPLE,
+                                   GTK_ICON_SIZE_DND);
+  gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, TRUE, 0);
+
+  label = gtk_label_new (NULL);
+  markup = g_strdup_printf ("<span font_desc=\"16\">%s</span>",
+                            _("Key Manager"));
+  gtk_label_set_markup (GTK_LABEL (label), markup);
+  g_free (markup);
+
+  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 10);
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+
+
+  paned = gtk_vpaned_new ();
+
+  main_box = gtk_hbox_new (TRUE, 0);
+  align = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_alignment_get_padding (GTK_ALIGNMENT (align), &pt, &pb, &pl, &pr);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (align), pt, pb + 5,
+                             pl + 5, pr + 5);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (main_box), paned, TRUE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (align), main_box);
+
+  scrolled = gtk_scrolled_window_new (NULL, NULL);
+  gtk_paned_pack1 (GTK_PANED (paned), scrolled, TRUE, TRUE);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
+  /* FIXME: Which shadow type - get it from a global resource?  */
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
+				       GTK_SHADOW_IN);
+
+  keylist = gpa_keylist_new (GTK_WIDGET (self));
+  self->keylist = GPA_KEYLIST (keylist);
+  if (gpa_options_get_detailed_view (gpa_options_get_instance()))
+    gpa_keylist_set_detailed (self->keylist);
+  else
+    gpa_keylist_set_brief (self->keylist);
+
+  gtk_container_add (GTK_CONTAINER (scrolled), keylist);
+
+  g_signal_connect (G_OBJECT (gtk_tree_view_get_selection 
+			      (GTK_TREE_VIEW (keylist))),
+		    "changed", G_CALLBACK (key_manager_selection_changed),
+		    self);
+
+  g_signal_connect_swapped (G_OBJECT (keylist), "button_press_event",
+                            G_CALLBACK (display_popup_menu), self);
+
+  self->details = gpa_key_details_new ();
+  gtk_paned_pack2 (GTK_PANED (paned), self->details, TRUE, TRUE);
+  gtk_paned_set_position (GTK_PANED (paned), 250);
+
+  statusbar = keyring_statusbar_new (self);
+  gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, TRUE, 0);
+  g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
+		    "changed_default_key",
+                    G_CALLBACK (keyring_default_key_changed), self);
+
+  keyring_update_status_bar (self);
+  update_selection_sensitive_actions (self);
+  keyring_update_details (self);
+
+  self->current_key = NULL;
+  self->ctx = gpa_context_new ();
+  self->freeze_selection = 0;
+
+  g_signal_connect (G_OBJECT (self->ctx), "next_key",
+		    G_CALLBACK (key_manager_key_listed), self);
+
+}
+
+
+/* Callback for the "destroy" signal.  */
+static void
+gpa_key_manager_closed (GtkWidget *widget, gpointer param)
+{
+  this_instance = NULL;
+}
+
+
+
+/************************************************************ 
+ ******************   Object Management  ********************
+ ************************************************************/
+
+static void
+gpa_key_manager_class_init (void *class_ptr, void *class_data)
+{
+  GpaKeyManagerClass *klass = class_ptr;
+
+  G_OBJECT_CLASS (klass)->finalize = gpa_key_manager_finalize;
+}
+
+
+static void
+gpa_key_manager_init (GTypeInstance *instance, void *class_ptr)
+{
+  GpaKeyManager *self = GPA_KEY_MANAGER (instance);
+
+  construct_widgets (self);
+
+  g_signal_connect (self, "destroy",
+                    G_CALLBACK (gpa_key_manager_closed), self);
+
+}
+
+
+static void
+gpa_key_manager_finalize (GObject *object)
+{  
+  GpaKeyManager *self = GPA_KEY_MANAGER (object);
+
+  g_list_free (self->selection_sensitive_actions);
+  self->selection_sensitive_actions = NULL;
+
+  G_OBJECT_CLASS (g_type_class_peek_parent 
+                  (GPA_KEY_MANAGER_GET_CLASS (self)))->finalize (object);
+}
+
+
+GType
+gpa_key_manager_get_type (void)
+{
+  static GType this_type = 0;
+  
+  if (!this_type)
+    {
+      static const GTypeInfo this_info =
+	{
+	  sizeof (GpaKeyManagerClass),
+	  (GBaseInitFunc) NULL,
+	  (GBaseFinalizeFunc) NULL,
+	  gpa_key_manager_class_init,
+	  NULL, /* class_finalize */
+	  NULL, /* class_data */
+	  sizeof (GpaKeyManager),
+	  0,    /* n_preallocs */
+	  gpa_key_manager_init,
+	};
+      
+      this_type = g_type_register_static (GTK_TYPE_WINDOW,
+                                          "GpaKeyManager",
+                                          &this_info, 0);
+    }
+  
+  return this_type;
+}
+
+
+/************************************************************ 
+ **********************  Public API  ************************
+ ************************************************************/
+
+/* Return the instance of the the key manager.  If a new instance has
+   been created, TRUE is stored at R_CREATED, otherwise FALSE.  */
+GtkWidget *
+gpa_key_manager_get_instance (gboolean *r_created)
+{
+  if (r_created)
+    *r_created = !this_instance;
+  if (!this_instance)
+    {
+      this_instance = g_object_new (GPA_KEY_MANAGER_TYPE, NULL);  
+      //FIXME      load_all_keys (this_instance);
+    }
+  return GTK_WIDGET (this_instance);
+}
+
+
+gboolean 
+gpa_key_manager_is_open (void)
+{
+  return !!this_instance;
+}


Property changes on: trunk/src/keymanager.c
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/keymanager.h (from rev 989, trunk/src/keyring.h)
===================================================================
--- trunk/src/keyring.h	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/keymanager.h	2009-05-05 17:59:47 UTC (rev 990)
@@ -0,0 +1,56 @@
+/* keymanager.h  -  The Key Manager
+ * Copyright (C) 2009 g10 Code GmbH.
+ *
+ * This file is part of GPA
+ *
+ * GPA is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA 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 General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef KEYMANAGER_H
+#define KEYMANAGER_H
+
+/* Declare the Object. */
+typedef struct _GpaKeyManager GpaKeyManager;
+typedef struct _GpaKeyManagerClass GpaKeyManagerClass;
+
+GType gpa_key_manager_get_type (void) G_GNUC_CONST;
+
+#define GPA_KEY_MANAGER_TYPE	  (gpa_key_manager_get_type ())
+
+#define GPA_KEY_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPA_KEY_MANAGER_TYPE, GpaKeyManager))
+
+#define GPA_KEY_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass),  \
+                            GPA_KEY_MANAGER_TYPE, GpaKeyManagerClass))
+
+#define GPA_IS_KEY_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPA_KEY_MANAGER_TYPE))
+
+#define GPA_IS_KEY_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), GPA_KEY_MANAGER_TYPE))
+
+#define GPA_KEY_MANAGER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj),    \
+                              GPA_KEY_MANAGER_TYPE, GpaKeyManagerClass))
+
+
+/* The public API.  */
+
+GtkWidget *gpa_key_manager_get_instance (gboolean *r_created);
+
+gboolean gpa_key_manager_is_open (void);
+
+
+#endif /*KEYMANAGER_H*/


Property changes on: trunk/src/keymanager.h
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/keyring.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -1,1387 +0,0 @@
-/* keyring.c - The GNU Privacy Assistant keyring.
-   Copyright (C) 2000, 2001 G-N-U GmbH.
-   Copyright (C) 2005, 2008 g10 Code GmbH.
-
-   This file is part of GPA.
-
-   GPA is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   GPA 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-#include <gpgme.h>
-
-#include "gpa.h"
-#include "gtktools.h"
-#include "icons.h"
-#include "helpmenu.h"
-#include "gpawidgets.h"
-#include "ownertrustdlg.h"
-#include "keysigndlg.h"
-#include "keygendlg.h"
-#include "keygenwizard.h"
-#include "keyeditdlg.h"
-#include "keydeletedlg.h"
-#include "keylist.h"
-#include "siglist.h"
-#include "keyring.h"
-#include "gpgmetools.h"
-#include "gpgmeedit.h"
-#include "keytable.h"
-#include "server-access.h"
-#include "options.h"
-#include "convert.h"
-
-#include "gpasubkeylist.h"
-
-#include "gpakeydeleteop.h"
-#include "gpakeysignop.h"
-#include "gpakeytrustop.h"
-
-#include "gpaexportfileop.h"
-#include "gpaexportclipop.h"
-#include "gpaexportserverop.h"
-
-#include "gpaimportfileop.h"
-#include "gpaimportclipop.h"
-#include "gpaimportserverop.h"
-
-#include "gpabackupop.h"
-
-#include "gpagenkeyadvop.h"
-#include "gpagenkeysimpleop.h"
-
-#include "gpa-key-details.h"
-
-
-#if ! GTK_CHECK_VERSION (2, 10, 0)
-#define GTK_STOCK_SELECT_ALL "gtk-select-all"
-#endif
-
-
-/* The public keyring editor.  */
-
-/* Struct passed to all signal handlers of the keyring editor as user
-   data.  */
-struct _GPAKeyringEditor
-{
-  /* The toplevel window of the editor.  */
-  GtkWidget *window;
-
-  /* The central list of keys.  */
-  GpaKeyList *keylist;
-
-  /* The "Show Ownertrust" toggle button.  */
-  GtkWidget *toggle_show;
-
-  /* The details widget.  */
-  GtkWidget *details;
-
-  /* Idle handler id for updates of the details widget.  Will be
-     nonzero whenever a handler is currently set and zero
-     otherwise.  */
-  guint details_idle_id;
-  
-  /* Labels in the status bar.  */
-  GtkWidget *status_label;
-  GtkWidget *status_key_user;
-  GtkWidget *status_key_id;
-
-  /* The popup menu.  */
-  GtkWidget *popup_menu;
-
-  /* List of sensitive widgets.  See below.  */
-  GList *selection_sensitive_actions;
-
-  /* The currently selected key.  */
-  gpgme_key_t current_key;
-
-  /* Context used for retrieving the current key.  */
-  GpaContext *ctx;
-
-  /* Hack: warn the selection callback to ignore changes. Don't, ever,
-     assign a value directly.  Raise and lower it with increments.  */
-  int freeze_selection;
-};
-
-typedef struct _GPAKeyringEditor GPAKeyringEditor;
-
-
-/* Internal API.  */
-
-/* Forward declarations.  */
-static int idle_update_details (gpointer param);
-static void keyring_update_details (GPAKeyringEditor *editor);
-
-
-/* A simple sensitivity callback mechanism.
-
-   The basic idea is that buttons (and other widgets like menu items
-   as well) should know when they should be sensitive or not.  The
-   implementation here is very simple and quite specific for the
-   keyring editor's needs.
-  
-   We maintain a list of sensitive widgets each of which has a
-   sensitivity callback associated with them as the "gpa_sensitivity"
-   data.  The callback returns TRUE when the widget should be
-   sensitive and FALSE otherwise.
-  
-   Whenever the selection in the key list widget changes we call
-   update_selection_sensitive_actions which iterates through the
-   widgets in the list, calls the sensitivity callback and changes the
-   widget's sensitivity accordingly.  */
-
-/* Prototype of a sensitivity callback.  Return TRUE if the widget
-   should be senstitive, FALSE otherwise.  The parameter is a pointer
-   to the GPAKeyringEditor struct.  */
-typedef gboolean (*SensitivityFunc) (gpointer);
-
-
-/* Add widget to the list of sensitive widgets of editor.  */
-static void
-add_selection_sensitive_action (GPAKeyringEditor *editor,
-                                GtkAction *action,
-                                SensitivityFunc callback)
-{
-  g_object_set_data (G_OBJECT (action), "gpa_sensitivity", callback);
-  editor->selection_sensitive_actions
-    = g_list_append (editor->selection_sensitive_actions, action);
-}
-
-
-/* Update the sensitivity of the widget data and pass param through to
-   the sensitivity callback.  Usable as iterator function in
-   g_list_foreach.  */
-static void
-update_selection_sensitive_action (gpointer data, gpointer param)
-{
-  SensitivityFunc func;
-
-  func = g_object_get_data (G_OBJECT (data), "gpa_sensitivity");
-  gtk_action_set_sensitive (GTK_ACTION (data), func (param));
-}
-
-
-/* Call update_selection_sensitive_widget for all widgets in the list
-   of sensitive widgets and pass editor through as the user data
-   parameter.  */
-static void
-update_selection_sensitive_actions (GPAKeyringEditor *editor)
-{
-  g_list_foreach (editor->selection_sensitive_actions,
-                  update_selection_sensitive_action, editor);
-}
-
-/* Disable all the widgets in the list of sensitive widgets.  To be used while
-   the selection changes.  */
-static void
-disable_selection_sensitive_actions (GPAKeyringEditor *editor)
-{
-  GList *cur;
-  
-  cur = editor->selection_sensitive_actions;
-  while (cur)
-    {
-      gtk_action_set_sensitive (GTK_ACTION (cur->data), FALSE);
-      cur = g_list_next (cur);
-    }
-}
-
-
-/* Return TRUE if the key list widget of the keyring editor has at
-   least one selected item.  Usable as a sensitivity callback.  */
-static gboolean
-keyring_editor_has_selection (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  return gpa_keylist_has_selection (editor->keylist);
-}
-
-
-/* Return TRUE if the key list widget of the keyring editor has
-   exactly one selected item.  Usable as a sensitivity callback.  */
-static gboolean
-keyring_editor_has_single_selection (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  return gpa_keylist_has_single_selection (editor->keylist);
-}
-
-/* Return TRUE if the key list widget of the keyring editor has
-   exactly one selected OpenPGP item.  Usable as a sensitivity
-   callback.  */
-static gboolean
-keyring_editor_has_single_selection_OpenPGP (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  int result = 0;
-
-  if (gpa_keylist_has_single_selection (editor->keylist))
-    {
-      gpgme_key_t key = gpa_keylist_get_selected_key (editor->keylist);
-      if (key && key->protocol == GPGME_PROTOCOL_OpenPGP)
-        result = 1;
-      gpgme_key_unref (key);
-    }
-
-  return result;
-}
-
-/* Return TRUE if the key list widget of the keyring editor has
-   exactly one selected item and it is a private key.  Usable as a
-   sensitivity callback.  */
-static gboolean
-keyring_editor_has_private_selected (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  return gpa_keylist_has_single_secret_selection 
-    (GPA_KEYLIST(editor->keylist));
-}
-
-
-/* Return the the currently selected key. NULL if no key is selected.  */
-static gpgme_key_t
-keyring_editor_current_key (GPAKeyringEditor *editor)
-{
-  return editor->current_key;
-}
-
-
-/* Operations.  */
-
-static void
-gpa_keyring_editor_changed_wot_cb (gpointer data)
-{
-  GPAKeyringEditor *editor = data;
-  gpa_keylist_start_reload (editor->keylist);  
-}
-
-
-static void
-gpa_keyring_editor_changed_wot_secret_cb (gpointer data)
-{
-  GPAKeyringEditor *editor = data;
-
-  gpa_keylist_imported_secret_key (editor->keylist);
-  gpa_keylist_start_reload (editor->keylist);  
-}
-
-static void
-gpa_keyring_editor_key_modified (GpaKeyEditDialog *dialog, gpgme_key_t key,
-				 gpointer data)
-{
-  GPAKeyringEditor *editor = data;
-  gpa_keylist_start_reload (editor->keylist);  
-}
-
-
-static void
-gpa_keyring_editor_new_key_cb (gpointer data, const gchar *fpr)
-{
-  GPAKeyringEditor *editor = data;
-  
-  gpa_keylist_new_key (GPA_KEYLIST (editor->keylist), fpr);
-
-  gpa_options_update_default_key (gpa_options_get_instance ());
-}
-
-
-static void
-register_key_operation (GPAKeyringEditor *editor, GpaKeyOperation *op)
-{
-  g_signal_connect_swapped (G_OBJECT (op), "changed_wot",
-			    G_CALLBACK (gpa_keyring_editor_changed_wot_cb),
-			    editor);
-  g_signal_connect (G_OBJECT (op), "completed",
-		    G_CALLBACK (g_object_unref), editor); 
-}
-
-
-static void
-register_import_operation (GPAKeyringEditor *editor, GpaImportOperation *op)
-{
-  g_signal_connect_swapped (G_OBJECT (op), "imported_keys",
-			    G_CALLBACK (gpa_keyring_editor_changed_wot_cb),
-			    editor);
-  g_signal_connect_swapped 
-    (G_OBJECT (op), "imported_secret_keys",
-     G_CALLBACK (gpa_keyring_editor_changed_wot_secret_cb),
-     editor);
-  g_signal_connect (G_OBJECT (op), "completed",
-		    G_CALLBACK (g_object_unref), editor); 
-}
-
-
-static void
-register_generate_operation (GPAKeyringEditor *editor, GpaGenKeyOperation *op)
-{
-  g_signal_connect_swapped (G_OBJECT (op), "generated_key",
-			    G_CALLBACK (gpa_keyring_editor_new_key_cb),
-			    editor);
-  g_signal_connect (G_OBJECT (op), "completed",
-		    G_CALLBACK (g_object_unref), editor); 
-}
-
-
-static void
-register_operation (GPAKeyringEditor *editor, GpaOperation *op)
-{
-  g_signal_connect (G_OBJECT (op), "completed",
-		    G_CALLBACK (g_object_unref), editor); 
-}
-
-
-/* delete the selected keys */
-static void
-keyring_editor_delete (GtkAction *action, GPAKeyringEditor *editor)
-{
-  GList *selection = gpa_keylist_get_selected_keys (editor->keylist);
-  GpaKeyDeleteOperation *op = gpa_key_delete_operation_new (editor->window,
-							    selection);
-  register_key_operation (editor, GPA_KEY_OPERATION (op));
-}
-
-
-/* Return true if the public key key has been signed by the key with
-   the id key_id, otherwise return FALSE.  */
-static gboolean
-key_has_been_signed (const gpgme_key_t key, 
-		     const gpgme_key_t signer_key)
-{
-  gboolean uid_signed, key_signed;
-  const char *signer_id;
-  gpgme_key_sig_t sig;
-  gpgme_user_id_t uid;
-
-  signer_id = signer_key->subkeys->keyid;
-  /* We consider the key signed if all user IDs have been signed.  */
-  key_signed = TRUE;
-  for (uid = key->uids; key_signed && uid; uid = uid->next)
-    {
-      uid_signed = FALSE;
-      for (sig = uid->signatures; !uid_signed && sig; sig = sig->next)
-	if (g_str_equal (signer_id, sig->keyid))
-	  uid_signed = TRUE;
-      key_signed = key_signed && uid_signed;
-    }
-  
-  return key_signed;
-}
-
-
-/* Return true if the key sign button should be sensitive, i.e. if
-   there is at least one selected key and there is a default key.  */
-static gboolean
-keyring_editor_can_sign (gpointer param)
-{
-  gboolean result = FALSE;
-  gpgme_key_t default_key;
-
-  default_key = gpa_options_get_default_key (gpa_options_get_instance ());
-
-  if (default_key && keyring_editor_has_single_selection (param))
-    {
-      /* The most important requirements have been met, now check if
-	 the selected key was already signed with the default key.  */
-      GPAKeyringEditor *editor = param;
-      gpgme_key_t key = keyring_editor_current_key (editor);
-      result = ! key_has_been_signed (key, default_key);
-    }
-  else if (default_key && keyring_editor_has_selection (param))
-    /* Always allow signing many keys at once.  */
-    result = TRUE;
-  return result;
-}
-
-
-/* sign the selected keys */
-static void
-keyring_editor_sign (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GList *selection;
-  GpaKeySignOperation *op;
-
-  if (! gpa_keylist_has_selection (editor->keylist))
-    {
-      /* This shouldn't happen because the button should be grayed out
-	 in this case.  */
-      gpa_window_error (_("No keys selected for signing."), editor->window);
-      return;
-    }
-
-  selection = gpa_keylist_get_selected_keys (editor->keylist);
-  op = gpa_key_sign_operation_new (editor->window, selection);
-  register_key_operation (editor, GPA_KEY_OPERATION (op));
-}
-
-/* Invoke the "edit key" dialog.  */
-static void
-keyring_editor_edit (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  gpgme_key_t key;
-  GtkWidget *dialog;
-
-  if (! keyring_editor_has_private_selected (editor))
-    return;
-  key = keyring_editor_current_key (editor);
-  if (! key)
-    return;
-
-  dialog = gpa_key_edit_dialog_new (editor->window, key);
-  gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
-      
-  g_signal_connect (G_OBJECT (dialog), "key_modified",
-		    G_CALLBACK (gpa_keyring_editor_key_modified), editor);
-  gtk_widget_show_all (dialog);
-}
-
-
-static void
-keyring_editor_trust (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GList *selection;
-  GpaKeyTrustOperation *op;
-
-  /* FIXME: Key trust operation currently does not support more than
-     one key at a time.  */
-  if (! keyring_editor_has_single_selection (editor))
-    return;
-
-  selection = gpa_keylist_get_selected_keys (editor->keylist);
-  op = gpa_key_trust_operation_new (editor->window, selection);
-  register_key_operation (editor, GPA_KEY_OPERATION (op));
-}
-
-
-/* Import keys.  */
-static void
-keyring_editor_import (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GpaImportFileOperation *op;
-
-  op = gpa_import_file_operation_new (editor->window);
-  register_import_operation (editor, GPA_IMPORT_OPERATION (op));
-}
-
-
-/* Export the selected keys to a file.  */
-static void
-keyring_editor_export (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GList *selection;
-  GpaExportFileOperation *op;
-
-  selection = gpa_keylist_get_selected_keys (editor->keylist);
-  if (! selection)
-    return;
-
-  op = gpa_export_file_operation_new (editor->window, selection);
-  register_operation (editor, GPA_OPERATION (op));
-}
-
-
-/* Import a key from the keyserver.  */
-static void
-keyring_editor_retrieve (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GpaImportServerOperation *op;
-
-  op = gpa_import_server_operation_new (editor->window);
-  register_import_operation (editor, GPA_IMPORT_OPERATION (op));
-}
-
-
-/* Send a key to the keyserver.  */
-static void
-keyring_editor_send (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GList *selection;
-  GpaExportServerOperation *op;
-
-  /* FIXME: The export-to-server operation currently only supports
-     exporting one key at a time.  */
-  if (! keyring_editor_has_single_selection (editor))
-    return;
-
-  selection = gpa_keylist_get_selected_keys (editor->keylist);
-  op = gpa_export_server_operation_new (editor->window, selection);
-  register_operation (editor, GPA_OPERATION (op));
-}
-
-
-/* Backup the default keys.  */
-static void
-keyring_editor_backup (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  gpgme_key_t key;
-  GpaBackupOperation *op;
-
-  if (! keyring_editor_has_private_selected (editor))
-    return;
-  key = keyring_editor_current_key (editor);
-  if (! key)
-    return;
-
-  op = gpa_backup_operation_new (editor->window, key);
-  register_operation (editor, GPA_OPERATION (op));
-}
-
-
-/* Run the advanced key generation dialog and if the user clicked OK,
-   generate a new key pair and update the key list.  */
-static void
-keyring_editor_generate_key_advanced (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GpaGenKeyAdvancedOperation *op;
-
-  op = gpa_gen_key_advanced_operation_new (editor->window);
-  register_generate_operation (editor, GPA_GEN_KEY_OPERATION (op));
-}
-
-
-/* Call the key generation wizard and update the key list if necessary */
-static void
-keyring_editor_generate_key_simple (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GpaGenKeySimpleOperation *op;
-
-  op = gpa_gen_key_simple_operation_new (editor->window);
-  register_generate_operation (editor, GPA_GEN_KEY_OPERATION (op));
-}
-
-
-/* Generate a key.  */
-static void
-keyring_editor_generate_key (GtkAction *action, gpointer param)
-{
-  if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
-    keyring_editor_generate_key_simple (param);
-  else
-    keyring_editor_generate_key_advanced (param);
-}
-
-
-/* Update everything that has to be updated when the selection in the
-   key list changes.  */
-static void
-keyring_selection_update_actions (GPAKeyringEditor *editor)
-{
-  update_selection_sensitive_actions (editor);
-  keyring_update_details (editor);
-}  
-
-
-/* Callback for key listings.  Used to receive and set the new current
-   key.  */
-static void
-keyring_editor_key_listed (GpaContext *ctx, gpgme_key_t key, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  if (editor->current_key)
-    gpgme_key_unref (editor->current_key);
-  editor->current_key = key;
-
-  keyring_selection_update_actions (editor);
-}
-
-
-/* Signal handler for selection changes.  */
-static void
-keyring_editor_selection_changed (GtkTreeSelection *treeselection, 
-				  gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  
-  /* Some other piece of the keyring wants us to ignore this signal.  */
-  if (editor->freeze_selection)
-    return;
-
-  /* Update the current key.  */
-  if (editor->current_key)
-    {
-      /* Remove the previous one.  */
-      gpgme_key_unref (editor->current_key);
-      editor->current_key = NULL;
-    }
-
-  /* Abort retrieval of the current key.  */
-  if (gpa_context_busy (editor->ctx))
-    gpgme_op_keylist_end (editor->ctx->ctx);
-
-  /* Load the new one.  */
-  if (gpa_keylist_has_single_selection (editor->keylist)) 
-    {
-      gpg_error_t err;
-      GList *selection;
-      gpgme_key_t key;
-      int old_mode;
-
-      selection = gpa_keylist_get_selected_keys (editor->keylist);
-      key = (gpgme_key_t) selection->data;
-      old_mode = gpgme_get_keylist_mode (editor->ctx->ctx);
-
-      /* With all the signatures and validating for the sake of X.509.
-         Note that we should not save and restore the old protocol
-         because the protocol should not be changed before the
-         gpgme_op_keylist_end.  Saving and restoring the keylist mode
-         is okay. */
-      gpgme_set_keylist_mode (editor->ctx->ctx, 
-			      (old_mode 
-                               | GPGME_KEYLIST_MODE_SIGS
-                               | GPGME_KEYLIST_MODE_VALIDATE));
-      gpgme_set_protocol (editor->ctx->ctx, key->protocol);
-      err = gpgme_op_keylist_start (editor->ctx->ctx, key->subkeys->fpr, 
-				    FALSE);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	gpa_gpgme_warning (err);
-
-      gpgme_set_keylist_mode (editor->ctx->ctx, old_mode);
-      g_list_free (selection);
-
-      /* Make sure the actions that depend on a current key are
-	 disabled.  */
-      disable_selection_sensitive_actions (editor);
-    }
-  else
-    keyring_selection_update_actions (editor);
-}
-
-/* Signal handler for the map signal.  If the simplified_ui flag is
-   set and there's no private key in the key ring, ask the user
-   whether he wants to generate a key.  If so, call
-   keyring_editor_generate_key which runs the appropriate dialog.
-   Also, if the simplified_ui flag is set, remind the user if he has
-   not yet created a backup copy of his private key.  */
-static void
-keyring_editor_mapped (gpointer param)
-{
-  static gboolean asked_about_key_generation = FALSE;
-  static gboolean asked_about_key_backup = FALSE;
-  GPAKeyringEditor *editor = param;
-
-  if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
-    {
-      /* FIXME: We assume that the only reason a user might not have a
-         default key is because he has no private keys.  */
-      if (! asked_about_key_generation
-          && ! gpa_options_get_default_key (gpa_options_get_instance()))
-        {
-	  GtkWidget *dialog;
-	  GtkResponseType response;
-
-	  dialog = gtk_message_dialog_new (GTK_WINDOW (editor->window),
-					   GTK_DIALOG_MODAL,
-					   GTK_MESSAGE_QUESTION,
-					   GTK_BUTTONS_NONE,
-					   _("You do not have a private key "
-					     "yet. Do you want to generate "
-					     "one now (recommended) or do it"
-					     " later?"));
-	  gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Generate key now"),
-				  GTK_RESPONSE_OK, _("Do it _later"),
-				  GTK_RESPONSE_CANCEL, NULL);
-	  response = gtk_dialog_run (GTK_DIALOG (dialog));
-	  gtk_widget_destroy (dialog);
-          if (response == GTK_RESPONSE_OK)
-	    keyring_editor_generate_key (NULL, param);
-	  asked_about_key_generation = TRUE;
-        }
-      else if (!asked_about_key_backup
-               && !gpa_options_get_backup_generated 
-	       (gpa_options_get_instance ())
-               && !gpa_options_get_default_key (gpa_options_get_instance()))
-        {
-	  GtkWidget *dialog;
-	  GtkResponseType response;
-
-	  dialog = gtk_message_dialog_new (GTK_WINDOW (editor->window),
-					   GTK_DIALOG_MODAL,
-					   GTK_MESSAGE_QUESTION,
-					   GTK_BUTTONS_NONE,
-					   _("You do not have a backup copy of"
-					     " your private key yet."
-					     " Do you want to backup your key "
-					     "now (recommended) or do it "
-					     "later?"));
-	  gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Backup key now"),
-				  GTK_RESPONSE_OK, _("Do it _later"),
-				  GTK_RESPONSE_CANCEL, NULL);
-	  response = gtk_dialog_run (GTK_DIALOG (dialog));
-	  gtk_widget_destroy (dialog);
-          if (response == GTK_RESPONSE_OK)
-	    {
-	      GpaBackupOperation *op = gpa_backup_operation_new 
-		(editor->window, gpa_options_get_default_key 
-		 (gpa_options_get_instance ()));
-	      register_operation (editor, GPA_OPERATION (op));
-	    }
-          asked_about_key_backup = TRUE;
-        }
-    }
-}
-
-
-/* Close the keyring editor.  */
-static void
-keyring_editor_close (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  gtk_widget_destroy (editor->window);
-}
-
-
-/* Free the data structures associated with the keyring editor.  */
-static void
-keyring_editor_destroy (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  g_list_free (editor->selection_sensitive_actions);
-  g_free (editor);
-}
-
-
-/* select all keys in the keyring */
-static void
-keyring_editor_select_all (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GtkTreeSelection *selection;
-
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->keylist));
-  gtk_tree_selection_select_all (selection);
-}
-
-
-/* Paste the clipboard into the keyring.  */
-static void
-keyring_editor_paste (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GpaImportClipboardOperation *op;
-
-  op = gpa_import_clipboard_operation_new (editor->window);
-  register_import_operation (editor, GPA_IMPORT_OPERATION (op));
-}
-
-
-/* Copy the keys into the clipboard.  */
-static void
-keyring_editor_copy (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  GList *selection;
-  GpaExportClipboardOperation *op;
-
-  selection = gpa_keylist_get_selected_keys (editor->keylist);
-  if (! selection)
-    return;
-
-  op = gpa_export_clipboard_operation_new (editor->window, selection);
-  register_operation (editor, GPA_OPERATION (op));
-}
-
-
-/* Reload the key list.  */
-static void
-keyring_editor_refresh (GtkAction *action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  
-  gpa_keylist_start_reload (editor->keylist);
-}
-
-
-static void
-keyring_set_listing_cb (GtkAction *action,
-			GtkRadioAction *current_action, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-  gint detailed;
-
-  detailed = gtk_radio_action_get_current_value
-    (GTK_RADIO_ACTION (current_action));
-
-  if (detailed)
-    {
-      gpa_keylist_set_detailed (editor->keylist);
-      gpa_options_set_detailed_view (gpa_options_get_instance (), TRUE);
-    }
-  else
-    {
-      gpa_keylist_set_brief (editor->keylist);
-      gpa_options_set_detailed_view (gpa_options_get_instance (), FALSE);
-    }
-}
-
-
-/* Create and return the menu bar for the key ring editor.  */
-static void
-keyring_editor_action_new (GPAKeyringEditor *editor,
-			   GtkWidget **menu, GtkWidget **toolbar,
-			   GtkWidget **popup)
-{
-  static const GtkActionEntry entries[] =
-    {
-      /* Toplevel.  */
-      { "File", NULL, N_("_File"), NULL },
-      { "Edit", NULL, N_("_Edit"), NULL },
-      { "Keys", NULL, N_("_Keys"), NULL },
-      { "Server", NULL, N_("_Server"), NULL },
-
-      /* File menu.  */
-      { "FileClose", GTK_STOCK_CLOSE, NULL, NULL,
-	"FIXME", G_CALLBACK (keyring_editor_close) },
-      { "FileQuit", GTK_STOCK_QUIT, NULL, NULL,
-	N_("Quit the program"), G_CALLBACK (gtk_main_quit) },
-
-      /* Edit menu.  */
-      { "EditCopy", GTK_STOCK_COPY, NULL, NULL,
-	N_("Copy the selection"), G_CALLBACK (keyring_editor_copy) },
-      { "EditPaste", GTK_STOCK_PASTE, NULL, NULL,
-	N_("Paste the clipboard"), G_CALLBACK (keyring_editor_paste) },
-      { "EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, "<control>A",
-	N_("Select all certificates"),
-	G_CALLBACK (keyring_editor_select_all) },
-
-      /* Keys menu.  */
-      { "KeysRefresh", GTK_STOCK_REFRESH, NULL, NULL,
-	N_("Refresh the keyring"), G_CALLBACK (keyring_editor_refresh) },
-      { "KeysNew", GTK_STOCK_NEW, N_("_New key..."), NULL,
-	N_("Generate a new key"), G_CALLBACK (keyring_editor_generate_key) },
-      { "KeysDelete", GTK_STOCK_DELETE, N_("_Delete keys"), NULL,
-	N_("Remove the selected key"), G_CALLBACK (keyring_editor_delete) },
-      { "KeysSign", GPA_STOCK_SIGN, N_("_Sign Keys..."), NULL,
-	N_("Sign the selected key"), G_CALLBACK (keyring_editor_sign) },
-      { "KeysSetOwnerTrust", NULL, N_("Set _Owner Trust..."), NULL,
-	N_("Set owner trust of the selected key"),
-	G_CALLBACK (keyring_editor_trust) },
-      { "KeysEditPrivateKey", GPA_STOCK_EDIT, N_("_Edit Private Key..."), NULL,
-	N_("Edit the selected private key"),
-	G_CALLBACK (keyring_editor_edit) },
-      { "KeysImport", GPA_STOCK_IMPORT, N_("_Import Keys..."), NULL,
-	N_("Import Keys"), G_CALLBACK (keyring_editor_import) },
-      { "KeysExport", GPA_STOCK_EXPORT, N_("E_xport Keys..."), NULL,
-	N_("Export Keys"), G_CALLBACK (keyring_editor_export) },
-      { "KeysBackup", NULL, N_("_Backup..."), NULL,
-	N_("Backup key"), G_CALLBACK (keyring_editor_backup) },
-
-      /* Server menu.  */
-      { "ServerRetrieve", NULL, N_("_Retrieve Keys..."), NULL,
-	N_("Retrieve keys from server"),
-	G_CALLBACK (keyring_editor_retrieve) },
-      { "ServerSend", NULL, N_("_Send Keys..."), NULL,
-	N_("Send keys to server"), G_CALLBACK (keyring_editor_send) }
-    };
-
-  static const GtkRadioActionEntry radio_entries[] =
-    {
-      { "DetailsBrief", GPA_STOCK_BRIEF, NULL, NULL,
-	N_("Show Brief Keylist"), 0 },
-      { "DetailsDetailed", GPA_STOCK_DETAILED, NULL, NULL,
-	N_("Show Key Details"), 1 }
-    };
-
-  static const char *ui_description =
-    "<ui>"
-    "  <menubar name='MainMenu'>"
-    "    <menu action='File'>"
-    "      <menuitem action='FileClose'/>"
-    "      <menuitem action='FileQuit'/>"
-    "    </menu>"
-    "    <menu action='Edit'>"
-    "      <menuitem action='EditCopy'/>"
-    "      <menuitem action='EditPaste'/>"
-    "      <separator/>"
-    "      <menuitem action='EditSelectAll'/>"
-    "      <separator/>"
-    "      <menuitem action='EditPreferences'/>"
-    "      <menuitem action='EditBackendPreferences'/>"
-    "    </menu>"
-    "    <menu action='Keys'>"
-    "      <menuitem action='KeysRefresh'/>"
-    "      <separator/>"
-    "      <menuitem action='KeysNew'/>"
-    "      <menuitem action='KeysDelete'/>"
-    "      <separator/>"
-    "      <menuitem action='KeysSign'/>"
-    "      <menuitem action='KeysSetOwnerTrust'/>"
-    "      <menuitem action='KeysEditPrivateKey'/>"
-    "      <separator/>"
-    "      <menuitem action='KeysImport'/>"
-    "      <menuitem action='KeysExport'/>"
-    "      <menuitem action='KeysBackup'/>"
-    "    </menu>"
-    "    <menu action='Windows'>"
-    "      <menuitem action='WindowsKeyringEditor'/>"
-    "      <menuitem action='WindowsFileManager'/>"
-    "      <menuitem action='WindowsClipboard'/>"
-#ifdef BUILD_CARD_MANAGER
-    "      <menuitem action='WindowsCardManager'/>"
-#endif
-    "    </menu>"
-    "    <menu action='Server'>"
-    "      <menuitem action='ServerRetrieve'/>"
-    "      <menuitem action='ServerSend'/>"
-    "    </menu>"
-    "    <menu action='Help'>"
-#if 0
-    "      <menuitem action='HelpContents'/>"
-#endif
-    "      <menuitem action='HelpAbout'/>"
-    "    </menu>"
-    "  </menubar>"
-    "  <toolbar name='ToolBar'>"
-    "    <toolitem action='KeysEditPrivateKey'/>"
-    "    <toolitem action='KeysDelete'/>"
-    "    <toolitem action='KeysSign'/>"
-    "    <toolitem action='KeysImport'/>"
-    "    <toolitem action='KeysExport'/>"
-    "    <separator/>"
-    "    <toolitem action='DetailsBrief'/>"
-    "    <toolitem action='DetailsDetailed'/>"
-    "    <separator/>"
-    "    <toolitem action='EditPreferences'/>"
-    "    <separator/>"
-    "    <toolitem action='KeysRefresh'/>"
-    "    <separator/>"
-    "    <toolitem action='WindowsFileManager'/>"
-    "    <toolitem action='WindowsClipboard'/>"
-#ifdef BUILD_CARD_MANAGER
-    "    <toolitem action='WindowsCardManager'/>"
-#endif
-#if 0
-    "    <toolitem action='HelpContents'/>"
-#endif
-    "  </toolbar>"
-    "  <popup name='PopupMenu'>"
-    "    <menuitem action='EditCopy'/>"
-    "    <menuitem action='EditPaste'/>"
-    "    <menuitem action='KeysDelete'/>"
-    "    <separator/>"
-    "    <menuitem action='KeysSign'/>"
-    "    <menuitem action='KeysSetOwnerTrust'/>"
-    "    <menuitem action='KeysEditPrivateKey'/>"
-    "    <separator/>"
-    "    <menuitem action='KeysExport'/>"
-    "    <menuitem action='ServerSend'/>"
-    "    <menuitem action='KeysBackup'/>"
-    "  </popup>"
-    "</ui>";
-
-  GtkAccelGroup *accel_group;
-  GtkActionGroup *action_group;
-  GtkAction *action;
-  GtkUIManager *ui_manager;
-  GError *error;
-  int detailed;
-
-  detailed = gpa_options_get_detailed_view (gpa_options_get_instance());
-
-  action_group = gtk_action_group_new ("MenuActions");
-  gtk_action_group_set_translation_domain (action_group, PACKAGE);
-  gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries),
-				editor);
-  gtk_action_group_add_radio_actions (action_group, radio_entries,
-				      G_N_ELEMENTS (radio_entries),
-				      detailed ? 1 : 0,
-				      G_CALLBACK (keyring_set_listing_cb),
-				      editor);
-  gtk_action_group_add_actions (action_group, gpa_help_menu_action_entries,
-				G_N_ELEMENTS (gpa_help_menu_action_entries),
-				editor->window);
-  gtk_action_group_add_actions (action_group, gpa_windows_menu_action_entries,
-				G_N_ELEMENTS (gpa_windows_menu_action_entries),
-				editor->window);
-  gtk_action_group_add_actions
-    (action_group, gpa_preferences_menu_action_entries,
-     G_N_ELEMENTS (gpa_preferences_menu_action_entries), editor->window);
-  ui_manager = gtk_ui_manager_new ();
-  gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-  accel_group = gtk_ui_manager_get_accel_group (ui_manager);
-  gtk_window_add_accel_group (GTK_WINDOW (editor->window), accel_group);
-  if (! gtk_ui_manager_add_ui_from_string (ui_manager, ui_description,
-					   -1, &error))
-    {
-      g_message ("building keyring menus failed: %s", error->message);
-      g_error_free (error);
-      exit (EXIT_FAILURE);
-    }
-
-  /* Fixup the icon theme labels which are too long for the toolbar.  */
-  action = gtk_action_group_get_action (action_group, "KeysEditPrivateKey");
-  g_object_set (action, "short_label", _("Edit"), NULL);
-  action = gtk_action_group_get_action (action_group, "KeysDelete");
-  g_object_set (action, "short_label", _("Delete"), NULL);
-  action = gtk_action_group_get_action (action_group, "KeysSign");
-  g_object_set (action, "short_label", _("Sign"), NULL);
-  action = gtk_action_group_get_action (action_group, "KeysExport");
-  g_object_set (action, "short_label", _("Export"), NULL);
-  action = gtk_action_group_get_action (action_group, "KeysImport");
-  g_object_set (action, "short_label", _("Import"), NULL);
-  action = gtk_action_group_get_action (action_group, "WindowsFileManager");
-  g_object_set (action, "short_label", _("Files"), NULL);
-#ifdef BUILD_CARD_MANAGER
-  action = gtk_action_group_get_action (action_group, "WindowsCardManager");
-  g_object_set (action, "short_label", _("Card"), NULL);
-#endif
-
-  /* Take care of sensitiveness of widgets.  */
-  action = gtk_action_group_get_action (action_group, "EditCopy");
-  add_selection_sensitive_action (editor, action,
-                                  keyring_editor_has_selection);
-  action = gtk_action_group_get_action (action_group, "KeysDelete");
-  add_selection_sensitive_action (editor, action,
-                                  keyring_editor_has_selection);
-  action = gtk_action_group_get_action (action_group, "KeysExport");
-  add_selection_sensitive_action (editor, action,
-                                  keyring_editor_has_selection);
-
-  action = gtk_action_group_get_action (action_group, "ServerSend");
-  add_selection_sensitive_action (editor, action,
-				  keyring_editor_has_single_selection);
-
-  action = gtk_action_group_get_action (action_group, "KeysSetOwnerTrust");
-  add_selection_sensitive_action (editor, action,
-				  keyring_editor_has_single_selection_OpenPGP);
-
-  action = gtk_action_group_get_action (action_group, "KeysSign");
-  add_selection_sensitive_action (editor, action,
-				  keyring_editor_can_sign);
-
-  action = gtk_action_group_get_action (action_group, "KeysEditPrivateKey");
-  add_selection_sensitive_action (editor, action,
-                                  keyring_editor_has_private_selected);
-  action = gtk_action_group_get_action (action_group, "KeysBackup");
-  add_selection_sensitive_action (editor, action,
-                                  keyring_editor_has_private_selected);
-
-  *menu = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
-  *toolbar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar");
-  gpa_toolbar_set_homogeneous (GTK_TOOLBAR (*toolbar), FALSE);
-
-  *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu");
-}
-
-
-/* Update the details widget according to the current selection.  This
-   means that if there is exactly one key selected, display its
-   properties in the pages, otherwise show the number of currently
-   selected keys.  */
-static int
-idle_update_details (gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  if (gpa_keylist_has_single_selection (editor->keylist))
-    {
-      gpgme_key_t key = keyring_editor_current_key (editor);
-      if (! key)
-	{
-	  /* There is a single key selected, but the current key is
-	     NULL.  This means the key has not been returned yet, so
-	     we exit the function asking GTK to run it again when
-	     there is time.  */
-	  return TRUE;
-	}
-      gpa_key_details_update (editor->details, key, 1);
-    }
-  else
-    {
-      GList *selection = gpa_keylist_get_selected_keys (editor->keylist);
-      gpa_key_details_update (editor->details, NULL,
-                              g_list_length (selection));
-      g_list_free (selection);
-    }
-
-  /* Set the idle id to NULL to indicate that the idle handler has
-     been run.  */
-  editor->details_idle_id = 0;
-  
-  /* Return false to indicate that this function shouldn't be called
-     again by GTK, only when we expicitly add it again.  */
-  return FALSE;
-}
-
-
-/* Add an idle handler to update the details, but only when none has
-   been set yet.  */
-static void
-keyring_update_details (GPAKeyringEditor *editor)
-{
-  if (! editor->details_idle_id)
-    editor->details_idle_id = g_idle_add (idle_update_details, editor);
-}
-
-
-
-/* Status bar handling.  */
-static GtkWidget *
-keyring_statusbar_new (GPAKeyringEditor *editor)
-{
-  GtkWidget *hbox;
-  GtkWidget *label;
-
-  hbox = gtk_hbox_new (FALSE, 0);
-
-  label = gtk_label_new ("");
-  editor->status_label = label;
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-  label = gtk_label_new ("");
-  editor->status_key_id = label;
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 5);
-
-  label = gtk_label_new ("");
-  editor->status_key_user = label;
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-  
-  return hbox;
-}
-
-
-/* Update the status bar.  */
-static void
-keyring_update_status_bar (GPAKeyringEditor *editor)
-{
-  gpgme_key_t key = gpa_options_get_default_key (gpa_options_get_instance ());
-
-  if (key)
-    {
-      gchar *string;
-
-      gtk_label_set_text (GTK_LABEL (editor->status_label),
-			  _("Selected default key:"));
-      string = gpa_gpgme_key_get_userid (key->uids);
-      gtk_label_set_text (GTK_LABEL (editor->status_key_user), string);
-      g_free (string);
-      gtk_label_set_text (GTK_LABEL (editor->status_key_id),
-                          gpa_gpgme_key_get_short_keyid (key));
-    }
-  else
-    {
-      gtk_label_set_text (GTK_LABEL (editor->status_label),
-			  _("No default key selected in the preferences."));
-      gtk_label_set_text (GTK_LABEL (editor->status_key_user), "");
-      gtk_label_set_text (GTK_LABEL (editor->status_key_id), "");
-    }     
-}
-
-
-/* The context menu of the keyring list.  */
-static gint
-display_popup_menu (GPAKeyringEditor *editor, GdkEvent *event, 
-		    GpaKeyList *list)
-{
-  GtkMenu *menu;
-  GdkEventButton *event_button;
-
-  g_return_val_if_fail (editor != NULL, FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-  
-  menu = GTK_MENU (editor->popup_menu);
-  
-  if (event->type == GDK_BUTTON_PRESS)
-    {
-      event_button = (GdkEventButton *) event;
-      if (event_button->button == 3)
-	{
-	  GtkTreeSelection *selection = 
-	    gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
-	  GtkTreePath *path;
-	  GtkTreeIter iter;
-          /* Make sure the clicked key is selected.  */
-	  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (list), 
-					     event_button->x,
-					     event_button->y, 
-					     &path, NULL,
-					     NULL, NULL))
-	    {
-	      gtk_tree_model_get_iter (gtk_tree_view_get_model 
-				       (GTK_TREE_VIEW(list)), &iter, path);
-	      if (! gtk_tree_selection_iter_is_selected (selection, &iter))
-		{
-		  /* Block selection updates.  */
-		  editor->freeze_selection++;
-		  gtk_tree_selection_unselect_all (selection);
-		  editor->freeze_selection--;
-		  gtk_tree_selection_select_path (selection, path);
-		}
-	      gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 
-			      event_button->button, event_button->time);
-	    }
-	  return TRUE;
-	}
-    }
-
-  return FALSE;
-}
-
-
-/* Signal handler for the "changed_default_key" signal.  */
-static void
-keyring_default_key_changed (GpaOptions *options, gpointer param)
-{
-  GPAKeyringEditor *editor = param;
-
-  /* Update the status bar and the selection sensitive widgets because
-     some depend on the default key.  */
-  keyring_update_status_bar (editor);
-  update_selection_sensitive_actions (editor);
-}
-
-
-/* Create and return a new keyring editor dialog.  The dialog is
-   hidden by default.  */
-GtkWidget *
-keyring_editor_new (void)
-{
-  GPAKeyringEditor *editor;
-  GtkWidget *window;
-  GtkWidget *vbox;
-  GtkWidget *label;
-  GtkWidget *scrolled;
-  GtkWidget *keylist;
-  GtkWidget *menubar;
-  GtkWidget *toolbar;
-  GtkWidget *hbox;
-  GtkWidget *icon;
-  GtkWidget *paned;
-  GtkWidget *statusbar;
-  GtkWidget *main_box;
-  GtkWidget *align;
-  gchar *markup;
-  guint pt, pb, pl, pr;
-
-  editor = g_malloc0 (sizeof (GPAKeyringEditor));
-
-  window = editor->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title (GTK_WINDOW (window),
-                        _("GNU Privacy Assistant - Keyring Editor"));
-  /* We use this for the destructor.  */
-  g_object_set_data_full (G_OBJECT (window), "user_data", editor,
-			  keyring_editor_destroy);
-  gtk_window_set_default_size (GTK_WINDOW (window), 680, 600);
-  g_signal_connect_swapped (G_OBJECT (window), "map",
-			    G_CALLBACK (keyring_editor_mapped), editor);
-  /* Realize the window so that we can create pixmaps without warnings.  */
-  gtk_widget_realize (window);
-
-  vbox = gtk_vbox_new (FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
-
-  keyring_editor_action_new (editor, &menubar, &toolbar,
-			     &editor->popup_menu);
-  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
-
-  /* Add a fancy label that tells us: This is the keyring editor.  */
-  hbox = gtk_hbox_new (FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-  
-  icon = gtk_image_new_from_stock (GPA_STOCK_KEYRING_EDITOR, GTK_ICON_SIZE_DND);
-  gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, TRUE, 0);
-
-  label = gtk_label_new (NULL);
-  markup = g_strdup_printf ("<span font_desc=\"16\">%s</span>",
-                            _("Keyring Editor"));
-  gtk_label_set_markup (GTK_LABEL (label), markup);
-  g_free (markup);
-  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 10);
-  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-
-  paned = gtk_vpaned_new ();
-
-  main_box = gtk_hbox_new (TRUE, 0);
-  align = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_alignment_get_padding (GTK_ALIGNMENT (align),
-                             &pt, &pb, &pl, &pr);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (align), pt, pb + 5,
-                             pl + 5, pr + 5);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (main_box), paned, TRUE, TRUE, 0);
-  gtk_container_add (GTK_CONTAINER (align), main_box);
-
-  scrolled = gtk_scrolled_window_new (NULL, NULL);
-  gtk_paned_pack1 (GTK_PANED (paned), scrolled, TRUE, TRUE);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
-                                  GTK_POLICY_AUTOMATIC,
-                                  GTK_POLICY_AUTOMATIC);
-  /* FIXME: Which shadow type?  */
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
-				       GTK_SHADOW_IN);
-  keylist = gpa_keylist_new (window);
-  editor->keylist = GPA_KEYLIST (keylist);
-  if (gpa_options_get_detailed_view (gpa_options_get_instance()))
-    gpa_keylist_set_detailed (editor->keylist);
-  else
-    gpa_keylist_set_brief (editor->keylist);
-
-  gtk_container_add (GTK_CONTAINER (scrolled), keylist);
-
-  g_signal_connect (G_OBJECT (gtk_tree_view_get_selection 
-			      (GTK_TREE_VIEW (keylist))),
-		    "changed", G_CALLBACK (keyring_editor_selection_changed),
-		    editor);
-
-  g_signal_connect_swapped (G_OBJECT (keylist), "button_press_event",
-                            G_CALLBACK (display_popup_menu), editor);
-
-  editor->details = gpa_key_details_new ();
-  gtk_paned_pack2 (GTK_PANED (paned), editor->details, TRUE, TRUE);
-  gtk_paned_set_position (GTK_PANED (paned), 250);
-
-  statusbar = keyring_statusbar_new (editor);
-  gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, TRUE, 0);
-  g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
-		    "changed_default_key",
-                    G_CALLBACK (keyring_default_key_changed), editor);
-
-  keyring_update_status_bar (editor);
-  update_selection_sensitive_actions (editor);
-  keyring_update_details (editor);
-
-  editor->current_key = NULL;
-  editor->ctx = gpa_context_new ();
-  editor->freeze_selection = 0;
-
-  g_signal_connect (G_OBJECT (editor->ctx), "next_key",
-		    G_CALLBACK (keyring_editor_key_listed), editor);
-
-  return window;
-}

Deleted: trunk/src/keyring.h
===================================================================
--- trunk/src/keyring.h	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/keyring.h	2009-05-05 17:59:47 UTC (rev 990)
@@ -1,28 +0,0 @@
-/* keyring.h  -  The GNU Privacy Assistant
-   Copyright (C) 2000 G-N-U GmbH.
-   Copyright (C) 2008 g10 Code GmbH.
-
-   This file is part of GPA.
-
-   GPA is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   GPA 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
-
-#ifndef KEYRINGEDITOR_H
-#define KEYRINGEDITOR_H
-
-/* Create and return a new keyring editor dialog.  The dialog is
-   hidden by default.  */
-GtkWidget *keyring_editor_new (void);
-
-#endif /* KEYRINGEDITOR_H */

Modified: trunk/src/server.c
===================================================================
--- trunk/src/server.c	2009-05-04 14:51:51 UTC (rev 989)
+++ trunk/src/server.c	2009-05-05 17:59:47 UTC (rev 990)
@@ -1146,7 +1146,7 @@
 static int
 cmd_start_keymanager (assuan_context_t ctx, char *line)
 {
-  gpa_open_keyring_editor (NULL, NULL);
+  gpa_open_key_manager (NULL, NULL);
 
   return assuan_process_done (ctx, 0);
 }



More information about the Gpa-commits mailing list