[gnome-games/wip/exalm/pause-collection: 1/2] game-collection: Add 'paused' property



commit abff126d33930f8bc8a7d4084242449c9eef1c5e
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Feb 14 10:11:45 2019 +0500

    game-collection: Add 'paused' property

 src/core/game-collection.vala | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/core/game-collection.vala b/src/core/game-collection.vala
index ce954868..3dacd275 100644
--- a/src/core/game-collection.vala
+++ b/src/core/game-collection.vala
@@ -10,6 +10,8 @@ private class Games.GameCollection : Object {
        private HashTable<string, Array<UriGameFactory>> factories_for_mime_type;
        private HashTable<string, Array<UriGameFactory>> factories_for_scheme;
 
+       public bool paused { get; set; }
+
        construct {
                games = new GenericSet<Game> (Game.hash, Game.equal);
                factories_for_mime_type = new HashTable<string, Array<UriGameFactory>> (str_hash, str_equal);
@@ -61,10 +63,16 @@ private class Games.GameCollection : Object {
                return games[0];
        }
 
-       public async void search_games () {
+       public async bool search_games () {
                foreach (var source in sources)
-                       foreach (var uri in source)
+                       foreach (var uri in source) {
+                               if (paused)
+                                       return false;
+
                                yield add_uri (uri);
+                       }
+
+               return true;
        }
 
        private async UriGameFactory[] get_factories_for_uri (Uri uri) {


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