[gnome-keyring/dbus-api] Fix prompting problems.



commit ac87793ad5800d5f6d788954451715ab115ea3c4
Author: Stef Walter <stef memberwebs com>
Date:   Fri Nov 6 04:36:19 2009 +0000

    Fix prompting problems.
    
     * Initialize libgcrypt properly, which fixed hangs due to libgcrypt
       falling into strange modes when not initialized.
     * Debugging and keyboard grabbing toggles.

 daemon/prompt/gkd-prompt-tool.c |    6 +++++-
 daemon/prompt/gkd-prompt.c      |    6 ++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/daemon/prompt/gkd-prompt-tool.c b/daemon/prompt/gkd-prompt-tool.c
index c46a232..26bc2f1 100644
--- a/daemon/prompt/gkd-prompt-tool.c
+++ b/daemon/prompt/gkd-prompt-tool.c
@@ -25,6 +25,7 @@
 #include "gkd-prompt-util.h"
 
 #include "egg/egg-dh.h"
+#include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
 
 #include <gcrypt.h>
@@ -50,6 +51,7 @@ static gpointer the_key = NULL;
 static gsize n_the_key = 0;
 
 #define LOG_ERRORS 1
+#define GRAB_KEYBOARD 1
 
 /* ------------------------------------------------------------------------------ */
 
@@ -65,7 +67,7 @@ static gboolean
 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
 	GdkGrabStatus status;
-	if (!keyboard_grabbed) {
+	if (!keyboard_grabbed && GRAB_KEYBOARD) {
 		status = gdk_keyboard_grab (win->window, FALSE, gdk_event_get_time (event));
 		if (status == GDK_GRAB_SUCCESS) {
 			keyboard_grabbed = TRUE;
@@ -580,6 +582,8 @@ main (int argc, char *argv[])
 
 	prepare_logging ();
 
+	egg_libgcrypt_initialize ();
+
 	input_data = g_key_file_new ();
 	output_data = g_key_file_new ();
 
diff --git a/daemon/prompt/gkd-prompt.c b/daemon/prompt/gkd-prompt.c
index 4d12f13..3a4c437 100644
--- a/daemon/prompt/gkd-prompt.c
+++ b/daemon/prompt/gkd-prompt.c
@@ -34,6 +34,7 @@
 #include <gcrypt.h>
 
 #define DEBUG_PROMPT 1
+#define DEBUG_STDERR 0
 
 enum {
 	RESPONDED,
@@ -390,6 +391,11 @@ display_async_prompt (GkdPrompt *self)
 	callbacks.completed = on_io_completed;
 	callbacks.finalize_func = g_object_unref;
 
+#ifdef DEBUG_STDERR
+	/* Let stderr show through if desired */
+	callbacks.standard_error = NULL;
+#endif
+
 	self->pv->io_tag = egg_spawn_async_with_callbacks (NULL, argv, envp, G_SPAWN_DO_NOT_REAP_CHILD,
 	                                                   &self->pv->pid, &callbacks, g_object_ref (self),
 	                                                   NULL, &error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]