[Gpa-commits] r877 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Apr 25 14:51:21 CEST 2008


Author: marcus
Date: 2008-04-25 14:51:19 +0200 (Fri, 25 Apr 2008)
New Revision: 877

Added:
   trunk/src/gpa-marshal.list
Modified:
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/gpabackupop.c
   trunk/src/gpacontext.c
   trunk/src/gpaexportclipop.c
   trunk/src/gpaexportop.c
   trunk/src/gpaexportserverop.c
   trunk/src/gpafiledecryptop.c
   trunk/src/gpafileencryptop.c
   trunk/src/gpafilesignop.c
   trunk/src/gpafileverifyop.c
   trunk/src/gpagenkeyadvop.c
   trunk/src/gpagenkeysimpleop.c
   trunk/src/gpaimportclipop.c
   trunk/src/gpaimportop.c
   trunk/src/gpakeydeleteop.c
   trunk/src/gpakeyexpireop.c
   trunk/src/gpakeypasswdop.c
   trunk/src/gpakeysignop.c
   trunk/src/gpakeytrustop.c
   trunk/src/gpaoperation.c
   trunk/src/gpaoperation.h
   trunk/src/gpaprogressbar.c
   trunk/src/gpastreamencryptop.c
   trunk/src/gpastreamencryptop.h
   trunk/src/gpastreamsignop.c
   trunk/src/gpastreamsignop.h
   trunk/src/server.c
Log:
2008-04-25  Marcus Brinkmann  <marcus at g10code.de>

	* Makefile.am (EXTRA_DIST): Add gpa-marshal.list.
	(BUILT_SOURCES): Add gpa-marshal.h and gpa-marshal.c.
	(MOSTLYCLEANFILES): Add gpa-marshal.h and gpa-marshal.c.
	(gpa_SOURCES): Add gpa-marshal.h and gpa-marshal.c.
	* gpa-marshal.list: New file.
	* gpaoperation.h (struct _GpaOperationClass): Add argument ERR to
	member COMPLETED.  Add member STATUS.
	(gpa_operation_server_finish): Remove prototype.
	* gpaoperation.c: Remove SERVER_CTX property.
	(gpa_operation_class_init): Change type of
	completed signal to VOID__INT.
	(gpa_operation_server_finish): Remove function.
	(gpa_operation_class_init): Install STATUS signal.
	* server.c: Include "gpastreamsignop.h".
	(gpa_run_server_continuation): Rename to ...
	(run_server_continuation): ... this, and make it static.
	(cmd_encrypt, cmd_prep_encrypt, cmd_sign): Connect "completed"
	signal to run_server_continuation.  Connect "status" signal to
	assuan_write_status.
	* gpabackup.c, gpaexportop.c, gpafiledecryptop.c,
	gpafileencryptop.c, gpafilesignop.c, gpafileverifyop.c,
	gpagenkeyadvop.c, gpagenkeysimpleop.c, gpaimportop.c,
	gpakeydeleteop.c, gpakeyexpireop.c, gpakeypasswdop.c,
	gpakeysignop.c, gpakeytrustop.c, gpastreamencryptop.c: Do not call
	gpa_operation_server_finish, but pass error code to "completed"
	signal.
	* gpastreamencryptop.h (gpa_stream_encrypt_operation_new): Remove
	server_ctx argument.
	* gpastreamencryptop.c (gpa_stream_encrypt_operation_new): Likewise.
	* gpastreamsignop.h (gpa_stream_sign_operation_new): Remove
	server_ctx argument.
	* gpastreamsignop.c (gpa_stream_sign_operation_new): Likewise.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/ChangeLog	2008-04-25 12:51:19 UTC (rev 877)
@@ -1,5 +1,44 @@
+2008-04-25  Marcus Brinkmann  <marcus at g10code.de>
+
+	* Makefile.am (EXTRA_DIST): Add gpa-marshal.list.
+	(BUILT_SOURCES): Add gpa-marshal.h and gpa-marshal.c.
+	(MOSTLYCLEANFILES): Add gpa-marshal.h and gpa-marshal.c.
+	(gpa_SOURCES): Add gpa-marshal.h and gpa-marshal.c.
+	* gpa-marshal.list: New file.
+	* gpaoperation.h (struct _GpaOperationClass): Add argument ERR to
+	member COMPLETED.  Add member STATUS.
+	(gpa_operation_server_finish): Remove prototype.
+	* gpaoperation.c: Remove SERVER_CTX property.
+	(gpa_operation_class_init): Change type of
+	completed signal to VOID__INT.
+	(gpa_operation_server_finish): Remove function.
+	(gpa_operation_class_init): Install STATUS signal.
+	* server.c: Include "gpastreamsignop.h".
+	(gpa_run_server_continuation): Rename to ...
+	(run_server_continuation): ... this, and make it static.
+	(cmd_encrypt, cmd_prep_encrypt, cmd_sign): Connect "completed"
+	signal to run_server_continuation.  Connect "status" signal to
+	assuan_write_status.
+	* gpabackup.c, gpaexportop.c, gpafiledecryptop.c,
+	gpafileencryptop.c, gpafilesignop.c, gpafileverifyop.c,
+	gpagenkeyadvop.c, gpagenkeysimpleop.c, gpaimportop.c,
+	gpakeydeleteop.c, gpakeyexpireop.c, gpakeypasswdop.c,
+	gpakeysignop.c, gpakeytrustop.c, gpastreamencryptop.c: Do not call
+	gpa_operation_server_finish, but pass error code to "completed"
+	signal.
+	* gpastreamencryptop.h (gpa_stream_encrypt_operation_new): Remove
+	server_ctx argument.
+	* gpastreamencryptop.c (gpa_stream_encrypt_operation_new): Likewise.
+	* gpastreamsignop.h (gpa_stream_sign_operation_new): Remove
+	server_ctx argument.
+	* gpastreamsignop.c (gpa_stream_sign_operation_new): Likewise.
+
 2008-04-24  Marcus Brinkmann  <marcus at g10code.de>
 
+	* Makefile.am (gpa_SOURCES): Remove gpawizard.h and gpawizard.c.
+	* gpawizard.h, gpawizard.c: Remove files.
+	* keygenwizard.c: Rewritten to use GtkAssistant.
+
 	* settingsdlg.c (keyserver_selected_cb): Add missing event
 	argument.
 	(selected_from_list_cb): Also to caller.

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/Makefile.am	2008-04-25 12:51:19 UTC (rev 877)
@@ -4,8 +4,20 @@
 
 pkgdata_DATA = $(logo)
 
-EXTRA_DIST = $(logo) gpa.ico gpa-resource.rc
+EXTRA_DIST = $(logo) gpa.ico gpa-resource.rc gpa-marshal.list
+BUILT_SOURCES = gpa-marshal.h gpa-marshal.c
+MOSTLYCLEANFILES = gpa-marshal.h gpa-marshal.c
 
