|
|
562801 |
From 251d1783834f2da5f5219f6102d69b74636772bd Mon Sep 17 00:00:00 2001
|
|
|
562801 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
562801 |
Date: Fri, 18 Jul 2014 13:44:53 +0200
|
|
|
562801 |
Subject: [LIBREPORT PATCH 47/93] gui: close ask dialogues on Enter key
|
|
|
562801 |
|
|
|
562801 |
Related to rhbz#1067123
|
|
|
562801 |
|
|
|
562801 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
562801 |
|
|
|
562801 |
Conflicts:
|
|
|
562801 |
src/gui-wizard-gtk/wizard.c
|
|
|
562801 |
---
|
|
|
562801 |
src/gtk-helpers/ask_dialogs.c | 7 ++++++-
|
|
|
562801 |
src/gui-wizard-gtk/wizard.c | 3 +++
|
|
|
562801 |
2 files changed, 9 insertions(+), 1 deletion(-)
|
|
|
562801 |
|
|
|
562801 |
diff --git a/src/gtk-helpers/ask_dialogs.c b/src/gtk-helpers/ask_dialogs.c
|
|
|
562801 |
index d188dc5..81beea4 100644
|
|
|
562801 |
--- a/src/gtk-helpers/ask_dialogs.c
|
|
|
562801 |
+++ b/src/gtk-helpers/ask_dialogs.c
|
|
|
562801 |
@@ -81,8 +81,11 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
|
|
|
562801 |
/* let's try to use the text as markup
|
|
|
562801 |
* this allows us to use hyperlinks to man pages */
|
|
|
562801 |
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), message);
|
|
|
562801 |
- gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
|
|
|
562801 |
+ /* Follow GTK3's yes-no-buttons order:
|
|
|
562801 |
+ * [No] [Yes]
|
|
|
562801 |
+ */
|
|
|
562801 |
GtkWidget *no_button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("_No"), GTK_RESPONSE_NO);
|
|
|
562801 |
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
|
|
|
562801 |
|
|
|
562801 |
gint response = GTK_RESPONSE_NO;
|
|
|
562801 |
g_signal_connect(G_OBJECT(dialog), "response",
|
|
|
562801 |
@@ -101,6 +104,8 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
|
|
|
562801 |
G_CALLBACK(on_toggle_ask_yes_no_yesforever_cb), (gpointer)no_button);
|
|
|
562801 |
}
|
|
|
562801 |
|
|
|
562801 |
+ /* Esc -> No, Enter -> Yes */
|
|
|
562801 |
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
|
|
|
562801 |
gtk_widget_show(ask_yes_no_cb);
|
|
|
562801 |
gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
562801 |
|
|
|
562801 |
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
|
|
562801 |
index 197492a..1fbe290 100644
|
|
|
562801 |
--- a/src/gui-wizard-gtk/wizard.c
|
|
|
562801 |
+++ b/src/gui-wizard-gtk/wizard.c
|
|
|
562801 |
@@ -1635,6 +1635,7 @@ static char *ask_helper(const char *msg, void *args, bool password)
|
|
|
562801 |
GTK_BUTTONS_OK_CANCEL,
|
|
|
562801 |
"%s", msg);
|
|
|
562801 |
char *tagged_msg = tag_url(msg, "\n");
|
|
|
562801 |
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
|
|
|
562801 |
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg);
|
|
|
562801 |
free(tagged_msg);
|
|
|
562801 |
|
|
|
562801 |
@@ -1687,6 +1688,8 @@ static int run_event_gtk_ask_yes_no(const char *msg, void *args)
|
|
|
562801 |
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg);
|
|
|
562801 |
free(tagged_msg);
|
|
|
562801 |
|
|
|
562801 |
+ /* Esc -> No, Enter -> Yes */
|
|
|
562801 |
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
|
|
|
562801 |
const int ret = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES;
|
|
|
562801 |
|
|
|
562801 |
gtk_widget_destroy(dialog);
|
|
|
562801 |
--
|
|
|
562801 |
1.8.3.1
|
|
|
562801 |
|