[gnome-chess] Use Source.CONTINUE and Source.REMOVE



commit 5aa4c980e3bd62f7c5846b052af40672f4b4f919
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Dec 30 21:37:03 2014 -0600

    Use Source.CONTINUE and Source.REMOVE

 lib/chess-clock.vala  |    2 +-
 src/chess-engine.vala |    3 +--
 src/chess-scene.vala  |    4 ++--
 src/gnome-chess.vala  |   11 ++++-------
 4 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/lib/chess-clock.vala b/lib/chess-clock.vala
index 94cba08..142f7f2 100644
--- a/lib/chess-clock.vala
+++ b/lib/chess-clock.vala
@@ -85,7 +85,7 @@ public class ChessClock : Object
             expired ();
         }
 
-        return true;
+        return Source.CONTINUE;
     }
 
     public void stop ()
diff --git a/src/chess-engine.vala b/src/chess-engine.vala
index 87083bc..d1efa47 100644
--- a/src/chess-engine.vala
+++ b/src/chess-engine.vala
@@ -118,8 +118,7 @@ public abstract class ChessEngine : Object
         pending_move_source_id = Timeout.add_seconds (delay_seconds, () => {
             pending_move_source_id = 0;
             request_move ();
-            /* Disconnect from main loop */
-            return false;
+            return Source.REMOVE;
         });
     }
 
diff --git a/src/chess-scene.vala b/src/chess-scene.vala
index 08a173a..640c528 100644
--- a/src/chess-scene.vala
+++ b/src/chess-scene.vala
@@ -361,9 +361,9 @@ public class ChessScene : Object
         changed ();
 
         if (animating)
-            return true;
+            return Source.CONTINUE;
 
         game.remove_hold ();
-        return false;
+        return Source.REMOVE;
     }
 }
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 06f5fc6..dbe5275 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -711,14 +711,12 @@ public class ChessApplication : Gtk.Application
             Timeout.add_seconds (1, () => {
                 if (game.is_paused)
                 {
-                    /* Keep waiting */
-                    return true;
+                    return Source.CONTINUE;
                 }
                 else
                 {
                     do_engine_move (move);
-                    /* Disconnect from main loop */
-                    return false;
+                    return Source.REMOVE;
                 }
             });
         }
@@ -747,8 +745,7 @@ public class ChessApplication : Gtk.Application
         Timeout.add_seconds (2, () => {
             if (game == original_game && game.is_started)
                 game.stop (ChessResult.BUG, ChessRule.BUG);
-            /* Disconnect from the main loop */
-            return false;
+            return Source.REMOVE;
         });
     }
 
@@ -1892,7 +1889,7 @@ public class ChessApplication : Gtk.Application
         settings.set_int ("duration", get_duration ());
         Source.remove (save_duration_timeout);
         save_duration_timeout = 0;
-        return false;
+        return Source.REMOVE;
     }
 
     [CCode (cname = "G_MODULE_EXPORT duration_changed_cb", instance_pos = -1)]


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