[Gpa-commits] r767 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 21 03:22:01 CET 2007


Author: marcus
Date: 2007-02-21 03:22:01 +0100 (Wed, 21 Feb 2007)
New Revision: 767

Modified:
   trunk/src/ChangeLog
   trunk/src/gpaimportop.c
   trunk/src/keylist.c
   trunk/src/keylist.h
   trunk/src/keyring.c
   trunk/src/keytable.c
Log:
2007-02-12  Werner Koch  <wk at g10code.com>

	* gpaimportop.c (gpa_import_operation_class_init): New signal
	imported_secret_keys.
	(gpa_import_operation_done_cb): Emit new signal if a secret key
	has been imported.
	* keyring.c (gpa_keyring_editor_changed_wot_secret_cb): New.
	(register_import_operation): Connect new signal.
	* keylist.c (gpa_keylist_imported_secret_key): New.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/ChangeLog	2007-02-21 02:22:01 UTC (rev 767)
@@ -1,3 +1,13 @@
+2007-02-12  Werner Koch  <wk at g10code.com>
+
+	* gpaimportop.c (gpa_import_operation_class_init): New signal
+	imported_secret_keys.
+	(gpa_import_operation_done_cb): Emit new signal if a secret key
+	has been imported.
+	* keyring.c (gpa_keyring_editor_changed_wot_secret_cb): New.
+	(register_import_operation): Connect new signal.
+	* keylist.c (gpa_keylist_imported_secret_key): New.
+
 2007-02-07  Werner Koch  <wk at g10code.com>
 
 	* gpakeyselector.c (gpa_key_selector_get_selected_keys): Avoid

Modified: trunk/src/gpaimportop.c
===================================================================
--- trunk/src/gpaimportop.c	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/gpaimportop.c	2007-02-21 02:22:01 UTC (rev 767)
@@ -30,6 +30,7 @@
 enum
 {
   IMPORTED_KEYS,
+  IMPORTED_SECRET_KEYS,
   LAST_SIGNAL
 };
 static guint signals [LAST_SIGNAL] = { 0 };
@@ -112,6 +113,14 @@
 		  NULL, NULL,
 		  g_cclosure_marshal_VOID__VOID,
 		  G_TYPE_NONE, 0);
+  signals[IMPORTED_SECRET_KEYS] =
+    g_signal_new ("imported_secret_keys",
+		  G_TYPE_FROM_CLASS (object_class),
+		  G_SIGNAL_RUN_FIRST,
+		  G_STRUCT_OFFSET (GpaImportOperationClass, imported_keys),
+		  NULL, NULL,
+		  g_cclosure_marshal_VOID__VOID,
+		  G_TYPE_NONE, 0);
 
 }
 
@@ -220,8 +229,12 @@
       GPA_IMPORT_OPERATION_GET_CLASS (op)->complete_import (op);
 
       res = gpgme_op_import_result (GPA_OPERATION (op)->context->ctx);
-      if (res->imported > 0)
+      if (res->imported > 0 && res->secret_imported )
 	{
+	  g_signal_emit_by_name (GPA_OPERATION (op), "imported_secret_keys");
+	}
+      else if (res->imported > 0)
+	{
 	  g_signal_emit_by_name (GPA_OPERATION (op), "imported_keys");
 	}
       key_import_results_dialog_run (GPA_OPERATION (op)->window, res);

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/keylist.c	2007-02-21 02:22:01 UTC (rev 767)
@@ -413,6 +413,19 @@
 			 gpa_keylist_next, gpa_keylist_end, keylist);
 }
 
+/* Let the keylist know that a new sceret key has been imported. */
+void 
+gpa_keylist_imported_secret_key (GpaKeyList *keylist)
+{
+  /* KEYLIST is currently not used. */
+
+  gpa_keytable_load_new (gpa_keytable_get_secret_instance (), NULL,
+			 NULL, (GpaKeyTableEndFunc) gtk_main_quit, NULL);
+  /* Hack. Turn the asynchronous listing into a synchronous one */
+  gtk_main ();
+}
+
+
 /* Internal functions */
 
 static gboolean

Modified: trunk/src/keylist.h
===================================================================
--- trunk/src/keylist.h	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/keylist.h	2007-02-21 02:22:01 UTC (rev 767)
@@ -97,4 +97,8 @@
  */
 void gpa_keylist_new_key (GpaKeyList * keylist, const char *fpr);
 
+/* Let the keylist know that a new sceret key has been imported. */
+void gpa_keylist_imported_secret_key (GpaKeyList * keylist);
+
+
 #endif /* GPA_KEYLIST_H */

Modified: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/keyring.c	2007-02-21 02:22:01 UTC (rev 767)
@@ -297,6 +297,15 @@
 }
 
 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)
 {
@@ -304,6 +313,7 @@
   gpa_keylist_start_reload (editor->keylist);  
 }
 
+
 static void
 gpa_keyring_editor_new_key_cb (gpointer data, const gchar *fpr)
 {
@@ -330,10 +340,15 @@
   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)
 {

Modified: trunk/src/keytable.c
===================================================================
--- trunk/src/keytable.c	2007-02-07 12:16:45 UTC (rev 766)
+++ trunk/src/keytable.c	2007-02-21 02:22:01 UTC (rev 767)
@@ -107,7 +107,8 @@
 
 /* Internal functions */
 
-static void reload_cache (GpaKeyTable *keytable, const char *fpr)
+static void 
+reload_cache (GpaKeyTable *keytable, const char *fpr)
 {
   gpg_error_t err;
   
@@ -125,7 +126,8 @@
   keytable->tmp_list = NULL;
 }
 
-static void done_cb (GpaContext *context, gpg_error_t err,
+static void 
+done_cb (GpaContext *context, gpg_error_t err,
 		     GpaKeyTable *keytable)
 {
   if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
@@ -161,7 +163,8 @@
     }
 }
 
-static void next_key_cb (GpaContext *context, gpgme_key_t key,
+static void 
+next_key_cb (GpaContext *context, gpgme_key_t key,
 			 GpaKeyTable *keytable)
 {
   keytable->tmp_list = g_list_prepend (keytable->tmp_list, key);
@@ -172,7 +175,8 @@
     }
 }
 
-static void list_cache (GpaKeyTable *keytable)
+static void 
+list_cache (GpaKeyTable *keytable)
 {
   GList *list = keytable->keys;
   



More information about the Gpa-commits mailing list