Skip to content

Commit de76f94

Browse files
committed
Main: Add Ctrl+Q shortcut (Quit)
1 parent 293853f commit de76f94

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Main.vala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ class GOFI.Main : Gtk.Application {
122122

123123
kbsettings = new KeyBindingSettings ();
124124

125+
var quit_action = new SimpleAction ("quit", null);
126+
quit_action.activate.connect (quit_application);
127+
128+
add_action (quit_action);
129+
set_accels_for_action ("app.quit", { "<Control>q" });
130+
125131
if (info == null) {
126132
info = get_last_list_info ();
127133
}
@@ -131,6 +137,15 @@ class GOFI.Main : Gtk.Application {
131137
win.delete_event.connect (on_win_delete_event);
132138
}
133139

140+
private void quit_application () {
141+
task_timer.stop ();
142+
win.save_win_geometry ();
143+
win.destroy ();
144+
win = null;
145+
task_timer = null;
146+
notification_service = null;
147+
}
148+
134149
private bool on_win_delete_event () {
135150
bool dont_exit = false;
136151
// Save window state upon deleting the window

0 commit comments

Comments
 (0)