[svn] pinentry - r217 - in trunk: . doc gtk+-2 pinentry
svn author wk
cvs at cvs.gnupg.org
Fri Feb 19 13:14:24 CET 2010
Author: wk
Date: 2010-02-19 13:14:23 +0100 (Fri, 19 Feb 2010)
New Revision: 217
Modified:
trunk/ChangeLog
trunk/doc/pinentry.texi
trunk/gtk+-2/pinentry-gtk-2.c
trunk/pinentry/pinentry.c
trunk/pinentry/pinentry.h
Log:
Implement a default-prompt option.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-02-17 18:58:39 UTC (rev 216)
+++ trunk/ChangeLog 2010-02-19 12:14:23 UTC (rev 217)
@@ -1,3 +1,12 @@
+2010-02-19 Werner Koch <wk at g10code.com>
+
+ * gtk+-2/pinentry-gtk-2.c (create_window): Allow mnemonics in
+ button labels.
+
+ * pinentry/pinentry.h (struct pinentry): Add default_prompt.
+ * pinentry/pinentry.c (option_handler): Support "default-prompt".
+ (cmd_getpin): Use it.
+
2010-02-17 Werner Koch <wk at g10code.com>
* pinentry/pinentry.h (struct pinentry): Add default_ok and
Modified: trunk/doc/pinentry.texi
===================================================================
--- trunk/doc/pinentry.texi 2010-02-17 18:58:39 UTC (rev 216)
+++ trunk/doc/pinentry.texi 2010-02-19 12:14:23 UTC (rev 217)
@@ -203,7 +203,6 @@
by some background process which does not have any information on the
locale and terminal to use. Assuan protocol options are an
alternative way to pass these information.
-
@end table
@c
@@ -251,6 +250,12 @@
S: OK
@end example
+You should use an underscore in the text only if you known that a modern
+version of pinentry is used. Modern versions underline the next
+character after the underscore and use the first such underlined
+character as a keyboard accelerator. Use a double underscore to escape
+an underscore.
+
@item Set the window title
This command may be used to change the default window title. When
using this feature you should take care that the window is still
@@ -261,21 +266,36 @@
@end example
@item Set the button texts
-There are two text with can be set to override the English defaults:
+There are three texts which should be used to override the English
+defaults:
To set the text for the button signaling confirmation (in UTF-8).
+See SETPROMPT on how to use an keyboard accelerator.
@example
C: SETOK Yes
S: OK
@end example
+
To set the text for the button signaling cancellation or disagreement
-(in UTF-8).
+(in UTF-8). See SETPROMPT on how to use an keyboard accelerator.
@example
C: SETCANCEL No
S: OK
@end example
+
+In case tree buttons are required, use the follwing command to set the
+text (UTF-8) for the non-affirmative response button. The affirmative button
+text is still set using SETOK and the CANCEL button text with SETCANCEL.
+See SETPROMPT on how to use an keyboard accelerator.
+ at example
+ C: SETNOTOK Do not do this
+ S: OK
+ at end example
+
+
+
@item Set the Error text
This is used by the client to display an error message. In contrast
to the other commands this error message is automatically reset with
@@ -368,6 +388,22 @@
appropriate for this tty and @code{lc-ctype} to the locale which
defines the character set to use for this terminal.
+ at item Set the default strings
+To avoid having transaltions in Pinentry proper, the caller may set
+certain translated strings which are used by Pinentry as default
+strings.
+
+ at example
+ C: OPTION default-ok=_Korrekt
+ S: OK
+ C: OPTION default-cancel=Abbruch
+ S: OK
+ C: OPTION default-prompt=PIN eingeben:
+ S: OK
+ at end example
+The strings are subject to accelerator marking, see SETPROMPT for
+details.
+
@end table
@c ---------------------------------------------------------------------
Modified: trunk/gtk+-2/pinentry-gtk-2.c
===================================================================
--- trunk/gtk+-2/pinentry-gtk-2.c 2010-02-17 18:58:39 UTC (rev 216)
+++ trunk/gtk+-2/pinentry-gtk-2.c 2010-02-19 12:14:23 UTC (rev 217)
@@ -58,8 +58,10 @@
static GtkWidget *entry;
static GtkWidget *qualitybar;
+#ifdef ENABLE_ENHANCED
static GtkWidget *insure;
static GtkWidget *time_out;
+#endif
static GtkTooltips *tooltips;
/* Gnome hig small and large space in pixels. */
@@ -67,10 +69,10 @@
#define HIG_LARGE 12
/* The text shown in the quality bar when no text is shown. This is not
- * the empty string, becase because with an empty string the height of
+ * the empty string, because with an empty string the height of
* the quality bar is less than with a non-empty string. This results
* in ugly layout changes when the text changes from non-empty to empty
- * and vice versa */
+ * and vice versa. */
#define QUALITYBAR_EMPTY_TEXT " "
@@ -360,7 +362,7 @@
if (pinentry->prompt)
{
msg = pinentry_utf8_validate (pinentry->prompt);
- w = gtk_label_new (msg);
+ w = gtk_label_new_with_mnemonic (msg);
g_free (msg);
gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), w, 0, 1, 0, 1,
@@ -438,7 +440,7 @@
if (pinentry->cancel)
{
msg = pinentry_utf8_validate (pinentry->cancel);
- w = gtk_button_new_with_label (msg);
+ w = gtk_button_new_with_mnemonic (msg);
g_free (msg);
}
else
@@ -454,7 +456,7 @@
if (confirm_mode && !pinentry->one_button && pinentry->notok)
{
msg = pinentry_utf8_validate (pinentry->notok);
- w = gtk_button_new_with_label (msg);
+ w = gtk_button_new_with_mnemonic (msg);
g_free (msg);
gtk_container_add (GTK_CONTAINER (bbox), w);
@@ -467,7 +469,7 @@
if (pinentry->ok)
{
msg = pinentry_utf8_validate (pinentry->ok);
- w = gtk_button_new_with_label (msg);
+ w = gtk_button_new_with_mnemonic (msg);
g_free (msg);
}
else
Modified: trunk/pinentry/pinentry.c
===================================================================
--- trunk/pinentry/pinentry.c 2010-02-17 18:58:39 UTC (rev 216)
+++ trunk/pinentry/pinentry.c 2010-02-19 12:14:23 UTC (rev 217)
@@ -82,6 +82,7 @@
0,
NULL, /* default_ok */
NULL, /* default_cancel */
+ NULL, /* default_prompt */
NULL /* Assuan context. */
};
@@ -673,6 +674,12 @@
if (!pinentry.default_cancel)
return ASSUAN_Out_Of_Core;
}
+ else if (!strcmp (key, "default-prompt"))
+ {
+ pinentry.default_prompt = noprefix_strdup (value);
+ if (!pinentry.default_prompt)
+ return ASSUAN_Out_Of_Core;
+ }
else
return ASSUAN_Invalid_Option;
return 0;
@@ -870,7 +877,7 @@
return ASSUAN_Out_Of_Core;
if (!pinentry.prompt)
{
- pinentry.prompt = "PIN:";
+ pinentry.prompt = pinentry.default_prompt?pinentry.default_prompt:"PIN:";
set_prompt = 1;
}
pinentry.locale_err = 0;
Modified: trunk/pinentry/pinentry.h
===================================================================
--- trunk/pinentry/pinentry.h 2010-02-17 18:58:39 UTC (rev 216)
+++ trunk/pinentry/pinentry.h 2010-02-19 12:14:23 UTC (rev 217)
@@ -120,10 +120,11 @@
int color_so_bright;
/* Malloced and i18ned default strings or NULL. These strings may
- include an underscore character to indicate an accelerator
- key. */
+ include an underscore character to indicate an accelerator key.
+ A double underscore represents a plain one. */
char *default_ok;
char *default_cancel;
+ char *default_prompt;
/* For the quality indicator we need to do an inquiry. Thus we need
to save the assuan ctx. */
More information about the Gnupg-commits
mailing list