Commit 963f873c authored by Radush Niemczyk's avatar Radush Niemczyk
Browse files

Added ALT + 1,2,3,4 navigation.

Added new signal for navigation to concrete page.
Added new shortucts descriptions to the "Keyboard Shortcuts".

Fixes #167
parent 4da5e1e2
Pipeline #245972 passed with stage
in 4 minutes and 29 seconds
......@@ -54,6 +54,34 @@
<property name="title" translatable="yes" context="shortcut window">Go to the previous section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;1</property>
<property name="title" translatable="yes" context="shortcut window">Go to the first section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;2</property>
<property name="title" translatable="yes" context="shortcut window">Go to the second section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;3</property>
<property name="title" translatable="yes" context="shortcut window">Go to the third section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;4</property>
<property name="title" translatable="yes" context="shortcut window">Go to the fourth section</property>
</object>
</child>
</object>
</child>
<child>
......
......@@ -133,6 +133,27 @@ public class Window : Hdy.ApplicationWindow {
"change-page", 1,
typeof (int), 1);
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@1,
Gdk.ModifierType.MOD1_MASK,
"set-page", 1,
typeof (int), 1);
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@2,
Gdk.ModifierType.MOD1_MASK,
"set-page", 1,
typeof (int), 2);
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@3,
Gdk.ModifierType.MOD1_MASK,
"set-page", 1,
typeof (int), 3);
Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@4,
Gdk.ModifierType.MOD1_MASK,
"set-page", 1,
typeof (int), 4);
Gtk.StyleContext style = get_style_context ();
if (Config.PROFILE == "Devel") {
style.add_class ("devel");
......@@ -181,6 +202,27 @@ public class Window : Hdy.ApplicationWindow {
}
}
[Signal (action = true)]
public virtual signal void set_page (int index) {
switch (index) {
case 1:
stack.visible_child = world;
break;
case 2:
stack.visible_child = alarm;
break;
case 3:
stack.visible_child = stopwatch;
break;
case 4:
stack.visible_child = timer;
break;
default:
stack.error_bell ();
break;
}
}
private void on_show_primary_menu_activate (SimpleAction action) {
var state = ((!) action.get_state ()).get_boolean ();
action.set_state (new Variant.boolean (!state));
......
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