[iagno] Do not notify when unneeded.



commit 059fe47970fb3807dc34824b9cadab764b423823
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Feb 7 22:22:28 2019 +0100

    Do not notify when unneeded.

 src/computer-player.vala |  2 +-
 src/game-view.vala       | 14 +++++++-------
 src/game.vala            | 23 ++++++++++++-----------
 3 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 5a3a4b0..1234aba 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -64,7 +64,7 @@ public class ComputerPlayer : Object
      * The mutex is only needed for its memory barrier. */
     private bool _move_pending;
     private RecMutex _move_pending_mutex;
-    private bool move_pending
+    [CCode (notify = false)] private bool move_pending
     {
         get
         {
diff --git a/src/game-view.vala b/src/game-view.vala
index 3ec3aec..e940be9 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -21,7 +21,7 @@
 public class GameView : Gtk.DrawingArea
 {
     private Gtk.DrawingArea _scoreboard;
-    public Gtk.DrawingArea scoreboard {
+    [CCode (notify = false)] public Gtk.DrawingArea scoreboard {
         private get { return _scoreboard; }
         set
         {
@@ -60,15 +60,15 @@ public class GameView : Gtk.DrawingArea
 
     // private int margin_width = 0;
 
-    public string sound_flip     { get; private set; }
-    public string sound_gameover { get; private set; }
+    [CCode (notify = false)] public string sound_flip     { get; private set; }
+    [CCode (notify = false)] public string sound_gameover { get; private set; }
 
     /* Utilities, see calculate () */
     private int paving_size;
     private int tile_size;
     private int board_size;
-    private int board_x { get { return (get_allocated_width () - board_size) / 2; }}
-    private int board_y { get { return (get_allocated_height () - board_size) / 2; }}
+    [CCode (notify = false)] private int board_x { get { return (get_allocated_width () - board_size) / 2; }}
+    [CCode (notify = false)] private int board_y { get { return (get_allocated_height () - board_size) / 2; 
}}
 
     /* Keyboard */
     private bool show_highlight;
@@ -101,7 +101,7 @@ public class GameView : Gtk.DrawingArea
 
     private bool game_is_set = false;
     private Game _game;
-    public Game game
+    [CCode (notify = false)] public Game game
     {
         get
         {
@@ -135,7 +135,7 @@ public class GameView : Gtk.DrawingArea
     }
 
     private string? _theme = null;
-    public string? theme
+    [CCode (notify = false)] public string? theme
     {
         get { return _theme; }
         set {
diff --git a/src/game.vala b/src/game.vala
index 4ffbaea..9a858ac 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -24,7 +24,7 @@ public class Game : Object
     private Player[,] tiles;
 
     private int _size;
-    public int size
+    [CCode (notify = false)] public int size
     {
         get { return _size; }
         private set { _size = value; }
@@ -36,12 +36,13 @@ public class Game : Object
 
     /* Color to move next; Dark always plays first;
      * should be dark if number_of_moves % 2 == 0 */
-    public Player current_color { get; private set; default = Player.DARK; }
-    public int number_of_moves { get; private set; default = 0; }
+    [CCode (notify = false)] public Player current_color { get; private set; default = Player.DARK; }
+    [CCode (notify = false)] public int number_of_moves { get; private set; default = 0; }
 
     /* Indicate who's the next player who can move */
-    public bool current_player_can_move { get; private set; default = true; }
-    public bool is_complete { get; private set; default = false; }
+    [CCode (notify = false)] public bool current_player_can_move { get; private set; default = true; }
+    // there's a race for the final "counter" turn, and looks like notifying here helps, not sure why // 
TODO fix the race
+    [CCode (notify = true)] public bool is_complete { get; private set; default = false; }
 
     /* Indicate that a player should move */
     public signal void turn_ended ();
@@ -52,25 +53,25 @@ public class Game : Object
     * * Number of tiles on the board
     \*/
 
-    public int initial_number_of_tiles { get; private set; }
-    public int n_tiles
+    [CCode (notify = false)] public int initial_number_of_tiles { get; private set; }
+    [CCode (notify = false)] public int n_tiles
     {
         get { return n_dark_tiles + n_light_tiles; }
     }
 
     private int _n_light_tiles = 2;
-    public int n_light_tiles
+    [CCode (notify = false)] public int n_light_tiles
     {
         get { return _n_light_tiles; }
     }
 
     private int _n_dark_tiles = 2;
-    public int n_dark_tiles
+    [CCode (notify = false)] public int n_dark_tiles
     {
         get { return _n_dark_tiles; }
     }
 
-    public int n_current_tiles
+    [CCode (notify = false)] public int n_current_tiles
     {
         get { return current_color == Player.LIGHT ? n_light_tiles : n_dark_tiles; }
         private set {
@@ -81,7 +82,7 @@ public class Game : Object
         }
     }
 
-    public int n_opponent_tiles
+    [CCode (notify = false)] public int n_opponent_tiles
     {
         get { return current_color == Player.DARK ? n_light_tiles : n_dark_tiles; }
         private set {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]