[gnome-keyring/dbus-api] Return the response text properly from prompt.



commit eafcca4e0c719d3aa49a7b10c5d9da49be37ac7d
Author: Stef Walter <stef memberwebs com>
Date:   Thu Nov 5 06:27:01 2009 +0000

    Return the response text properly from prompt.
    
    Return the appropriate response text from the prompt.

 daemon/dbus/gkd-secrets-prompt.c |    2 +-
 daemon/prompt/gkd-prompt-tool.c  |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/daemon/dbus/gkd-secrets-prompt.c b/daemon/dbus/gkd-secrets-prompt.c
index 195e325..f745bca 100644
--- a/daemon/dbus/gkd-secrets-prompt.c
+++ b/daemon/dbus/gkd-secrets-prompt.c
@@ -156,7 +156,7 @@ gkd_secrets_prompt_responded (GkdPrompt *base)
 	gint res;
 
 	res = gkd_prompt_get_response (GKD_PROMPT (self));
-	if (res == GKD_RESPONSE_NO || res == GKD_RESPONSE_FAILURE) {
+	if (res <= GKD_RESPONSE_NO) {
 		gkd_secrets_prompt_dismiss (self);
 		return FALSE;
 	}
diff --git a/daemon/prompt/gkd-prompt-tool.c b/daemon/prompt/gkd-prompt-tool.c
index 774fe1f..259a137 100644
--- a/daemon/prompt/gkd-prompt-tool.c
+++ b/daemon/prompt/gkd-prompt-tool.c
@@ -296,6 +296,30 @@ gather_password (GtkBuilder *builder, const gchar *password_type)
 }
 
 static void
+gather_response (gint response)
+{
+	const gchar *value = NULL;
+
+	switch (response) {
+	case GTK_RESPONSE_OK:
+		value = "ok";
+		break;
+	case GTK_RESPONSE_CANCEL:
+	case GTK_RESPONSE_DELETE_EVENT:
+		value = "no";
+		break;
+	case GTK_RESPONSE_APPLY:
+		value = "other";
+		break;
+	default:
+		g_return_if_reached ();
+		break;
+	}
+
+	g_key_file_set_value (output_data, "prompt", "response", value);
+}
+
+static void
 gather_dialog (GtkBuilder *builder, GtkDialog *dialog)
 {
 	gather_password (builder, "password");
@@ -337,6 +361,7 @@ run_dialog (void)
 		break;
 	}
 
+	gather_response (res);
 	g_object_unref (builder);
 }
 



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