[Gpa-commits] r987 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Apr 26 20:32:24 CEST 2009


Author: moritzs
Date: 2009-04-26 20:32:23 +0200 (Sun, 26 Apr 2009)
New Revision: 987

Modified:
   trunk/src/ChangeLog
   trunk/src/options.c
Log:
2009-04-26  Moritz  <moritz at gnu.org>

	* options.c (determine_default_key): Replaced dummy code with
	working code.



Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-04-23 07:27:07 UTC (rev 986)
+++ trunk/src/ChangeLog	2009-04-26 18:32:23 UTC (rev 987)
@@ -1,3 +1,8 @@
+2009-04-26  Moritz  <moritz at gnu.org>
+
+	* options.c (determine_default_key): Replaced dummy code with
+	working code.
+
 2009-04-20  Moritz  <moritz at gnu.org>
 
 	* cm-openpgp.c (save_attr): Call gpa_cm_object_alert_dialog()

Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c	2009-04-23 07:27:07 UTC (rev 986)
+++ trunk/src/options.c	2009-04-26 18:32:23 UTC (rev 987)
@@ -279,35 +279,37 @@
 {
   gpgme_key_t key = NULL;
   gpg_error_t err;
-  gpgme_ctx_t ctx/* = gpa_gpgme_new ()*/;
+  gpgme_ctx_t ctx;
 
-  return NULL;
+  ctx = gpa_gpgme_new ();
+  if (!ctx)
+    return NULL;
 
   err = gpgme_op_keylist_start (ctx, NULL, 1);
-  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
+  if (err)
     {
-      gpa_gpgme_warning (err);
+      gpa_gpgme_error (err); 	/* Or should we use
+				   gpa_gpgme_warning()?  -mo*/
     }
   else
     {
       err = gpgme_op_keylist_next (ctx, &key);
-      if (gpg_err_code (err) == GPG_ERR_NO_ERROR)
+      if (!err)
 	{
+	  /* Got a new key. */
 	  err = gpgme_op_keylist_end (ctx);
 	  if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
 	    {
 	      gpa_gpgme_warning (err); 
 	    }
 	}
-      else if (gpg_err_code (err) == GPG_ERR_EOF)
+      else if (gpg_err_code (err) != GPG_ERR_EOF)
 	{
-	  /* No secret keys found */
+	  gpa_gpgme_error (err); 	/* Or should we use
+					   gpa_gpgme_warning()?  -mo*/
 	}
-      else
-	{
-	  gpa_gpgme_warning (err);
-	}
     }
+
   gpgme_release (ctx);
   return key;
 }



More information about the Gpa-commits mailing list