[svn] pinentry - r238 - in trunk: . gtk+-2 pinentry

svn author wk cvs at cvs.gnupg.org
Thu Sep 30 17:17:09 CEST 2010


Author: wk
Date: 2010-09-30 17:17:08 +0200 (Thu, 30 Sep 2010)
New Revision: 238

Modified:
   trunk/ChangeLog
   trunk/gtk+-2/pinentry-gtk-2.c
   trunk/pinentry/pinentry.c
   trunk/pinentry/pinentry.h
Log:
Return a bit of button info.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-09-22 11:30:06 UTC (rev 237)
+++ trunk/ChangeLog	2010-09-30 15:17:08 UTC (rev 238)
@@ -1,3 +1,10 @@
+2010-09-30  Werner Koch  <wk at g10code.com>
+
+	* pinentry/pinentry.h (struct pinentry): Add CLOSE_BUTTON.
+	* pinentry/pinentry.c (cmd_getpin, cmd_confirm, cmd_message): Send
+	BUTTON_INFO.
+	* gtk+-2/pinentry-gtk-2.c (delete_event): Set close_button.
+
 2010-09-22  Werner Koch  <wk at g10code.com>
 
 	* gtk+-2/pinentry-gtk-2.c (create_window): Make use of

Modified: trunk/gtk+-2/pinentry-gtk-2.c
===================================================================
--- trunk/gtk+-2/pinentry-gtk-2.c	2010-09-22 11:30:06 UTC (rev 237)
+++ trunk/gtk+-2/pinentry-gtk-2.c	2010-09-30 15:17:08 UTC (rev 238)
@@ -1,7 +1,7 @@
 /* pinentry-gtk-2.c
    Copyright (C) 1999 Robert Bihlmeyer <robbe at orcus.priv.at>
    Copyright (C) 2001, 2002, 2007 g10 Code GmbH
-   Copyright (C) 2004 by Albrecht Dreß <albrecht.dress at arcor.de>
+   Copyright (C) 2004 by Albrecht Dreß <albrecht.dress at arcor.de>
 
    pinentry-gtk-2 is a pinentry application for the Gtk+-2 widget set.
    It tries to follow the Gnome Human Interface Guide as close as
@@ -161,6 +161,7 @@
 static int
 delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
+  pinentry->close_button = 1;
   gtk_main_quit ();
   return TRUE;
 }

Modified: trunk/pinentry/pinentry.c
===================================================================
--- trunk/pinentry/pinentry.c	2010-09-22 11:30:06 UTC (rev 237)
+++ trunk/pinentry/pinentry.c	2010-09-30 15:17:08 UTC (rev 238)
@@ -80,7 +80,8 @@
     0,		/* Parent Window ID.  */
     NULL,       /* Touch file.  */
     0,		/* Result.  */
-    0,		/* Result Not-OK.  */
+    0,		/* Canceled.  */
+    0,		/* Close button flag.  */
     0,          /* Locale error flag. */
     0,          /* One-button flag.  */
     NULL,       /* Quality-Bar flag and description.  */
@@ -890,6 +891,7 @@
       set_prompt = 1;
     }
   pinentry.locale_err = 0;
+  pinentry.close_button = 0;
   pinentry.one_button = 0;
   pinentry.ctx_assuan = ctx;
   result = (*pinentry_cmd_handler) (&pinentry);
@@ -904,6 +906,9 @@
 
   pinentry.quality_bar = 0;  /* Reset it after the command.  */
 
+  if (pinentry.close_button)
+    assuan_write_status (ctx, "BUTTON_INFO", "close");
+
   if (result < 0)
     {
       if (pinentry.pin)
@@ -945,6 +950,7 @@
 
   pinentry.one_button = !!strstr (line, "--one-button");
   pinentry.quality_bar = 0;
+  pinentry.close_button = 0;
   pinentry.locale_err = 0;
   pinentry.canceled = 0;
   result = (*pinentry_cmd_handler) (&pinentry);
@@ -954,6 +960,9 @@
       pinentry.error = NULL;
     }
 
+  if (pinentry.close_button)
+    assuan_write_status (ctx, "BUTTON_INFO", "close");
+
   return result ? 0
                 : (pinentry.locale_err? ASSUAN_Locale_Problem
                                       : (pinentry.one_button 
@@ -971,6 +980,7 @@
 
   pinentry.one_button = 1;
   pinentry.quality_bar = 0;
+  pinentry.close_button = 0;
   pinentry.locale_err = 0;
   result = (*pinentry_cmd_handler) (&pinentry);
   if (pinentry.error)
@@ -979,6 +989,9 @@
       pinentry.error = NULL;
     }
 
+  if (pinentry.close_button)
+    assuan_write_status (ctx, "BUTTON_INFO", "close");
+
   return result ? 0 
                 : (pinentry.locale_err? ASSUAN_Locale_Problem
                                       : 0);

Modified: trunk/pinentry/pinentry.h
===================================================================
--- trunk/pinentry/pinentry.h	2010-09-22 11:30:06 UTC (rev 237)
+++ trunk/pinentry/pinentry.h	2010-09-30 15:17:08 UTC (rev 238)
@@ -98,6 +98,11 @@
      conversion occured. */
   int locale_err;
 
+  /* The user should set this to true if the window close button has
+     been used.  This flag is used in addition to a regular return
+     value.  */
+  int close_button;
+
   /* The caller should set this to true if only one button is
      required.  This is useful for notification dialogs where only a
      dismiss button is required. */





More information about the Gnupg-commits mailing list