From 31d8491874e9d0d4348203351cfa9436d4eaa401 Mon Sep 17 00:00:00 2001 From: guinux Date: Sat, 3 Jun 2017 15:58:43 +0200 Subject: [PATCH] add Alt+Left (back) and Ctrl+F (search) keybindings --- src/manager.vala | 8 +++++++- src/manager_window.vala | 2 +- src/updater.vala | 9 ++++++++- src/updater_window.vala | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/manager.vala b/src/manager.vala index 46f2f4f..e59fa9f 100644 --- a/src/manager.vala +++ b/src/manager.vala @@ -50,7 +50,7 @@ namespace Pamac { var action = new SimpleAction ("quit", null); action.activate.connect (() => {this.quit ();}); this.add_action (action); - string[] accels = {"Q", "W"}; + string[] accels = {"Q", "W"}; this.set_accels_for_action ("app.quit", accels); // back accel action = new SimpleAction ("back", null); @@ -58,6 +58,12 @@ namespace Pamac { this.add_action (action); accels = {"Left"}; this.set_accels_for_action ("app.back", accels); + // search accel + action = new SimpleAction ("search", null); + action.activate.connect (() => {manager_window.filters_stack.visible_child_name = "search";}); + this.add_action (action); + accels = {"F"}; + this.set_accels_for_action ("app.search", accels); } } diff --git a/src/manager_window.vala b/src/manager_window.vala index 79e5dab..31da6d7 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -61,7 +61,7 @@ namespace Pamac { [GtkChild] Gtk.TreeViewColumn aur_state_column; [GtkChild] - Gtk.Stack filters_stack; + public Gtk.Stack filters_stack; [GtkChild] Gtk.StackSwitcher filters_stackswitcher; [GtkChild] diff --git a/src/updater.vala b/src/updater.vala index 05a547a..6384ae6 100644 --- a/src/updater.vala +++ b/src/updater.vala @@ -46,11 +46,18 @@ namespace Pamac { msg.destroy (); } else { updater_window = new UpdaterWindow (this); + // quit accel var action = new SimpleAction ("quit", null); action.activate.connect (() => {this.quit ();}); this.add_action (action); - string[] accels = {"Q", "W"}; + string[] accels = {"Q", "W"}; this.set_accels_for_action ("app.quit", accels); + // back accel + action = new SimpleAction ("back", null); + action.activate.connect (() => {updater_window.on_button_back_clicked ();}); + this.add_action (action); + accels = {"Left"}; + this.set_accels_for_action ("app.back", accels); } } diff --git a/src/updater_window.vala b/src/updater_window.vala index e9c68de..dda9d6c 100644 --- a/src/updater_window.vala +++ b/src/updater_window.vala @@ -201,7 +201,7 @@ namespace Pamac { } [GtkCallback] - void on_button_back_clicked () { + public void on_button_back_clicked () { if (aur_scrolledwindow.visible) { stackswitcher.visible = true; stack.visible_child_name = previous_visible_child_name;