[gnome-games] collection-manager: Add support for RecentlyPlayedCollection



commit 668dd583c96169e19c67795e1e051ebe284be8d2
Author: Neville <nevilleantony98 gmail com>
Date:   Sat Jul 18 14:46:55 2020 +0530

    collection-manager: Add support for RecentlyPlayedCollection
    
    Provides update_recently_played_game() which will be called whenever
    a game is run.

 src/collection/collection-manager.vala | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/collection/collection-manager.vala b/src/collection/collection-manager.vala
index 936572507..9dc16551a 100644
--- a/src/collection/collection-manager.vala
+++ b/src/collection/collection-manager.vala
@@ -8,12 +8,14 @@ private class Games.CollectionManager : Object {
        private Database database;
 
        private FavoritesCollection favorites_collection;
+       private RecentlyPlayedCollection recently_played_collection;
 
        public CollectionManager (Database database) {
                this.database = database;
                collections = new HashTable<string, Collection> (str_hash, str_equal);
 
                add_favorites_collection ();
+               add_recently_played_collection ();
 
                collections.foreach ((key, val) => {
                        val.load ();
@@ -43,4 +45,13 @@ private class Games.CollectionManager : Object {
                        return Source.REMOVE;
                });
        }
+
+       private void add_recently_played_collection () {
+               recently_played_collection = new RecentlyPlayedCollection (database);
+               collections[recently_played_collection.get_id ()] = recently_played_collection;
+               Idle.add (() => {
+                       collection_added (recently_played_collection);
+                       return Source.REMOVE;
+               });
+       }
 }


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