Blame SOURCES/0040-report-gtk-confirm-the-ask-dialogs-on-Enter.patch

0c9110
From a10a6e9bbe8d53ffe661c180c6e75a4004d5f881 Mon Sep 17 00:00:00 2001
0c9110
From: Jakub Filak <jfilak@redhat.com>
0c9110
Date: Mon, 17 Mar 2014 10:37:58 +0100
0c9110
Subject: [LIBREPORT PATCH 40/93] report-gtk: confirm the ask dialogs on
0c9110
 'Enter'
0c9110
0c9110
This commit adds a convinient way of closing an ask dialog. If user
0c9110
enters some text, hitting 'Enter' key closes the dialog. Closing the
0c9110
dialog with empty input text is not allowed because it is simmilar to
0c9110
clicking 'Cancel' button.
0c9110
0c9110
Related to rhbz#1067123
0c9110
0c9110
Signed-off-by: Jakub Filak <jfilak@redhat.com>
0c9110
---
0c9110
 src/gui-wizard-gtk/wizard.c | 8 ++++++++
0c9110
 1 file changed, 8 insertions(+)
0c9110
0c9110
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
0c9110
index 32e95c0..f8df31a 100644
0c9110
--- a/src/gui-wizard-gtk/wizard.c
0c9110
+++ b/src/gui-wizard-gtk/wizard.c
0c9110
@@ -1608,6 +1608,13 @@ static void run_event_gtk_alert(const char *msg, void *args)
0c9110
     log_request_response_communication(msg, NULL, (struct analyze_event_data *)args);
0c9110
 }
0c9110
 
0c9110
+static void gtk_entry_emit_dialog_response_ok(GtkEntry *entry, GtkDialog *dialog)
0c9110
+{
0c9110
+    /* Don't close the dialogue if the entry is empty */
0c9110
+    if (gtk_entry_get_text_length(entry) > 0)
0c9110
+        gtk_dialog_response(dialog, GTK_RESPONSE_OK);
0c9110
+}
0c9110
+
0c9110
 static char *ask_helper(const char *msg, void *args, bool password)
0c9110
 {
0c9110
     GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant),
0c9110
@@ -1626,6 +1633,7 @@ static char *ask_helper(const char *msg, void *args, bool password)
0c9110
      * g_object_set
0c9110
      */
0c9110
     g_object_set(G_OBJECT(textbox), "editable", TRUE, NULL);
0c9110
+    g_signal_connect(textbox, "activate", G_CALLBACK(gtk_entry_emit_dialog_response_ok), dialog);
0c9110
 
0c9110
     if (password)
0c9110
         gtk_entry_set_visibility(GTK_ENTRY(textbox), FALSE);
0c9110
-- 
0c9110
1.8.3.1
0c9110