Skip to content

Commit

Permalink
Make the last added button have keyboard focus by default
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Mar 31, 2024
1 parent 5484549 commit de3c55b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Widgets/Dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,14 @@ public class Granite.Dialog : Gtk.Dialog {
};
set_titlebar (titlebar);
}

/**
* Behaves as described in {@link Gtk.Dialog.add_button}. The last button to be added
* will have keyboard focus by default.
*/
public new unowned Gtk.Widget add_button (string button_text, int response_id) {
unowned var button = base.add_button (button_text, response_id);
button.grab_focus ();
return button;
}
}

0 comments on commit de3c55b

Please sign in to comment.