Question dialog should give focus to OK Button: Closes #6506
This commit is contained in:
parent
842e390ed1
commit
149c030692
1 changed files with 9 additions and 0 deletions
|
|
@ -30,6 +30,12 @@ abstract class AlertDialog : Object {
|
|||
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() {
|
||||
Gtk.ResponseType response = (Gtk.ResponseType) dialog.run();
|
||||
|
|
@ -79,6 +85,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue