Commit 26c615bd authored by Radush Niemczyk's avatar Radush Niemczyk
Browse files

Replaced switch with passing page name and using visible_child_name.

parent c53ac23c
Pipeline #248269 passed with stage
in 4 minutes and 45 seconds
...@@ -137,22 +137,22 @@ public class Window : Hdy.ApplicationWindow { ...@@ -137,22 +137,22 @@ public class Window : Hdy.ApplicationWindow {
Gdk.Key.@1, Gdk.Key.@1,
Gdk.ModifierType.MOD1_MASK, Gdk.ModifierType.MOD1_MASK,
"set-page", 1, "set-page", 1,
typeof (int), 1); typeof (string), "world");
Gtk.BindingEntry.add_signal (binding_set, Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@2, Gdk.Key.@2,
Gdk.ModifierType.MOD1_MASK, Gdk.ModifierType.MOD1_MASK,
"set-page", 1, "set-page", 1,
typeof (int), 2); typeof (string), "alarm");
Gtk.BindingEntry.add_signal (binding_set, Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@3, Gdk.Key.@3,
Gdk.ModifierType.MOD1_MASK, Gdk.ModifierType.MOD1_MASK,
"set-page", 1, "set-page", 1,
typeof (int), 3); typeof (string), "stopwatch");
Gtk.BindingEntry.add_signal (binding_set, Gtk.BindingEntry.add_signal (binding_set,
Gdk.Key.@4, Gdk.Key.@4,
Gdk.ModifierType.MOD1_MASK, Gdk.ModifierType.MOD1_MASK,
"set-page", 1, "set-page", 1,
typeof (int), 4); typeof (string), "timer");
Gtk.StyleContext style = get_style_context (); Gtk.StyleContext style = get_style_context ();
if (Config.PROFILE == "Devel") { if (Config.PROFILE == "Devel") {
...@@ -203,24 +203,8 @@ public class Window : Hdy.ApplicationWindow { ...@@ -203,24 +203,8 @@ public class Window : Hdy.ApplicationWindow {
} }
[Signal (action = true)] [Signal (action = true)]
public virtual signal void set_page (int index) { public virtual signal void set_page (string page) {
switch (index) { stack.visible_child_name = page;
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) { private void on_show_primary_menu_activate (SimpleAction action) {
......
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