[gnome-sudoku] Reset earmark_pickers when clearing board.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Reset earmark_pickers when clearing board.
- Date: Thu, 4 Sep 2014 21:42:06 +0000 (UTC)
commit 36bd74366cdc9ce5bd953f924060d5810e1ae428
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Sep 1 18:32:42 2014 +0200
Reset earmark_pickers when clearing board.
https://bugzilla.gnome.org/show_bug.cgi?id=735494
lib/sudoku-game.vala | 1 -
src/gnome-sudoku.vala | 1 +
src/sudoku-view.vala | 14 ++++++++++++++
3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/lib/sudoku-game.vala b/lib/sudoku-game.vala
index b32ff32..5817749 100644
--- a/lib/sudoku-game.vala
+++ b/lib/sudoku-game.vala
@@ -79,7 +79,6 @@ public class SudokuGame : Object
}
}
}
- board.earmarks = new bool[board.rows, board.cols, board.max_val];
}
public void cell_changed_cb (int row, int col, int old_val, int new_val)
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index b86f957..ba4b25f 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -322,6 +322,7 @@ public class Sudoku : Gtk.Application
dialog.response.connect ((response_id) => {
if (response_id == ResponseType.OK)
{
+ view.clear ();
game.reset ();
undo_action.set_enabled (false);
redo_action.set_enabled (false);
diff --git a/src/sudoku-view.vala b/src/sudoku-view.vala
index 50dc60d..8773d5d 100644
--- a/src/sudoku-view.vala
+++ b/src/sudoku-view.vala
@@ -346,6 +346,13 @@ private class SudokuCellView : Gtk.DrawingArea
notify_property ("value");
}
}
+
+ public void clear ()
+ {
+ if (earmark_picker != null)
+ for (var i = 0; i < game.board.max_val; i++)
+ earmark_picker.set_earmark (row, col, i, false);
+ }
}
public class SudokuView : Gtk.AspectFrame
@@ -512,6 +519,13 @@ public class SudokuView : Gtk.AspectFrame
return false;
}
+ public void clear ()
+ {
+ for (var i = 0; i < game.board.rows; i++)
+ for (var j = 0; j < game.board.cols; j++)
+ cells[i,j].clear ();
+ }
+
private bool _show_warnings = false;
public bool show_warnings
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]