[git] Pinentry - branch, master, updated. pinentry-0.9.1-3-g9d2d8b6
by Yuri D'Elia
cvs at cvs.gnupg.org
Thu Apr 16 11:37:37 CEST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".
The branch, master has been updated
via 9d2d8b6bfaf2d5b07e7fb5be7188516e4158ed98 (commit)
from 2bffbbff09177afb75ad667d949eed2a8cb846ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9d2d8b6bfaf2d5b07e7fb5be7188516e4158ed98
Author: Yuri D'Elia <wavexx at users.sourceforge.net>
Date: Thu Apr 16 11:34:58 2015 +0200
gtk: Make Escape key work.
* gtk+-2/pinentry-gtk-2.c: Include gdk/gdkkeysyms.h.
(enter_callback): Pass confirm_value_t to button_clicked.
(confirm_button_clicked): Use confirm_value_t cast.
(cancel_callback): New.
(create_window): Add accelerator for the Escape key.
--
GnuPG-bug-id: 1453
Original patch slighty modified by wk.
diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 0063c3f..b3698c0 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -24,6 +24,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <assert.h>
#include <math.h>
@@ -223,18 +224,34 @@ button_clicked (GtkWidget *widget, gpointer data)
static void
enter_callback (GtkWidget *widget, GtkWidget *anentry)
{
- button_clicked (widget, "ok");
+ button_clicked (widget, (gpointer) CONFIRM_OK);
}
static void
confirm_button_clicked (GtkWidget *widget, gpointer data)
{
- confirm_value = (int)(long) data;
+ confirm_value = (confirm_value_t) data;
gtk_main_quit ();
}
+static void
+cancel_callback (GtkAccelGroup *acc, GObject *accelerable,
+ guint keyval, GdkModifierType modifier, gpointer data)
+{
+ int confirm_mode = !!data;
+
+ if (confirm_mode)
+ confirm_button_clicked (GTK_WIDGET (accelerable),
+ (gpointer)CONFIRM_CANCEL);
+ else
+ button_clicked (GTK_WIDGET (accelerable),
+ (gpointer)CONFIRM_CANCEL);
+}
+
+
+
static gchar *
pinentry_utf8_validate (gchar *text)
{
@@ -328,6 +345,7 @@ create_window (int confirm_mode)
GtkWidget *win, *box;
GtkWidget *wvbox, *chbox, *bbox;
GtkAccelGroup *acc;
+ GClosure *acc_cl;
gchar *msg;
tooltips = gtk_tooltips_new ();
@@ -561,6 +579,11 @@ create_window (int confirm_mode)
G_CALLBACK (confirm_mode ? confirm_button_clicked
: button_clicked),
(gpointer) CONFIRM_CANCEL);
+
+ acc_cl = g_cclosure_new (G_CALLBACK (cancel_callback),
+ (confirm_mode? "":NULL), NULL);
+ gtk_accel_group_connect (acc, GDK_KEY_Escape, 0, 0, acc_cl);
+
GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
}
-----------------------------------------------------------------------
Summary of changes:
gtk+-2/pinentry-gtk-2.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
hooks/post-receive
--
The standard pinentry collection
http://git.gnupg.org
More information about the Gnupg-commits
mailing list