[svn] GnuPG - r5266 - in branches/STABLE-BRANCH-2-0: agent po

svn author wk cvs at cvs.gnupg.org
Wed Feb 17 20:00:04 CET 2010


Author: wk
Date: 2010-02-17 20:00:04 +0100 (Wed, 17 Feb 2010)
New Revision: 5266

Modified:
   branches/STABLE-BRANCH-2-0/agent/ChangeLog
   branches/STABLE-BRANCH-2-0/agent/call-pinentry.c
   branches/STABLE-BRANCH-2-0/po/POTFILES.in
   branches/STABLE-BRANCH-2-0/po/de.po
Log:
Provide default strings for pinentry.


Modified: branches/STABLE-BRANCH-2-0/agent/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-2-0/agent/ChangeLog	2010-02-17 12:34:03 UTC (rev 5265)
+++ branches/STABLE-BRANCH-2-0/agent/ChangeLog	2010-02-17 19:00:04 UTC (rev 5266)
@@ -1,5 +1,10 @@
+2010-02-17  Werner Koch  <wk at g10code.com>
+
+	* call-pinentry.c (start_pinentry): Always free OPTSTR.  Send
+	default-xxx strings.
+
 2010-02-11  Marcus Brinkmann  <marcus at g10code.de>
- 
+
 	From trunk 2009-09-23, 2009-11-02, 2009-11-04, 2009-11-05, 2009-11-25,
 	2009-12-08:
 

Modified: branches/STABLE-BRANCH-2-0/agent/call-pinentry.c
===================================================================
--- branches/STABLE-BRANCH-2-0/agent/call-pinentry.c	2010-02-17 12:34:03 UTC (rev 5265)
+++ branches/STABLE-BRANCH-2-0/agent/call-pinentry.c	2010-02-17 19:00:04 UTC (rev 5266)
@@ -1,5 +1,6 @@
-/* call-pinentry.c - fork of the pinentry to query stuff from the user
- * Copyright (C) 2001, 2002, 2004, 2007, 2008 Free Software Foundation, Inc.
+/* call-pinentry.c - Spawn the pinentry to query stuff from the user
+ * Copyright (C) 2001, 2002, 2004, 2007, 2008,
+ *               2010  Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -361,6 +362,7 @@
 	return unlock_pinentry (out_of_core ());
       rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
 			    NULL);
+      xfree (optstr);
       if (rc)
 	return unlock_pinentry (rc);
     }
@@ -371,6 +373,7 @@
 	return unlock_pinentry (out_of_core ());
       rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
 			    NULL);
+      xfree (optstr);
       if (rc)
 	return unlock_pinentry (rc);
     }
@@ -381,10 +384,37 @@
 	return unlock_pinentry (out_of_core ());
       rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
 			    NULL);
+      xfree (optstr);
       if (rc)
 	return unlock_pinentry (rc);
     }
 
+  {
+    /* Provide a few default strings for use by the pinentries.  This
+       may help a pinentry to avoid implementing localization code.  */
+    static struct { const char *key, *value; } tbl[] = {
+      /* TRANSLATORS: These are labels for buttons etc used in
+         Pinentries.  A underscore indicates that the next letter
+         should be used as an accelerator.  The actual to be
+         translated text starts after the second vertical bar.  */
+      { "ok",     N_("|pinentry-label|_OK") },
+      { "cancel", N_("|pinentry-label|_Cancel") },
+      { NULL, NULL}
+    };
+    char *optstr;
+    int idx;
+
+    for (idx=0; tbl[idx].key; idx++)
+      {
+        if (asprintf (&optstr, "OPTION default-ok=%s",
+                      tbl[idx].key, _(tbl[idx].value)) < 0 )
+          return unlock_pinentry (out_of_core ());
+        assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
+                         NULL);
+        xfree (optstr);
+      }
+  }
+
   
   /* Tell the pinentry the name of a file it shall touch after having
      messed with the tty.  This is optional and only supported by
@@ -923,7 +953,7 @@
   if (notok)
     {
       /* Try to use the newer NOTOK feature if a cancel button is
-         requested.  If no cacnel button is requested we keep on using
+         requested.  If no cancel button is requested we keep on using
          the standard cancel.  */
       if (with_cancel)
         {

Modified: branches/STABLE-BRANCH-2-0/po/POTFILES.in
===================================================================
--- branches/STABLE-BRANCH-2-0/po/POTFILES.in	2010-02-17 12:34:03 UTC (rev 5265)
+++ branches/STABLE-BRANCH-2-0/po/POTFILES.in	2010-02-17 19:00:04 UTC (rev 5266)
@@ -9,6 +9,7 @@
 agent/protect-tool.c
 agent/trustlist.c
 agent/findkey.c
+agent/call-pinentry.c
 
 common/exechelp.c
 common/http.c

Modified: branches/STABLE-BRANCH-2-0/po/de.po  [not shown]




More information about the Gnupg-commits mailing list