[gnome-games/wip/aplazas/781334-refactor-game-source: 18/35] game-boy: Provide MIME types and URI game factories
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/781334-refactor-game-source: 18/35] game-boy: Provide MIME types and URI game factories
- Date: Thu, 4 May 2017 16:14:16 +0000 (UTC)
commit e21272129fc3af5f7483774e2f421e26a96f19bb
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/src/game-boy-plugin.vala | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
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]