[gnome-games/wip/aplazas/781334-refactor-game-source: 31/35] sega-saturn: Provide MIME types and URI game factories



commit 934b7e64541284e81074cb5a7e00ddb73c59d25c
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 4 15:39:57 2017 +0200

    sega-saturn: Provide MIME types and URI game factories
    
    Also stop providing a GameSource.
    
    This helps splitting the conerns of looking for game resources and
    building games from them.

 plugins/sega-saturn/src/sega-saturn-plugin.vala |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index 7d848e7..18bf608 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -5,15 +5,20 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
        private const string SPECIFIC_MIME_TYPE = "application/x-saturn-rom";
        private const string PLATFORM = "SegaSaturn";
 
-       public GameSource? get_game_source () throws Error {
+       public string[] get_mime_types () {
+               return {
+                       SEARCHED_MIME_TYPE,
+                       SPECIFIC_MIME_TYPE,
+               };
+       }
+
+       public UriGameFactory[] get_uri_game_factories () {
                var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
                var factory = new GenericUriGameFactory (game_uri_adapter);
-               var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, factory);
-               var connection = Tracker.Sparql.Connection.@get ();
-               var source = new TrackerGameSource (connection);
-               source.add_query (query);
+               factory.add_mime_type (SEARCHED_MIME_TYPE);
+               factory.add_mime_type (SPECIFIC_MIME_TYPE);
 
-               return source;
+               return { factory };
        }
 
        private static Game game_for_uri (string uri) throws Error {


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