[gnome-games/wip/aplazas/781334-refactor-game-source: 7/26] game-boy: Provide MIME types and URI game factories



commit df616120d9f35d0fd29c4f3e14a17a2d43352ac1
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 4 15:37:06 2017 +0200

    game-boy: 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/game-boy/configure.ac             |    1 -
 plugins/game-boy/src/game-boy-plugin.vala |   22 ++++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/plugins/game-boy/configure.ac b/plugins/game-boy/configure.ac
index 5a8a5ba..de2a904 100644
--- a/plugins/game-boy/configure.ac
+++ b/plugins/game-boy/configure.ac
@@ -3,7 +3,6 @@ PKG_CHECK_MODULES(GAME_BOY_PLUGIN, [
        glib-2.0 >= $GLIB_MIN_VERSION
        gtk+-3.0
        retro-gtk-0.10
-       tracker-sparql-1.0
 ], [enable_game_boy_plugin=yes], [enable_game_boy_plugin=no])
 
 AM_CONDITIONAL(ENABLE_GAME_BOY_PLUGIN, test x$enable_game_boy_plugin != xno)
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index ba6b91d..6ffbf17 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -10,18 +10,20 @@ private class Games.GameBoyPlugin : Object, Plugin {
        private const string GAME_BOY_COLOR_MIME_TYPE = "application/x-gameboy-color-rom";
        private const string GAME_BOY_COLOR_PLATFORM = "GameBoyColor";
 
-       public GameSource? get_game_source () throws Error {
+       public string[] get_mime_types () {
+               return {
+                       GAME_BOY_MIME_TYPE,
+                       GAME_BOY_COLOR_MIME_TYPE,
+               };
+       }
+
+       public UriGameFactory[] get_uri_game_factories () {
                var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
-               var game_boy_factory = new GenericUriGameFactory (game_uri_adapter);
-               var game_boy_color_factory = new GenericUriGameFactory (game_uri_adapter);
-               var game_boy_query = new MimeTypeTrackerQuery (GAME_BOY_MIME_TYPE, game_boy_factory);
-               var game_boy_color_query = new MimeTypeTrackerQuery (GAME_BOY_COLOR_MIME_TYPE, 
game_boy_color_factory);
-               var connection = Tracker.Sparql.Connection.@get ();
-               var source = new TrackerGameSource (connection);
-               source.add_query (game_boy_query);
-               source.add_query (game_boy_color_query);
+               var factory = new GenericUriGameFactory (game_uri_adapter);
+               factory.add_mime_type (GAME_BOY_MIME_TYPE);
+               factory.add_mime_type (GAME_BOY_COLOR_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]