[gnome-games] generic: Add GenericUriGameFactory.query_game_for_uri()



commit b0fc9e1dac39c09c344ae1c19a2b25ab3eedb366
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri May 5 10:45:39 2017 +0200

    generic: Add GenericUriGameFactory.query_game_for_uri()
    
    This will be used to lookup is a game corresponding to some URI exists
    in the URI game factory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780320

 src/generic/generic-uri-game-factory.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/generic/generic-uri-game-factory.vala b/src/generic/generic-uri-game-factory.vala
index e38a6a6..c1015ee 100644
--- a/src/generic/generic-uri-game-factory.vala
+++ b/src/generic/generic-uri-game-factory.vala
@@ -41,6 +41,16 @@ public class Games.GenericUriGameFactory : Object, UriGameFactory {
                }
        }
 
+       public async Game? query_game_for_uri (string uri) {
+               Idle.add (this.query_game_for_uri.callback);
+               yield;
+
+               if (game_for_uri.contains (uri))
+                       return game_for_uri[uri];
+
+               return null;
+       }
+
        public async void foreach_game (GameCallback game_callback) {
                uint handled_uris = 0;
                var games = game_for_uri.get_values ();


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