[gnome-2048] Keep custom size at restoration.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048] Keep custom size at restoration.
- Date: Thu, 7 Feb 2019 13:13:47 +0000 (UTC)
commit 3f59d600cf79ed10f5cca282e7b46dfa238ffd1b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Feb 7 14:09:36 2019 +0100
Keep custom size at restoration.
The restored game is overwriting
the custom size but that doesn't
feel great if it's an usual one.
src/game.vala | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index 291c645..45929db 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -164,10 +164,18 @@ private class Game : Object
_init_background ();
_restore_foreground (true);
- settings.delay ();
- settings.set_int ("rows", _grid.rows);
- settings.set_int ("cols", _grid.cols);
- settings.apply ();
+ int rows = _grid.rows;
+ int cols = _grid.cols;
+ if ((rows == 3 && cols != 3)
+ || (rows == 4 && cols != 4)
+ || (rows == 5 && cols != 5)
+ || (rows != 3 && rows != 4 && rows != 5))
+ {
+ settings.delay ();
+ settings.set_int ("rows", rows);
+ settings.set_int ("cols", cols);
+ settings.apply ();
+ }
debug ("game restored successfully");
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]