Browse Source

Support closing app via Ctrl+W or Ctrl+Q

tags/v1.0.0
Matt Baer 6 years ago
parent
commit
ffe3ae65fe
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      src/window.vala

+ 11
- 0
src/window.vala View File

@@ -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…
Cancel
Save