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



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

    mame: 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/mame/configure.ac         |    1 -
 plugins/mame/src/mame-plugin.vala |   15 ++++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/plugins/mame/configure.ac b/plugins/mame/configure.ac
index 1c96731..42931c9 100644
--- a/plugins/mame/configure.ac
+++ b/plugins/mame/configure.ac
@@ -3,7 +3,6 @@ PKG_CHECK_MODULES(MAME_PLUGIN, [
        glib-2.0 >= $GLIB_MIN_VERSION
        gtk+-3.0
        retro-gtk-0.10
-       tracker-sparql-1.0
 ], [enable_mame_plugin=yes], [enable_mame_plugin=no])
 
 AM_CONDITIONAL(ENABLE_MAME_PLUGIN, test x$enable_mame_plugin != xno)
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index 6e93279..2382730 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -1,17 +1,18 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.MamePlugin : Object, Plugin {
-       private const string SEARCHED_MIME_TYPE = "application/zip";
+       private const string MIME_TYPE = "application/zip";
 
-       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 MameGameUriAdapter ();
                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 (MIME_TYPE);
 
-               return source;
+               return { factory };
        }
 }
 


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