From 149c0306923ab32329a9a16f15ca0ba18e000989 Mon Sep 17 00:00:00 2001 From: Timo Kluck Date: Mon, 11 Mar 2013 13:36:18 -0700 Subject: [PATCH] Question dialog should give focus to OK Button: Closes #6506 --- src/client/dialogs/alert-dialog.vala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/dialogs/alert-dialog.vala b/src/client/dialogs/alert-dialog.vala index d3e580f1..6c291a9f 100644 --- a/src/client/dialogs/alert-dialog.vala +++ b/src/client/dialogs/alert-dialog.vala @@ -29,6 +29,12 @@ abstract class AlertDialog : Object { public Gtk.Box get_message_area() { return (Gtk.Box) dialog.get_message_area(); } + + public void set_focus_response(Gtk.ResponseType response) { + Gtk.Widget? to_focus = dialog.get_widget_for_response(Gtk.ResponseType.OK); + if (to_focus != null) + to_focus.grab_focus(); + } // Runs dialog, destroys it, and returns selected response public Gtk.ResponseType run() { @@ -78,6 +84,9 @@ class QuestionDialog : AlertDialog { // this must be done once all the packing is completed get_message_area().show_all(); + + // the check box may have grabbed keyboard focus, so we put it back to the button + set_focus_response(Gtk.ResponseType.OK); is_checked = checkbox_default; }