[gnome-klotski/arnaudb/wip/gtk4: 17/25] Container is gone.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-klotski/arnaudb/wip/gtk4: 17/25] Container is gone.
- Date: Tue, 29 Sep 2020 13:44:32 +0000 (UTC)
commit 65a007e1b69a99d6ebdcb63a58b9e9905f9bf84b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jun 1 22:36:06 2020 +0200
Container is gone.
src/klotski-window.vala | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/klotski-window.vala b/src/klotski-window.vala
index 5b6cfb9..a605249 100644
--- a/src/klotski-window.vala
+++ b/src/klotski-window.vala
@@ -70,6 +70,7 @@ private class KlotskiWindow : ApplicationWindow
private bool puzzle_init_done = false;
private Puzzle puzzle;
+ private const string [] level_packs = { "huarong", "challenge", "skill" };
private int current_pack = -1;
private int current_level = -1;
@@ -610,7 +611,7 @@ private class KlotskiWindow : ApplicationWindow
view.show ();
view.hexpand = true;
view.vexpand = true;
- main_grid.add (view);
+ view.insert_before (main_grid, /* insert last */ null);
load_solved_state (); // TODO use GSettings, or the history…
@@ -764,7 +765,7 @@ private class KlotskiWindow : ApplicationWindow
private void start_puzzle_cb ()
{
- TreeView tree = ((TreeView) (((ScrolledWindow) (stack_puzzles.get_children ().nth_data
(current_pack))).get_child ()));
+ TreeView tree = (TreeView) (((ScrolledWindow) (stack_puzzles.get_child_by_name (level_packs
[current_pack]))).get_child ());
TreeModel? model = tree.get_model ();
if (model == null)
assert_not_reached ();
@@ -796,7 +797,7 @@ private class KlotskiWindow : ApplicationWindow
current_pack = current_level_pack;
/* select or not a level */
- TreeSelection selection = ((TreeView) (((ScrolledWindow) (stack_puzzles.get_children ().nth_data
(current_pack))).get_child ())).get_selection ();
+ TreeSelection selection = ((TreeView) (((ScrolledWindow) (stack_puzzles.get_child_by_name
(level_packs [current_pack]))).get_child ())).get_selection ();
if (current_pack == current_level_pack)
selection.select_iter (iter);
else
@@ -805,8 +806,8 @@ private class KlotskiWindow : ApplicationWindow
update_buttons_state ();
/* update stacks */
- stack_packs.set_visible_child (stack_packs.get_children ().nth_data (current_pack));
- stack_puzzles.set_visible_child (stack_puzzles.get_children ().nth_data (current_pack));
+ stack_packs.set_visible_child_name (level_packs [current_pack]);
+ stack_puzzles.set_visible_child_name (level_packs [current_pack]);
}
private void update_buttons_state ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]