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



commit deb830972a91f090d9766e53e804f516559a453d
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 4 15:40:07 2017 +0200

    snes: 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/snes/configure.ac         |    1 -
 plugins/snes/src/snes-plugin.vala |   13 +++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/plugins/snes/configure.ac b/plugins/snes/configure.ac
index f59702b..51db2e5 100644
--- a/plugins/snes/configure.ac
+++ b/plugins/snes/configure.ac
@@ -3,7 +3,6 @@ PKG_CHECK_MODULES(SNES_PLUGIN, [
        glib-2.0 >= $GLIB_MIN_VERSION
        gtk+-3.0
        retro-gtk-0.10
-       tracker-sparql-1.0
 ], [enable_snes_plugin=yes], [enable_snes_plugin=no])
 
 AM_CONDITIONAL(ENABLE_SNES_PLUGIN, test x$enable_snes_plugin != xno)
diff --git a/plugins/snes/src/snes-plugin.vala b/plugins/snes/src/snes-plugin.vala
index e2a2530..0abdaa0 100644
--- a/plugins/snes/src/snes-plugin.vala
+++ b/plugins/snes/src/snes-plugin.vala
@@ -5,15 +5,16 @@ private class Games.SnesPlugin : Object, Plugin {
        private const string MIME_TYPE = "application/vnd.nintendo.snes.rom";
        private const string PLATFORM = "SuperNintendoEntertainmentSystem";
 
-       public GameSource? get_game_source () throws Error {
+       public string[] get_mime_types () {
+               return { 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 (MIME_TYPE, factory);
-               var connection = Tracker.Sparql.Connection.@get ();
-               var source = new TrackerGameSource (connection);
-               source.add_query (query);
+               factory.add_mime_type (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]