Commit 32cc13a6 authored by Paolo Borelli's avatar Paolo Borelli
Browse files

Switch pages with ctrl+alt+page_up/down

parent 8e30b9fb
......@@ -113,6 +113,20 @@ public class Window : Gtk.ApplicationWindow {
stack.child_set_property (timer, "needs-attention", timer.state == Timer.Face.State.RUNNING);
});
unowned Gtk.BindingSet binding_set = Gtk.BindingSet.by_class (get_class ());
// plain ctrl+page_up/down is easten by the scrolled window...
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.Page_Up,
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK,
"change-page", 1,
typeof(int), -1);
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.Page_Down,
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK,
"change-page", 1,
typeof(int), 1);
stack.visible_child = panels[settings.get_enum ("panel-id")];
update_header_bar ();
......@@ -120,6 +134,19 @@ public class Window : Gtk.ApplicationWindow {
show_all ();
}
[Signal(action = true)]
public virtual signal void change_page (int offset) {
int page;
stack.child_get (stack.visible_child, "position", out page);
page += offset;
if (page >= 0 && page < panels.length) {
stack.visible_child = panels[page];
} else {
stack.error_bell ();
}
}
private void on_new_activate () {
((Clock) stack.visible_child).activate_new ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment