Support closing app via Ctrl+W or Ctrl+Q
This commit is contained in:
parent
fdfbfb2645
commit
ffe3ae65fe
@ -225,6 +225,12 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
|
||||
focus of this app. */
|
||||
var accels = new Gtk.AccelGroup();
|
||||
|
||||
accels.connect(Gdk.Key.W, Gdk.ModifierType.CONTROL_MASK,
|
||||
Gtk.AccelFlags.VISIBLE | Gtk.AccelFlags.LOCKED,
|
||||
(g,a,k,m) => quit());
|
||||
accels.connect(Gdk.Key.Q, Gdk.ModifierType.CONTROL_MASK,
|
||||
Gtk.AccelFlags.VISIBLE | Gtk.AccelFlags.LOCKED,
|
||||
(g,a,k,m) => quit());
|
||||
accels.connect(Gdk.Key.S, Gdk.ModifierType.CONTROL_MASK,
|
||||
Gtk.AccelFlags.VISIBLE | Gtk.AccelFlags.LOCKED,
|
||||
(g,a,k,m) => save_as());
|
||||
@ -279,6 +285,11 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
|
||||
file.load_contents(null, out text, null);
|
||||
canvas.buffer.text = (string) text;
|
||||
}
|
||||
|
||||
private bool quit() {
|
||||
this.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
errordomain WriteAs.UserCancellable {USER_CANCELLED}
|
||||
|
Loading…
Reference in New Issue
Block a user