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

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