+GLIB_GENMARSHAL = glib-genmarshal
+
+gpa-marshal.h: gpa-marshal.list
+	$(GLIB_GENMARSHAL) --header --prefix=gpa_marshal $< > $@.tmp
+	mv $@.tmp $@
+
+gpa-marshal.c: gpa-marshal.list
+	$(GLIB_GENMARSHAL) --body --prefix=gpa_marshal $< > $@.tmp
+	mv $@.tmp $@
+
 if HAVE_W32_SYSTEM
 .rc.o:
 	$(WINDRES) `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
@@ -104,6 +116,7 @@
 	      server.c \
 	      options.c \
 	      confdialog.h confdialog.c \
+	      gpa-marshal.c gpa-marshal.h \
 	      utils.c $(gpa_w32_sources)
 
 

Added: trunk/src/gpa-marshal.list
===================================================================
--- trunk/src/gpa-marshal.list	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpa-marshal.list	2008-04-25 12:51:19 UTC (rev 877)
@@ -0,0 +1 @@
+INT:STRING,STRING

Modified: trunk/src/gpabackupop.c
===================================================================
--- trunk/src/gpabackupop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpabackupop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -285,9 +285,10 @@
   if ((file = gpa_backup_operation_dialog_run (GPA_OPERATION (op)->window,
 					       op->key_id)))
     gpa_backup_operation_do_backup (op, file);
-  
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
 
+  /* FIXME: Error handling.  */
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
   return FALSE;
 }
 

Modified: trunk/src/gpacontext.c
===================================================================
--- trunk/src/gpacontext.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpacontext.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -175,7 +175,7 @@
 
   /* The context itself */
   err = gpgme_new (&context->ctx);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
       return;
@@ -371,14 +371,13 @@
   /* If the context is busy, we already have a START event, and can
    * register GLib callbacks immediately.  */
   if (context->busy)
-    {
-      register_callback (cb);
-    }
+    register_callback (cb);
+
   /* In any case, we add it to the list.   */
   add_callback (context, cb);
   *tag = cb;
 
-  return gpg_error (GPG_ERR_NO_ERROR);
+  return 0;
 }
 
 

Modified: trunk/src/gpaexportclipop.c
===================================================================
--- trunk/src/gpaexportclipop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaexportclipop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -119,7 +119,7 @@
   gpg_error_t err;
   *armor = TRUE;
   err = gpgme_data_new (dest);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
       return FALSE;    

Modified: trunk/src/gpaexportop.c
===================================================================
--- trunk/src/gpaexportop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaexportop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -214,19 +214,18 @@
       /* Export to the gpgme_data_t */
       err = gpgme_op_export_ext_start (GPA_OPERATION (op)->context->ctx, 
 				       patterns, 0, op->dest);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+      if (err)
 	{
 	  gpa_gpgme_warning (err);
-	  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 	}
       /* Clean up */
       g_free (patterns);      
     }
   else
-    {
-      /* Abort the operation */
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+    /* Abort the operation.  */
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			   gpg_error (GPG_ERR_CANCELED));
 
   return FALSE;
 }
@@ -235,11 +234,9 @@
 gpa_export_operation_done_cb (GpaContext *context, gpg_error_t err,
 			      GpaExportOperation *op)
 {
-  if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
-    {
-      GPA_EXPORT_OPERATION_GET_CLASS (op)->complete_export (op);
-    }
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+  if (! err)
+    GPA_EXPORT_OPERATION_GET_CLASS (op)->complete_export (op);
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
 static void

Modified: trunk/src/gpaexportserverop.c
===================================================================
--- trunk/src/gpaexportserverop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaexportserverop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -156,7 +156,7 @@
       gpg_error_t err;
       *armor = TRUE;
       err = gpgme_data_new (dest);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+      if (err)
 	{
 	  gpa_gpgme_warning (err);
 	  return FALSE;    

Modified: trunk/src/gpafiledecryptop.c
===================================================================
--- trunk/src/gpafiledecryptop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpafiledecryptop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -176,7 +176,7 @@
   return plain_filename;
 }
 
-static gboolean
+static gpg_error_t
 gpa_file_decrypt_operation_start (GpaFileDecryptOperation *op,
 				  gpa_file_item_t file_item)
 {
@@ -190,7 +190,7 @@
       if (err)
 	{
 	  gpa_gpgme_warning (err);
-	  return FALSE;
+	  return err;
 	}
       
       err = gpgme_data_new (&op->plain);
@@ -199,7 +199,7 @@
 	  gpa_gpgme_warning (err);
 	  gpgme_data_release (op->cipher);
 	  op->plain = NULL;
-	  return FALSE;
+	  return err;
 	}
     }
   else
@@ -211,23 +211,24 @@
       op->cipher_fd = gpa_open_input (cipher_filename, &op->cipher, 
 				  GPA_OPERATION (op)->window);
       if (op->cipher_fd == -1)
-	{
-	  return FALSE;
-	}
+	/* FIXME: Error value.  */
+	return gpg_error (GPG_ERR_GENERAL);
+
       op->plain_fd = gpa_open_output (file_item->filename_out, &op->plain,
 				      GPA_OPERATION (op)->window);
       if (op->plain_fd == -1)
 	{
 	  gpgme_data_release (op->cipher);
 	  close (op->cipher_fd);
-	  return FALSE;
+	  /* FIXME: Error value.  */
+	  return gpg_error (GPG_ERR_GENERAL);
 	}
     }
 
-  /* Start the operation */
+  /* Start the operation.  */
   err = gpgme_op_decrypt_start (GPA_OPERATION (op)->context->ctx, op->cipher, 
 				op->plain);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
 
@@ -240,29 +241,38 @@
       close (op->cipher_fd);
       op->cipher_fd = -1;
 
-      return FALSE;
+      return err;
     }
-  /* Show and update the progress dialog */
+
+  /* Show and update the progress dialog.  */
   gtk_widget_show_all (GPA_FILE_OPERATION (op)->progress_dialog);
   gpa_progress_dialog_set_label (GPA_PROGRESS_DIALOG 
 				 (GPA_FILE_OPERATION (op)->progress_dialog),
 				 file_item->direct_name
 				 ? file_item->direct_name
 				 : file_item->filename_in);
-  return TRUE;
+  return 0;
 }
 
+
 static void
 gpa_file_decrypt_operation_next (GpaFileDecryptOperation *op)
 {
-  if (!GPA_FILE_OPERATION (op)->current 
-      || !(gpa_file_decrypt_operation_start
-           (op, GPA_FILE_OPERATION (op)->current->data)))
+  gpg_error_t err;
+
+  if (! GPA_FILE_OPERATION (op)->current)
     {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+      return;
     }
+
+  err = gpa_file_decrypt_operation_start
+    (op, GPA_FILE_OPERATION (op)->current->data);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
+
 static void
 gpa_file_decrypt_operation_done_cb (GpaContext *context, 
 				    gpg_error_t err,
@@ -304,8 +314,7 @@
   close (op->cipher_fd);
   op->cipher_fd = -1;
   gtk_widget_hide (GPA_FILE_OPERATION (op)->progress_dialog);
-  /* Check for error */
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       if (! file_item->direct_in)
 	{
@@ -316,7 +325,7 @@
 	  file_item->filename_out = NULL;
 	}
       /* FIXME:CLIPBOARD: Server finish?  */
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed"); 
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err); 
     }
   else
     {

Modified: trunk/src/gpafileencryptop.c
===================================================================
--- trunk/src/gpafileencryptop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpafileencryptop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -261,7 +261,8 @@
   return cipher_filename;
 }
 
-static gboolean
+
+static gpg_error_t
 gpa_file_encrypt_operation_start (GpaFileEncryptOperation *op,
 				  gpa_file_item_t file_item)
 {
@@ -277,7 +278,7 @@
       if (err)
 	{
 	  gpa_gpgme_warning (err);
-	  return FALSE;
+	  return err;
 	}
       
       err = gpgme_data_new (&op->cipher);
@@ -286,7 +287,7 @@
 	  gpa_gpgme_warning (err);
 	  gpgme_data_release (op->plain);
 	  op->plain = NULL;
-	  return FALSE;
+	  return err;
 	}
     }
   else
@@ -299,9 +300,9 @@
       op->plain_fd = gpa_open_input (plain_filename, &op->plain, 
 				     GPA_OPERATION (op)->window);
       if (op->plain_fd == -1)
-	{
-	  return FALSE;
-	}
+	/* FIXME: Error value.  */
+	return gpg_error (GPG_ERR_GENERAL);
+
       op->cipher_fd = gpa_open_output (file_item->filename_out, &op->cipher,
 				       GPA_OPERATION (op)->window);
       if (op->cipher_fd == -1)
@@ -309,29 +310,26 @@
 	  gpgme_data_release (op->plain);
 	  close (op->plain_fd);
 	  op->plain_fd = -1;
-	  return FALSE;
+	  /* FIXME: Error value.  */
+	  return gpg_error (GPG_ERR_GENERAL);
 	}
     }
 
-  /* Start the operation */
-  /* Always trust keys, because any untrusted keys were already confirmed
-   * by the user.
-   */
+  /* Start the operation.  */
+  /* Always trust keys, because any untrusted keys were already
+     confirmed by the user.  */
   if (gpa_file_encrypt_dialog_sign 
       (GPA_FILE_ENCRYPT_DIALOG (op->encrypt_dialog)))
-    {
-      err = gpgme_op_encrypt_sign_start (GPA_OPERATION (op)->context->ctx,
-					 op->rset, GPGME_ENCRYPT_ALWAYS_TRUST,
-					 op->plain, op->cipher);
-    }
+    err = gpgme_op_encrypt_sign_start (GPA_OPERATION (op)->context->ctx,
+				       op->rset, GPGME_ENCRYPT_ALWAYS_TRUST,
+				       op->plain, op->cipher);
   else
+    err = gpgme_op_encrypt_start (GPA_OPERATION (op)->context->ctx,
+				  op->rset, GPGME_ENCRYPT_ALWAYS_TRUST,
+				  op->plain, op->cipher);
+
+  if (err)
     {
-      err = gpgme_op_encrypt_start (GPA_OPERATION (op)->context->ctx,
-				    op->rset, GPGME_ENCRYPT_ALWAYS_TRUST,
-				    op->plain, op->cipher);
-    }
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-    {
       gpa_gpgme_warning (err);
 
       gpgme_data_release (op->plain);
@@ -343,30 +341,37 @@
       close (op->cipher_fd);
       op->cipher_fd = -1;
 
-      return FALSE;
+      return err;
     }
-  /* Show and update the progress dialog */
+
+  /* Show and update the progress dialog.  */
   gtk_widget_show_all (GPA_FILE_OPERATION (op)->progress_dialog);
   gpa_progress_dialog_set_label (GPA_PROGRESS_DIALOG 
 				 (GPA_FILE_OPERATION (op)->progress_dialog),
 				 file_item->direct_name
 				 ? file_item->direct_name
 				 : file_item->filename_in);
-  return TRUE;
+  return 0;
 }
 
 static void
 gpa_file_encrypt_operation_next (GpaFileEncryptOperation *op)
 {
-  if (!GPA_FILE_OPERATION (op)->current ||
-      !gpa_file_encrypt_operation_start (op, GPA_FILE_OPERATION (op)
-					 ->current->data))
+  gpg_error_t err;
+
+  if (! GPA_FILE_OPERATION (op)->current)
     {
-      gpa_operation_server_finish (GPA_OPERATION (op), 0);
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+      return;
     }
+
+  err = gpa_file_encrypt_operation_start
+    (op, GPA_FILE_OPERATION (op)->current->data);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
+
 static void
 gpa_file_encrypt_operation_done_cb (GpaContext *context, 
 				    gpg_error_t err,
@@ -410,7 +415,7 @@
   op->cipher_fd = -1;
   gtk_widget_hide (GPA_FILE_OPERATION (op)->progress_dialog);
 
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR) 
+  if (err) 
     {
       if (! file_item->direct_in)
 	{
@@ -420,8 +425,7 @@
 	  g_free (file_item->filename_out);
 	  file_item->filename_out = NULL;
 	}
-      gpa_operation_server_finish (GPA_OPERATION (op), err);
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
     }
   else
     {
@@ -676,10 +680,8 @@
     {
       gpgme_key_t key = cur->data;
       err = gpgme_signers_add (GPA_OPERATION (op)->context->ctx, key);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_error (err);
-	}
+      if (err)
+	gpa_gpgme_error (err);
     }
   return TRUE;
 }
@@ -707,28 +709,21 @@
       
       /* Set the armor value */
       gpgme_set_armor (GPA_OPERATION (op)->context->ctx, armor);
-      /* Set the signers for the context */
+      /* Set the signers for the context.  */
       if (gpa_file_encrypt_dialog_sign 
 	  (GPA_FILE_ENCRYPT_DIALOG (op->encrypt_dialog)))
-	{
-	  success = set_signers (op, signers);
-	}
-      /* Set the recipients for the context */
+	success = set_signers (op, signers);
+
+      /* Set the recipients for the context.  */
       if (success)
-	{
-	  success = set_recipients (op, recipients);
-	}
-      /* Actually run the operation or abort */
+	success = set_recipients (op, recipients);
+
+      /* Actually run the operation or abort.  */
       if (success)
-	{
-	  gpa_file_encrypt_operation_next (op);
-	}
+	gpa_file_encrypt_operation_next (op);
       else
-	{
-          gpa_operation_server_finish (GPA_OPERATION (op), 
-                                       gpg_error (GPG_ERR_GENERAL));
-	  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-	}
+	g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+				 gpg_error (GPG_ERR_GENERAL));
 
       g_list_free (signers);
       g_list_free (recipients);
@@ -736,10 +731,9 @@
   else
     {
       /* The dialog was canceled, so we do nothing and complete the
-       * operation */
-      gpa_operation_server_finish (GPA_OPERATION (op), 
-                                   gpg_error (GPG_ERR_CANCELED));
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	 operation */
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			     gpg_error (GPG_ERR_CANCELED));
     }
 }
 

Modified: trunk/src/gpafilesignop.c
===================================================================
--- trunk/src/gpafilesignop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpafilesignop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -247,7 +247,8 @@
   return signature_filename;
 }
 
-static gboolean
+
+static gpg_error_t
 gpa_file_sign_operation_start (GpaFileSignOperation *op,
 			       gpa_file_item_t file_item)
 {
@@ -263,7 +264,7 @@
       if (err)
 	{
 	  gpa_gpgme_warning (err);
-	  return FALSE;
+	  return err;
 	}
       
       err = gpgme_data_new (&op->sig);
@@ -272,7 +273,7 @@
 	  gpa_gpgme_warning (err);
 	  gpgme_data_release (op->plain);
 	  op->plain = NULL;
-	  return FALSE;
+	  return err;
 	}
     }
   else
@@ -287,26 +288,27 @@
       op->plain_fd = gpa_open_input (plain_filename, &op->plain, 
 				     GPA_OPERATION (op)->window);
       if (op->plain_fd == -1)
-	{
-	  return FALSE;
-	}
+	/* FIXME: Error value.  */
+	return gpg_error (GPG_ERR_GENERAL);
+
       op->sig_fd = gpa_open_output (file_item->filename_out, &op->sig,
 				    GPA_OPERATION (op)->window);
       if (op->sig_fd == -1)
 	{
 	  gpgme_data_release (op->plain);
 	  close (op->plain_fd);
-	  return FALSE;
+	  /* FIXME: Error value.  */
+	  return gpg_error (GPG_ERR_GENERAL);
 	}
     }
   
   /* Start the operation */
   err = gpgme_op_sign_start (GPA_OPERATION (op)->context->ctx, op->plain,
 			     op->sig, op->sign_type);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
-      return FALSE;
+      return err;
     }
   /* Show and update the progress dialog */
   gtk_widget_show_all (GPA_FILE_OPERATION (op)->progress_dialog);
@@ -316,20 +318,28 @@
 				 ? file_item->direct_name
 				 : file_item->filename_in);
 
-  return TRUE;
+  return 0;
 }
 
+
 static void
 gpa_file_sign_operation_next (GpaFileSignOperation *op)
 {
-  if (!GPA_FILE_OPERATION (op)->current ||
-      !gpa_file_sign_operation_start (op, GPA_FILE_OPERATION (op)
-					 ->current->data))
+  gpg_error_t err;
+
+  if (! GPA_FILE_OPERATION (op)->current)
     {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+      return;
     }
+  
+  err = gpa_file_sign_operation_start (op,
+				       GPA_FILE_OPERATION (op)->current->data);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
+
 static void
 gpa_file_sign_operation_done_cb (GpaContext *context, 
 				 gpg_error_t err,
@@ -372,7 +382,7 @@
   op->sig_fd = -1;
   gtk_widget_hide (GPA_FILE_OPERATION (op)->progress_dialog);
 
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       if (! file_item->direct_in)
 	{
@@ -381,7 +391,7 @@
 	  g_unlink (op->sig_filename);
 	  g_free (op->sig_filename);
 	}
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
     }
   else
     {
@@ -441,10 +451,8 @@
     {
       gpgme_key_t key = cur->data;
       err = gpgme_signers_add (GPA_OPERATION (op)->context->ctx, key);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_error (err);
-	}
+      if (err)
+	gpa_gpgme_error (err);
     }
 
   return TRUE;
@@ -477,26 +485,23 @@
       gpgme_set_armor (GPA_OPERATION (op)->context->ctx, armor);
       /* Set the signers for the context */
       success = set_signers (op, signers);
-      /* Actually run the operation or abort */
+      /* Actually run the operation or abort.  */
       if (success)
-	{
-	  gpa_file_sign_operation_next (op);
-	}
+	gpa_file_sign_operation_next (op);
       else
-	{
-	  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-	}
+	g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			       gpg_error (GPG_ERR_GENERAL));
 
       g_list_free (signers);
     }
   else
-    {
-      /* The dialog was canceled, so we do nothing and complete the
+    /* The dialog was canceled, so we do nothing and complete the
        * operation */
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			   gpg_error (GPG_ERR_CANCELED));
 }
 
+
 static void
 gpa_file_sign_operation_done_error_cb (GpaContext *context, gpg_error_t err,
 				       GpaFileSignOperation *op)

Modified: trunk/src/gpafileverifyop.c
===================================================================
--- trunk/src/gpafileverifyop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpafileverifyop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -294,7 +294,7 @@
 	      return FALSE;
 	    }
 	  err = gpgme_data_new (&op->plain);
-	  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+	  if (err)
 	    {
 	      gpgme_data_release (op->sig);
 	      close (op->sig_fd);
@@ -308,7 +308,7 @@
   /* Start the operation */
   err = gpgme_op_verify_start (GPA_OPERATION (op)->context->ctx, op->sig,
 			       op->signed_text, op->plain);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
       return FALSE;
@@ -324,11 +324,12 @@
   return TRUE;
 }
 
+
 static void
 gpa_file_verify_operation_next (GpaFileVerifyOperation *op)
 {
-  if (!GPA_FILE_OPERATION (op)->current ||
-      !gpa_file_verify_operation_start (op, GPA_FILE_OPERATION (op)
+  if (! GPA_FILE_OPERATION (op)->current ||
+      ! gpa_file_verify_operation_start (op, GPA_FILE_OPERATION (op)
 					 ->current->data))
     {
       /* All files have been verified: show the results dialog */
@@ -336,6 +337,7 @@
     }
 }
 
+
 static void
 gpa_file_verify_operation_done_cb (GpaContext *context, 
 				    gpg_error_t err,
@@ -382,7 +384,7 @@
 
   gtk_widget_hide (GPA_FILE_OPERATION (op)->progress_dialog);
   /* Check for error */
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       /* Abort further verifications */
     }
@@ -438,9 +440,12 @@
 				       gpointer user_data)
 {
   GpaFileVerifyOperation *op = GPA_FILE_VERIFY_OPERATION (user_data);
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");  
+
+  /* FIXME: Error handling.  */
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
 }
 
+
 static void
 gpa_file_verify_operation_done_error_cb (GpaContext *context, gpg_error_t err,
 					 GpaFileVerifyOperation *op)

Modified: trunk/src/gpagenkeyadvop.c
===================================================================
--- trunk/src/gpagenkeyadvop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpagenkeyadvop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -149,44 +149,39 @@
 gpa_gen_key_advanced_operation_idle_cb (gpointer data)
 {
   GpaGenKeyAdvancedOperation *op = data;
+  gpg_error_t err;
   GPAKeyGenParameters *parms;
   
-  if ((parms = gpa_key_gen_run_dialog (GPA_OPERATION (op)->window)))
-    {
-      gpg_error_t err;
+  if (! (parms = gpa_key_gen_run_dialog (GPA_OPERATION (op)->window)))
+    g_signal_emit_by_name (op, "completed", gpg_error (GPG_ERR_CANCELED));
 
-      err = gpa_generate_key_start (GPA_OPERATION (op)->context->ctx, parms);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_warning (err);
-	  g_signal_emit_by_name (op, "completed");
-	}
-      else
-	{
-	  gtk_widget_show_all (op->progress_dialog);
-	}
-    }
-  else
+  err = gpa_generate_key_start (GPA_OPERATION (op)->context->ctx, parms);
+  if (err)
     {
-      g_signal_emit_by_name (op, "completed");
+      gpa_gpgme_warning (err);
+      g_signal_emit_by_name (op, "completed", err);
     }
+  else
+    gtk_widget_show_all (op->progress_dialog);
 
   return FALSE;
 }
 
+
 static void
 gpa_gen_key_advanced_operation_done_cb (GpaContext *context, 
 					gpg_error_t err,
 					GpaGenKeyAdvancedOperation *op)
 {
-  if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
+  if (! err)
     {
       gpgme_genkey_result_t result = gpgme_op_genkey_result (context->ctx);
       g_signal_emit_by_name (op, "generated_key", result->fpr);
     }
-  g_signal_emit_by_name (op, "completed");
+  g_signal_emit_by_name (op, "completed", err);
 }
 
+
 static void
 gpa_gen_key_advanced_operation_done_error_cb (GpaContext *context, 
 					      gpg_error_t err,

Modified: trunk/src/gpagenkeysimpleop.c
===================================================================
--- trunk/src/gpagenkeysimpleop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpagenkeysimpleop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -154,10 +154,10 @@
   op->do_backup = do_backup;
 
   err = gpa_generate_key_start (GPA_OPERATION (op)->context->ctx, params);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
-      g_signal_emit_by_name (op, "completed");
+      g_signal_emit_by_name (op, "completed", err);
       return FALSE;
     }
   return TRUE;
@@ -174,7 +174,7 @@
 
   g_object_unref (backup);
 
-  g_signal_emit_by_name (op, "completed");
+  g_signal_emit_by_name (op, "completed", 0);
 }
 
 static void
@@ -182,7 +182,7 @@
 				      gpg_error_t err,
 				      GpaGenKeySimpleOperation *op)
 {
-  if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
+  if (! err)
     {
       gpgme_genkey_result_t result = gpgme_op_genkey_result (context->ctx);
 
@@ -198,13 +198,11 @@
       else
 	{
 	  g_signal_emit_by_name (op, "generated_key", result->fpr);
-	  g_signal_emit_by_name (op, "completed");
+	  g_signal_emit_by_name (op, "completed", err);
 	}
     }
   else
-    {
-      g_signal_emit_by_name (op, "completed");
-    }
+    g_signal_emit_by_name (op, "completed", err);
 }
 
 static void

Modified: trunk/src/gpaimportclipop.c
===================================================================
--- trunk/src/gpaimportclipop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaimportclipop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -104,7 +104,7 @@
       err = gpgme_data_new (source);
     }
 
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
       return FALSE;

Modified: trunk/src/gpaimportop.c
===================================================================
--- trunk/src/gpaimportop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaimportop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -167,17 +167,16 @@
       
       err = gpgme_op_import_start (GPA_OPERATION (op)->context->ctx,
 				   op->source);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+      if (err)
 	{
 	  gpa_gpgme_warning (err);
-	  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 	}
     }
   else
-    {
-      /* Abort the operation */
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+    /* Abort the operation.  */
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			   gpg_error (GPG_ERR_CANCELED));
 
   return FALSE;
 }
@@ -220,11 +219,12 @@
   gtk_widget_destroy (dialog);
 }
 
+
 static void
 gpa_import_operation_done_cb (GpaContext *context, gpg_error_t err,
 			      GpaImportOperation *op)
 {
-  if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
+  if (! err)
     {
       gpgme_import_result_t res;
 
@@ -241,9 +241,10 @@
 	}
       key_import_results_dialog_run (GPA_OPERATION (op)->window, res);
     }
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
+
 static void
 gpa_import_operation_done_error_cb (GpaContext *context, gpg_error_t err,
 				    GpaImportOperation *op)

Modified: trunk/src/gpakeydeleteop.c
===================================================================
--- trunk/src/gpakeydeleteop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpakeydeleteop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -142,49 +142,54 @@
 
 /* Internal */
 
-static gboolean
+static gpg_error_t
 gpa_key_delete_operation_start (GpaKeyDeleteOperation *op)
 { 
-  gpgme_key_t key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  gpg_error_t err;
+  gpgme_key_t key;
 
-  if (gpa_delete_dialog_run (GPA_OPERATION (op)->window, key))
+  key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  
+  if (! gpa_delete_dialog_run (GPA_OPERATION (op)->window, key))
+    return gpg_error (GPG_ERR_CANCELED);
+
+  err = gpgme_op_delete_start (GPA_OPERATION(op)->context->ctx, key, TRUE);
+  if (err)
     {
-      gpg_error_t err;
-      err = gpgme_op_delete_start (GPA_OPERATION(op)->context->ctx, key, TRUE);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_warning (err);
-	  return FALSE;
-	}
+      gpa_gpgme_warning (err);
+      return err;
     }
-  else
-    {
-      return FALSE;
-    }
-  return TRUE;
+
+  return 0;
 }
 
 static gboolean
 gpa_key_delete_operation_idle_cb (gpointer data)
 {
+  gpg_error_t err;
   GpaKeyDeleteOperation *op = data;
 
-  if (!gpa_key_delete_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  err = gpa_key_delete_operation_start (op);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 
   return FALSE;
 }
 
+
 static void
 gpa_key_delete_operation_next (GpaKeyDeleteOperation *op)
 {
-  if (!GPA_KEY_OPERATION (op)->current ||
-      !gpa_key_delete_operation_start (op))
+  gpg_error_t err;
+
+  if (! GPA_KEY_OPERATION (op)->current)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
+  err = gpa_key_delete_operation_start (op);
+  if (err)
     {
       g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
     }
 }
 

Modified: trunk/src/gpakeyexpireop.c
===================================================================
--- trunk/src/gpakeyexpireop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpakeyexpireop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -167,55 +167,58 @@
 
 /* Internal */
 
-static gboolean
+static gpg_error_t
 gpa_key_expire_operation_start (GpaKeyExpireOperation *op)
 { 
-  gpgme_key_t key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  gpg_error_t err;
+  gpgme_key_t key;
   GDate *date;
 
-  if (gpa_expiry_dialog_run (GPA_OPERATION (op)->window, key, &date))
+  key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+
+  if (! gpa_expiry_dialog_run (GPA_OPERATION (op)->window, key, &date))
+    return gpg_error (GPG_ERR_CANCELED);
+
+  err = gpa_gpgme_edit_expire_start (GPA_OPERATION(op)->context, key, date);
+  op->date = date;
+  if (err)
     {
-      gpg_error_t err;
-      err = gpa_gpgme_edit_expire_start (GPA_OPERATION(op)->context, key,
-					 date);
-      op->date = date;
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_warning (err);
-	  return FALSE;
-	}
+      gpa_gpgme_warning (err);
+      return err;
     }
-  else
-    {
-      return FALSE;
-    }
-  return TRUE;
+
+  return 0;
 }
 
+
 static gboolean
 gpa_key_expire_operation_idle_cb (gpointer data)
 {
   GpaKeyExpireOperation *op = data;
+  gpg_error_t err;
 
-  if (!gpa_key_expire_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  err = gpa_key_expire_operation_start (op);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 
   return FALSE;
 }
 
+
 static void
 gpa_key_expire_operation_next (GpaKeyExpireOperation *op)
 {
-  if (!GPA_KEY_OPERATION (op)->current ||
-      !gpa_key_expire_operation_start (op))
+  gpg_error_t err;
+
+  if (! GPA_KEY_OPERATION (op)->current)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
+  err = gpa_key_expire_operation_start (op);
+  if (err)
     {
       if (op->modified_keys > 0)
-	{
-	  g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
-	}
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
     }
 }
 
@@ -251,19 +254,18 @@
                                   gpg_error_t err,
                                   GpaKeyExpireOperation *op)
 {
-  if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
-    {
-      /* The expiration was changed */
-      g_signal_emit_by_name (op, "new_expiration", 
-			     GPA_KEY_OPERATION (op)->current->data, op->date);
-    }
-  /* Clean previous date */
+  if (! err)
+    /* The expiration was changed.  */
+    g_signal_emit_by_name (op, "new_expiration", 
+			   GPA_KEY_OPERATION (op)->current->data, op->date);
+
+  /* Clean previous date.  */
   if (op->date)
     {
       g_date_free (op->date);
       op->date = NULL;
     }
-  /* Go to the next key */
+  /* Go to the next key.  */
   GPA_KEY_OPERATION (op)->current = g_list_next
     (GPA_KEY_OPERATION (op)->current);
   gpa_key_expire_operation_next (op);

Modified: trunk/src/gpakeypasswdop.c
===================================================================
--- trunk/src/gpakeypasswdop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpakeypasswdop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -144,45 +144,54 @@
 
 /* Internal */
 
-static gboolean
+static gpg_error_t
 gpa_key_passwd_operation_start (GpaKeyPasswdOperation *op)
 { 
-  gpgme_key_t key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
   gpg_error_t err;
+  gpgme_key_t key;
 
+  key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+
   err = gpa_gpgme_edit_passwd_start (GPA_OPERATION(op)->context, key);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
       gpa_gpgme_warning (err);
-      return FALSE;
+      return err;
     }
 
-  return TRUE;
+  return 0;
 }
 
+
 static gboolean
 gpa_key_passwd_operation_idle_cb (gpointer data)
 {
   GpaKeyPasswdOperation *op = data;
+  gpg_error_t err;
 
-  if (!gpa_key_passwd_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  err = gpa_key_passwd_operation_start (op);
 
+  if (err) 
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
+
   return FALSE;
 }
 
+
 static void
 gpa_key_passwd_operation_next (GpaKeyPasswdOperation *op)
 {
-  if (!GPA_KEY_OPERATION (op)->current ||
-      !gpa_key_passwd_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  gpg_error_t err;
+
+  if (! GPA_KEY_OPERATION (op)->current)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
+  err = gpa_key_passwd_operation_start (op);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
+
 static void gpa_key_passwd_operation_done_error_cb (GpaContext *context, 
 						  gpg_error_t err,
 						  GpaKeyPasswdOperation *op)

Modified: trunk/src/gpakeysignop.c
===================================================================
--- trunk/src/gpakeysignop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpakeysignop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -152,68 +152,74 @@
 
 /* Internal */
 
-static gboolean
+static gpg_error_t
 gpa_key_sign_operation_start (GpaKeySignOperation *op)
 { 
-  gpgme_key_t key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  gpg_error_t err;
+  gpgme_key_t key;
   gboolean sign_locally = FALSE;
 
-  if (gpa_key_sign_run_dialog (GPA_OPERATION (op)->window, key, &sign_locally))
+  key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  if (! gpa_key_sign_run_dialog (GPA_OPERATION (op)->window,
+				 key, &sign_locally))
+    return gpg_error (GPG_ERR_CANCELED);
+
+  err = gpa_gpgme_edit_sign_start  (GPA_OPERATION(op)->context, key,
+				    op->signer_key, sign_locally);
+  if (err)
     {
-      gpg_error_t err;
-      err = gpa_gpgme_edit_sign_start  (GPA_OPERATION(op)->context, key,
-					op->signer_key, sign_locally);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_warning (err);
-	  return FALSE;
-	}
+      gpa_gpgme_warning (err);
+      return err;
     }
-  else
-    {
-      return FALSE;
-    }
-  return TRUE;
+
+  return 0;
 }
 
+
 static gboolean
 gpa_key_sign_operation_idle_cb (gpointer data)
 {
   GpaKeySignOperation *op = data;
+  gpg_error_t err;
 
   /* Get the signer key and abort if there isn't one */
   op->signer_key = gpa_options_get_default_key (gpa_options_get_instance ());
-  if (!op->signer_key)
+  if (! op->signer_key)
     {
       gpa_window_error (_("No private key for signing."),
 			GPA_OPERATION (op)->window);
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+      /* FIXME: Error code?  */
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
       return FALSE;
     }
   gpgme_key_ref (op->signer_key);
 
-  if (!gpa_key_sign_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  err = gpa_key_sign_operation_start (op);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 
   return FALSE;
 }
 
+
 static void
 gpa_key_sign_operation_next (GpaKeySignOperation *op)
 {
-  if (!GPA_KEY_OPERATION (op)->current ||
-      !gpa_key_sign_operation_start (op))
+  gpg_error_t err;
+
+  if (! GPA_KEY_OPERATION (op)->current)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
+  err = gpa_key_sign_operation_start (op);
+  if (err)
     {
       if (op->signed_keys > 0)
-	{
-	  g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
-	}
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
     }
 }
 
+
 static void gpa_key_sign_operation_done_error_cb (GpaContext *context, 
 						  gpg_error_t err,
 						  GpaKeySignOperation *op)
@@ -249,8 +255,8 @@
 }
 
 static void gpa_key_sign_operation_done_cb (GpaContext *context, 
-					      gpg_error_t err,
-					      GpaKeySignOperation *op)
+					    gpg_error_t err,
+					    GpaKeySignOperation *op)
 {
   GPA_KEY_OPERATION (op)->current = g_list_next
     (GPA_KEY_OPERATION (op)->current);

Modified: trunk/src/gpakeytrustop.c
===================================================================
--- trunk/src/gpakeytrustop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpakeytrustop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -146,56 +146,61 @@
 
 /* Internal */
 
-static gboolean
+static gpg_error_t
 gpa_key_trust_operation_start (GpaKeyTrustOperation *op)
 { 
-  gpgme_key_t key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+  gpg_error_t err;
+  gpgme_key_t key;
   gpgme_validity_t trust;
 
-  if (gpa_ownertrust_run_dialog (key, GPA_OPERATION (op)->window, &trust))
+  key = gpa_key_operation_current_key (GPA_KEY_OPERATION (op));
+
+  if (! gpa_ownertrust_run_dialog (key, GPA_OPERATION (op)->window, &trust))
+    return gpg_error (GPG_ERR_CANCELED);
+
+  err = gpa_gpgme_edit_trust_start (GPA_OPERATION(op)->context, key,trust);
+  if (err)
     {
-      gpg_error_t err;
-      err = gpa_gpgme_edit_trust_start (GPA_OPERATION(op)->context, key,trust);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_warning (err);
-	  return FALSE;
-	}
+      gpa_gpgme_warning (err);
+      return err;
     }
-  else
-    {
-      return FALSE;
-    }
-  return TRUE;
+
+  return 0;
 }
 
+
 static gboolean
 gpa_key_trust_operation_idle_cb (gpointer data)
 {
   GpaKeyTrustOperation *op = data;
+  gpg_error_t err;
 
-  if (!gpa_key_trust_operation_start (op))
-    {
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  err = gpa_key_trust_operation_start (op);
+  if (err)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 
   return FALSE;
 }
 
+
 static void
 gpa_key_trust_operation_next (GpaKeyTrustOperation *op)
 {
-  if (!GPA_KEY_OPERATION (op)->current ||
-      !gpa_key_trust_operation_start (op))
-    {
-      if (op->modified_keys > 0)
-	{
-	  g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
-	}
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+  gpg_error_t err;
+
+  if (! GPA_KEY_OPERATION (op)->current)
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", 0);
+
+  err = gpa_key_trust_operation_start (op);
+  if (err)
+   {
+     if (op->modified_keys > 0)
+       g_signal_emit_by_name (GPA_OPERATION (op), "changed_wot");
+     g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
+   }
 }
 
+
 static void gpa_key_trust_operation_done_error_cb (GpaContext *context, 
 						  gpg_error_t err,
 						  GpaKeyTrustOperation *op)

Modified: trunk/src/gpaoperation.c
===================================================================
--- trunk/src/gpaoperation.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaoperation.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -25,8 +25,8 @@
 #include "gtktools.h"
 #include "gpgmetools.h"
 #include "i18n.h"
+#include "gpa-marshal.h"
 
-
 #ifndef G_PARAM_STATIC_STRINGS
 #define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK \
                                 | G_PARAM_STATIC_BLURB)
@@ -36,6 +36,7 @@
 enum
 {
   COMPLETED,
+  STATUS,
   LAST_SIGNAL
 };
 
@@ -44,7 +45,6 @@
 {
   PROP_0,
   PROP_WINDOW,
-  PROP_SERVER_CTX
 };
 
 static GObjectClass *parent_class = NULL;
@@ -63,9 +63,6 @@
     case PROP_WINDOW:
       g_value_set_object (value, op->window);
       break;
-    case PROP_SERVER_CTX:
-      g_value_set_pointer (value, op->server_ctx);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -85,9 +82,6 @@
     case PROP_WINDOW:
       op->window = (GtkWidget*) g_value_get_object (value);
       break;
-    case PROP_SERVER_CTX:
-      op->server_ctx = g_value_get_pointer (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -109,7 +103,6 @@
 {
   op->window = NULL;
   op->context = NULL;
-  op->server_ctx = NULL;
 }
 
 static GObject*
@@ -144,28 +137,35 @@
   object_class->get_property = gpa_operation_get_property;
 
   klass->completed = NULL;
+  klass->status = NULL;
 
-  /* Signals */
+  /* Signals.  */
   signals[COMPLETED] =
     g_signal_new ("completed",
 		  G_TYPE_FROM_CLASS (object_class),
-		  G_SIGNAL_RUN_FIRST,
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
 		  G_STRUCT_OFFSET (GpaOperationClass, completed),
 		  NULL, NULL,
-		  g_cclosure_marshal_VOID__VOID,
-		  G_TYPE_NONE, 0);
-  /* Properties */
+		  g_cclosure_marshal_VOID__INT,
+		  G_TYPE_NONE, 1, G_TYPE_INT);
+
+  signals[STATUS] =
+    g_signal_new ("status",
+		  G_TYPE_FROM_CLASS (object_class),
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
+		  G_STRUCT_OFFSET (GpaOperationClass, completed),
+		  NULL, NULL,
+		  gpa_marshal_INT__STRING_STRING,
+		  G_TYPE_INT, 1, G_TYPE_STRING, 1, G_TYPE_STRING);
+
+
+  /* Properties.  */
   g_object_class_install_property 
     (object_class, PROP_WINDOW,
      g_param_spec_object ("window", "Parent window",
                           "Parent window",
                           GTK_TYPE_WIDGET,
                           G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property 
-    (object_class, PROP_SERVER_CTX,
-     g_param_spec_pointer ("server-ctx", "Server Context",
-                           "The Assuan context of the connection",
-                           G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
 }
 
 
@@ -197,10 +197,10 @@
   return operation_type;
 }
 
+
 /* API */
 
-/* Whether the operation is currently busy (i.e. gpg is running).
- */
+/* Whether the operation is currently busy (i.e. gpg is running).  */
 gboolean
 gpa_operation_busy (GpaOperation *op)
 {
@@ -211,58 +211,41 @@
 }
 
 
-/* Tell the UI-server that the current operation has finished with
-   error code ERR.  Note that the server context will be disabled
-   after this operation.  */
-void
-gpa_operation_server_finish (GpaOperation *op, gpg_error_t err)
-{
-  g_return_if_fail (op);
-  g_return_if_fail (GPA_IS_OPERATION (op));
-  if (op->server_ctx)
-    {
-      assuan_context_t ctx = op->server_ctx;
-      op->server_ctx = NULL;
-      gpa_run_server_continuation (ctx, err);
-    }
-}
-
-
-/* If running in server mode, write a status line names STATUSNAME
-   plus space delimited arguments.  */
+/* Emit a status line names STATUSNAME plus space delimited
+   arguments.  */
 gpg_error_t
 gpa_operation_write_status (GpaOperation *op, const char *statusname, ...)
 {
   gpg_error_t err = 0;
+  va_list arg_ptr;
+  char buf[950], *p;
+  const char *text;
+  size_t n;
 
   g_return_val_if_fail (op, gpg_error (GPG_ERR_BUG));
   g_return_val_if_fail (GPA_IS_OPERATION (op), gpg_error (GPG_ERR_BUG));
-  if (op->server_ctx)
-    {
-      assuan_context_t ctx = op->server_ctx;
-      va_list arg_ptr;
-      char buf[950], *p;
-      const char *text;
-      size_t n;
 
-      va_start (arg_ptr, statusname);
-      
-      p = buf; 
-      n = 0;
-      while ( (text = va_arg (arg_ptr, const char *)) )
-        {
-          if (n)
-            {
-              *p++ = ' ';
-              n++;
-            }
-          for ( ; *text && n < DIM (buf)-2; n++)
-            *p++ = *text++;
-        }
-      *p = 0;
-      err = assuan_write_status (ctx, statusname, buf);
-      va_end (arg_ptr);
+  va_start (arg_ptr, statusname);
+
+  p = buf; 
+  n = 0;
+  while ((text = va_arg (arg_ptr, const char *)))
+    {
+      if (n)
+	{
+	  *p++ = ' ';
+	  n++;
+	}
+      for ( ; *text && n < DIM (buf)-2; n++)
+	*p++ = *text++;
     }
+  *p = 0;
 
+  /* FIXME: Get return value.  Might require an allocator to not only
+     get the last one.  */
+  g_signal_emit_by_name (GPA_OPERATION (op), "status", buf);
+  
+  va_end (arg_ptr);
+
   return err;
 }

Modified: trunk/src/gpaoperation.h
===================================================================
--- trunk/src/gpaoperation.h	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaoperation.h	2008-04-25 12:51:19 UTC (rev 877)
@@ -43,14 +43,14 @@
 
   GtkWidget *window;
   GpaContext *context;
-  void *server_ctx;
 };
 
 struct _GpaOperationClass {
   GObjectClass parent_class;
 
   /* Signal handlers */
-  void (*completed) (GpaOperation *operation);
+  void (*completed) (GpaOperation *operation, gpg_error_t err);
+  void (*status) (GpaOperation *operation, gchar *status);
 };
 
 GType gpa_operation_get_type (void) G_GNUC_CONST;
@@ -60,10 +60,6 @@
 /* Whether the operation is currently busy (i.e. gpg is running).  */
 gboolean gpa_operation_busy (GpaOperation *op);
 
-/* Tell the UI-server that the current operation has finished with
-   error code ERR.  Note that the server context will be disabled
-   after this operation. */
-void gpa_operation_server_finish (GpaOperation *op, gpg_error_t err);
 
 /* If running in server mode, write a status line names STATUSNAME
    plus space delimited arguments.  */

Modified: trunk/src/gpaprogressbar.c
===================================================================
--- trunk/src/gpaprogressbar.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpaprogressbar.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -175,7 +175,6 @@
 static void
 progress_cb (GpaContext *context, int current, int total, GpaProgressBar *pbar)
 {
-  g_print ("progress %i %i\n", current, total);
   if (total > 0) 
     gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pbar),
 				   (gdouble) current / (gdouble) total);

Modified: trunk/src/gpastreamencryptop.c
===================================================================
--- trunk/src/gpastreamencryptop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpastreamencryptop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -377,10 +377,7 @@
 
  leave:
   if (err || prep_only)
-    {
-      gpa_operation_server_finish (GPA_OPERATION (op), err);
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
 
@@ -395,10 +392,9 @@
   if (response != GTK_RESPONSE_OK)
     {
       /* The dialog was canceled, so we do nothing and complete the
-       * operation.  */
-      gpa_operation_server_finish (GPA_OPERATION (op), 
+	 operation.  */
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed",
                                    gpg_error (GPG_ERR_CANCELED));
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
       return;
     }
 
@@ -450,24 +446,19 @@
 {
   gtk_widget_hide (GPA_STREAM_OPERATION (op)->progress_dialog);
 
-  /* Tell the server that we finished and delete ourself.  */
-  gpa_operation_server_finish (GPA_OPERATION (op), err);
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
 
 
 
-/************************************************************ 
- **********************  Public API  ************************
- ************************************************************/
+/* Public API.  */
 
-/* Start encrypting INPUT_STREAM to OUTPUT_STREAM using SERVER_CTX and
-   WINDOW.  RECIPIENTS gives a list of recipients and the function
-   matches them with existing keys and selects appropriate keys.
-   RECP_KEYS is either NULL or an array with gpgme keys which will
-   then immediatley be used and suppresses the recipient key selection
-   dialog.
+/* Start encrypting INPUT_STREAM to OUTPUT_STREAM using WINDOW.
+   RECIPIENTS gives a list of recipients and the function matches them
+   with existing keys and selects appropriate keys.  RECP_KEYS is
+   either NULL or an array with gpgme keys which will then immediatley
+   be used and suppresses the recipient key selection dialog.
 
    If it is not possible to unambigiously select keys and SILENT is
    not given, a key selection dialog offers the user a way to manually
@@ -481,8 +472,7 @@
                                   GSList *recipients,
                                   gpgme_key_t *recp_keys,
                                   gpgme_protocol_t protocol,
-                                  int silent,
-                                  void *server_ctx)
+                                  int silent)
 {
   GpaStreamEncryptOperation *op;
 
@@ -495,7 +485,6 @@
                      "recipients", copy_recipients (recipients),
                      "recipient-keys", gpa_gpgme_copy_keyarray (recp_keys),
                      "protocol", (int)protocol,
-                     "server-ctx", server_ctx,
 		     NULL);
 
   return op;

Modified: trunk/src/gpastreamencryptop.h
===================================================================
--- trunk/src/gpastreamencryptop.h	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpastreamencryptop.h	2008-04-25 12:51:19 UTC (rev 877)
@@ -69,8 +69,7 @@
                                   GSList *recipients,
                                   gpgme_key_t *recp_keys,
                                   gpgme_protocol_t protocol,
-                                  int silent,
-                                  void *server_ctx);
+                                  int silent);
 
 gpgme_key_t *gpa_stream_encrypt_operation_get_keys 
 (GpaStreamEncryptOperation *op, gpgme_protocol_t *r_protocol);

Modified: trunk/src/gpastreamsignop.c
===================================================================
--- trunk/src/gpastreamsignop.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpastreamsignop.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -279,10 +279,8 @@
     {
       gpgme_key_t key = cur->data;
       err = gpgme_signers_add (GPA_OPERATION (op)->context->ctx, key);
-      if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
-	{
-	  gpa_gpgme_error (err);
-	}
+      if (err)
+	gpa_gpgme_error (err);
     }
 
   return TRUE;
@@ -358,10 +356,7 @@
 
  leave:
   if (err || prep_only)
-    {
-      gpa_operation_server_finish (GPA_OPERATION (op), err);
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
-    }
+    g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
 
@@ -376,10 +371,9 @@
   if (response != GTK_RESPONSE_OK)
     {
       /* The dialog was canceled, so we do nothing and complete the
-       * operation.  */
-      gpa_operation_server_finish (GPA_OPERATION (op), 
-                                   gpg_error (GPG_ERR_CANCELED));
-      g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+	 operation.  */
+      g_signal_emit_by_name (GPA_OPERATION (op), "completed",
+			     gpg_error (GPG_ERR_CANCELED));
       return;
     }
 
@@ -427,21 +421,17 @@
 {
   gtk_widget_hide (GPA_STREAM_OPERATION (op)->progress_dialog);
 
-  /* Tell the server that we finished and delete ourself.  */
-  gpa_operation_server_finish (GPA_OPERATION (op), err);
-  g_signal_emit_by_name (GPA_OPERATION (op), "completed");
+  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
 }
 
 
 
 
-/************************************************************ 
- **********************  Public API  ************************
- ************************************************************/
+/* Public API.  */
 
-/* Start signing INPUT_STREAM to OUTPUT_STREAM using SERVER_CTX and
-   WINDOW.  SENDER gives the name of the sender's role (usually a
-   mailbox) or is NULL for the default sender.
+/* Start signing INPUT_STREAM to OUTPUT_STREAM using WINDOW.  SENDER
+   gives the name of the sender's role (usually a mailbox) or is NULL
+   for the default sender.
 
    If it is not possible to unambigiously select a signing key a key
    selection dialog offers the user a way to manually select signing
@@ -452,10 +442,9 @@
 gpa_stream_sign_operation_new (GtkWidget *window,
                                gpgme_data_t input_stream,
                                gpgme_data_t output_stream,
-                               const char *sender,
+                               const gchar *sender,
                                gpgme_protocol_t protocol,
-                               gboolean detached,
-                               void *server_ctx)
+                               gboolean detached)
 {
   GpaStreamSignOperation *op;
 
@@ -466,7 +455,6 @@
                      "sender", sender,
                      "protocol", (int)protocol,
                      "detached", detached,
-                     "server-ctx", server_ctx,
 		     NULL);
 
   return op;

Modified: trunk/src/gpastreamsignop.h
===================================================================
--- trunk/src/gpastreamsignop.h	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/gpastreamsignop.h	2008-04-25 12:51:19 UTC (rev 877)
@@ -66,10 +66,9 @@
 gpa_stream_sign_operation_new (GtkWidget *window,
                                gpgme_data_t input_stream,
                                gpgme_data_t output_stream,
-                               const char *sender,
+                               const gchar *sender,
                                gpgme_protocol_t protocol,
-                               gboolean detached,
-                               void *server_ctx);
+                               gboolean detached);
 
 
 

Modified: trunk/src/server.c
===================================================================
--- trunk/src/server.c	2008-04-24 15:50:00 UTC (rev 876)
+++ trunk/src/server.c	2008-04-25 12:51:19 UTC (rev 877)
@@ -35,6 +35,7 @@
 #include "gpa.h"
 #include "i18n.h"
 #include "gpastreamencryptop.h"
+#include "gpastreamsignop.h"
 
 
 
@@ -80,7 +81,7 @@
   gpgme_protocol_t selected_protocol;
 
   /* The current sender address (malloced). */
-  char *sender;
+  gchar *sender;
 };
 
 
@@ -266,8 +267,10 @@
   ctrl->selected_protocol = GPGME_PROTOCOL_UNKNOWN;
 }
 
+
+/* Forward declaration.  */
+static void run_server_continuation (assuan_context_t ctx, gpg_error_t err);
 
-
 /*  RECIPIENT <recipient>
 
   Set the recipient for the encryption.  <recipient> is an RFC2822
@@ -414,11 +417,14 @@
   op = gpa_stream_encrypt_operation_new (NULL, input_data, output_data,
                                          ctrl->recipients, 
                                          ctrl->recipient_keys,
-                                         protocol,
-                                         0, ctx);
+                                         protocol, 0);
   input_data = output_data = NULL;
+  g_signal_connect_swapped (G_OBJECT (op), "completed",
+			    G_CALLBACK (run_server_continuation), ctx);
   g_signal_connect (G_OBJECT (op), "completed",
                     G_CALLBACK (g_object_unref), NULL);
+  g_signal_connect_swapped (G_OBJECT (op), "status",
+			    G_CALLBACK (assuan_write_status), ctx);
 
   return not_finished (ctrl);
 
@@ -513,14 +519,17 @@
   op = gpa_stream_encrypt_operation_new (NULL, NULL, NULL,
                                          ctrl->recipients,
                                          ctrl->recipient_keys,
-                                         protocol,
-                                         0, ctx);
+                                         protocol, 0);
   /* Store that instance for later use but also install a signal
      handler to unref it.  */
   g_object_ref (op);
   ctrl->gpa_op = GPA_OPERATION (op);
+  g_signal_connect_swapped (G_OBJECT (op), "completed",
+			    G_CALLBACK (run_server_continuation), ctx);
   g_signal_connect (G_OBJECT (op), "completed",
                     G_CALLBACK (g_object_unref), NULL);
+  g_signal_connect_swapped (G_OBJECT (op), "status",
+			    G_CALLBACK (assuan_write_status), ctx);
 
   return not_finished (ctrl);
 
@@ -592,8 +601,8 @@
   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
   gpg_error_t err;
   gpgme_protocol_t protocol = 0;
-  int detached;
-  GpaStreamEncryptOperation *op;
+  gboolean detached;
+  GpaStreamSignOperation *op;
   gpgme_data_t input_data = NULL;
   gpgme_data_t output_data = NULL;
 
@@ -672,10 +681,15 @@
 
   ctrl->cont_cmd = cont_sign;
   op = gpa_stream_sign_operation_new (NULL, input_data, output_data,
-                                      ctrl->sender, protocol, detached, ctx);
+                                      ctrl->sender, protocol, detached);
   input_data = output_data = NULL;
+  g_signal_connect_swapped (G_OBJECT (op), "completed",
+			    G_CALLBACK (run_server_continuation), ctx);
   g_signal_connect (G_OBJECT (op), "completed",
                     G_CALLBACK (g_object_unref), NULL);
+  g_signal_connect_swapped (G_OBJECT (op), "status",
+			    G_CALLBACK (assuan_write_status), ctx);
+
   return not_finished (ctrl);
 
  leave:
@@ -867,8 +881,8 @@
 
 /* If the assuan context CTX has a registered continuation function,
    run it.  */
-void
-gpa_run_server_continuation (assuan_context_t ctx, gpg_error_t err)
+static void
+run_server_continuation (assuan_context_t ctx, gpg_error_t err)
 {
   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
   void (*cont_cmd) (assuan_context_t, gpg_error_t);



More information about the Gpa-commits mailing list