Skip to content

Commit

Permalink
add Ctrl+o and Ctrl+q shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed May 27, 2017
1 parent 1b279ae commit 6f50f2c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ public class Pdftag : ApplicationWindow {

this.add (grid);

this.add_accels ();

/* handle first argument -- it only works as an absolute path */
if (args[1] != null) {
this.filename = args[1];
Expand All @@ -235,6 +237,21 @@ public class Pdftag : ApplicationWindow {

}

[Signal (action = true)]
private signal void open_file_dialog ();

[Signal (action = true)]
private signal void quit_app ();

private void add_accels () {
var accel_group = new AccelGroup ();
this.add_accel_group (accel_group);
this.open_file_dialog.connect (on_open_clicked);
this.quit_app.connect (Gtk.main_quit);
this.add_accelerator ("open_file_dialog", accel_group, Gdk.keyval_from_name ("o"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE);
this.add_accelerator ("quit_app", accel_group, Gdk.keyval_from_name ("q"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE);
}

private void on_creation_now_clicked () {
this.creation_date = new DateTime.now_local ();
this.creation_date_btn.label = creation_date.format (this.date_format);
Expand Down

0 comments on commit 6f50f2c

Please sign in to comment.