[gnome-tetravex] Combined Solve and new Game-Buttons
- From: Mario Wenzel <mariowenzel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tetravex] Combined Solve and new Game-Buttons
- Date: Wed, 12 Feb 2014 10:00:22 +0000 (UTC)
commit b2fdfffd11a625198cca73fa08beafea89362dc7
Author: Mario Wenzel <maweki gmail com>
Date: Wed Feb 12 10:58:51 2014 +0100
Combined Solve and new Game-Buttons
Buttons are now combined to a stack to reduce clutter.
src/gnome-tetravex.vala | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/gnome-tetravex.vala b/src/gnome-tetravex.vala
index 626854e..12f6c99 100644
--- a/src/gnome-tetravex.vala
+++ b/src/gnome-tetravex.vala
@@ -29,6 +29,8 @@ public class Tetravex : Gtk.Application
Gtk.Image pause_image;
Gtk.Label pause_label;
+ Gtk.Stack new_game_solve_stack;
+
private const GLib.ActionEntry[] action_entries =
{
{ "new-game", new_game_cb },
@@ -106,6 +108,8 @@ public class Tetravex : Gtk.Application
var size = new Gtk.SizeGroup (Gtk.SizeGroupMode.BOTH);
+ new_game_solve_stack = new Gtk.Stack ();
+
var new_game_button = new Gtk.Button ();
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 2);
var image = new Gtk.Image.from_icon_name ("view-refresh-symbolic", Gtk.IconSize.DIALOG);
@@ -118,7 +122,6 @@ public class Tetravex : Gtk.Application
new_game_button.relief = Gtk.ReliefStyle.NONE;
new_game_button.action_name = "app.new-game";
size.add_widget (new_game_button);
- grid.attach (new_game_button, 0, 1, 1, 1);
pause_button = new Gtk.Button ();
box = new Gtk.Box (Gtk.Orientation.VERTICAL, 2);
@@ -132,7 +135,7 @@ public class Tetravex : Gtk.Application
pause_button.relief = Gtk.ReliefStyle.NONE;
pause_button.action_name = "app.pause";
size.add_widget (pause_button);
- grid.attach (pause_button, 1, 1, 1, 1);
+ grid.attach (pause_button, 0, 1, 1, 1);
var solve_button = new Gtk.Button ();
box = new Gtk.Box (Gtk.Orientation.VERTICAL, 2);
@@ -146,7 +149,10 @@ public class Tetravex : Gtk.Application
solve_button.relief = Gtk.ReliefStyle.NONE;
solve_button.action_name = "app.solve";
size.add_widget (solve_button);
- grid.attach (solve_button, 2, 1, 1, 1);
+
+ new_game_solve_stack.add_named(solve_button, "solve");
+ new_game_solve_stack.add_named(new_game_button, "new-game");
+ grid.attach (new_game_solve_stack, 2, 1, 1, 1);
box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2);
box.spacing = 8;
@@ -158,7 +164,7 @@ public class Tetravex : Gtk.Application
box.valign = Gtk.Align.BASELINE;
box.set_margin_top (20);
box.set_margin_bottom (20);
- grid.attach (box, 0, 2, 3, 1);
+ grid.attach (box, 1, 1, 1, 1);
window.show_all ();
@@ -214,6 +220,7 @@ public class Tetravex : Gtk.Application
var pause = lookup_action ("pause") as SimpleAction;
pause.change_state (false);
+ new_game_solve_stack.set_visible_child_name ("solve");
update_button_states ();
}
@@ -289,6 +296,7 @@ public class Tetravex : Gtk.Application
private void solve_cb ()
{
puzzle.solve ();
+ new_game_solve_stack.set_visible_child_name ("new-game");
}
private void help_cb ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]