add Alt+Left (back) and Ctrl+F (search) keybindings

This commit is contained in:
guinux 2017-06-03 15:58:43 +02:00
parent 4c903f3679
commit 31d8491874
4 changed files with 17 additions and 4 deletions

View File

@ -50,7 +50,7 @@ namespace Pamac {
var action = new SimpleAction ("quit", null); var action = new SimpleAction ("quit", null);
action.activate.connect (() => {this.quit ();}); action.activate.connect (() => {this.quit ();});
this.add_action (action); this.add_action (action);
string[] accels = {"<Control>Q", "<Control>W"}; string[] accels = {"<Ctrl>Q", "<Ctrl>W"};
this.set_accels_for_action ("app.quit", accels); this.set_accels_for_action ("app.quit", accels);
// back accel // back accel
action = new SimpleAction ("back", null); action = new SimpleAction ("back", null);
@ -58,6 +58,12 @@ namespace Pamac {
this.add_action (action); this.add_action (action);
accels = {"<Alt>Left"}; accels = {"<Alt>Left"};
this.set_accels_for_action ("app.back", accels); 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 = {"<Ctrl>F"};
this.set_accels_for_action ("app.search", accels);
} }
} }

View File

@ -61,7 +61,7 @@ namespace Pamac {
[GtkChild] [GtkChild]
Gtk.TreeViewColumn aur_state_column; Gtk.TreeViewColumn aur_state_column;
[GtkChild] [GtkChild]
Gtk.Stack filters_stack; public Gtk.Stack filters_stack;
[GtkChild] [GtkChild]
Gtk.StackSwitcher filters_stackswitcher; Gtk.StackSwitcher filters_stackswitcher;
[GtkChild] [GtkChild]

View File

@ -46,11 +46,18 @@ namespace Pamac {
msg.destroy (); msg.destroy ();
} else { } else {
updater_window = new UpdaterWindow (this); updater_window = new UpdaterWindow (this);
// quit accel
var action = new SimpleAction ("quit", null); var action = new SimpleAction ("quit", null);
action.activate.connect (() => {this.quit ();}); action.activate.connect (() => {this.quit ();});
this.add_action (action); this.add_action (action);
string[] accels = {"<Control>Q", "<Control>W"}; string[] accels = {"<Ctrl>Q", "<Ctrl>W"};
this.set_accels_for_action ("app.quit", accels); 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 = {"<Alt>Left"};
this.set_accels_for_action ("app.back", accels);
} }
} }

View File

@ -201,7 +201,7 @@ namespace Pamac {
} }
[GtkCallback] [GtkCallback]
void on_button_back_clicked () { public void on_button_back_clicked () {
if (aur_scrolledwindow.visible) { if (aur_scrolledwindow.visible) {
stackswitcher.visible = true; stackswitcher.visible = true;
stack.visible_child_name = previous_visible_child_name; stack.visible_child_name = previous_visible_child_name;