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



commit d571a46a24c1db51e8d73d1901e1c8f99531db58
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 4 15:38:22 2017 +0200

    nes: 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/nes/configure.ac        |    1 -
 plugins/nes/src/nes-plugin.vala |   24 ++++++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/plugins/nes/configure.ac b/plugins/nes/configure.ac
index d8e54b9..db22db9 100644
--- a/plugins/nes/configure.ac
+++ b/plugins/nes/configure.ac
@@ -3,7 +3,6 @@ PKG_CHECK_MODULES(NES_PLUGIN, [
        glib-2.0 >= $GLIB_MIN_VERSION
        gtk+-3.0
        retro-gtk-0.10
-       tracker-sparql-1.0
 ], [enable_nes_plugin=yes], [enable_nes_plugin=no])
 
 AM_CONDITIONAL(ENABLE_NES_PLUGIN, test x$enable_nes_plugin != xno)
diff --git a/plugins/nes/src/nes-plugin.vala b/plugins/nes/src/nes-plugin.vala
index a51fd5e..3534731 100644
--- a/plugins/nes/src/nes-plugin.vala
+++ b/plugins/nes/src/nes-plugin.vala
@@ -12,19 +12,23 @@ private class Games.NesPlugin : Object, Plugin {
        private const string MODULE_BASENAME = "libretro-nes.so";
        private const bool SUPPORTS_SNAPSHOTTING = true;
 
-       public GameSource? get_game_source () throws Error {
+       public string[] get_mime_types () {
+               return {
+                       NES_MIME_TYPE,
+                       FDS_MIME_TYPE,
+               };
+       }
+
+       public UriGameFactory[] get_uri_game_factories () {
                var nes_game_uri_adapter = new GenericSyncGameUriAdapter (nes_game_for_uri);
-               var fds_game_uri_adapter = new GenericSyncGameUriAdapter (fds_game_for_uri);
                var nes_factory = new GenericUriGameFactory (nes_game_uri_adapter);
+               nes_factory.add_mime_type (NES_MIME_TYPE);
+
+               var fds_game_uri_adapter = new GenericSyncGameUriAdapter (fds_game_for_uri);
                var fds_factory = new GenericUriGameFactory (fds_game_uri_adapter);
-               var nes_query = new MimeTypeTrackerQuery (NES_MIME_TYPE, nes_factory);
-               var fds_query = new MimeTypeTrackerQuery (FDS_MIME_TYPE, fds_factory);
-               var connection = Tracker.Sparql.Connection.@get ();
-               var source = new TrackerGameSource (connection);
-               source.add_query (nes_query);
-               source.add_query (fds_query);
-
-               return source;
+               fds_factory.add_mime_type (FDS_MIME_TYPE);
+
+               return { nes_factory, fds_factory };
        }
 
        private static Game nes_game_for_uri (string uri) throws Error {


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