[gnome-games/wip/aplazas/781334-refactor-game-source: 24/35] mega-drive: 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: 24/35] mega-drive: Provide MIME types and URI game factories
- Date: Thu, 4 May 2017 16:14:46 +0000 (UTC)
commit f56431e7fc2d04af7aec6c7cfff54ccb70d2fa0c
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu May 4 15:37:59 2017 +0200
mega-drive: 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/mega-drive/src/mega-drive-plugin.vala | 35 ++++++++++++++----------
1 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index 3663b4e..454a3fd 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -19,24 +19,29 @@ private class Games.MegaDrivePlugin : Object, Plugin {
private const string MEGA_CD_PLATFORM = "SegaCD";
private const string MEGA_CD_32X_PLATFORM = "SegaCD32X";
- public GameSource? get_game_source () throws Error {
+ public string[] get_mime_types () {
+ return {
+ MEGA_DRIVE_MIME_TYPE,
+ 32X_MIME_TYPE,
+ PICO_MIME_TYPE,
+ CUE_MIME_TYPE,
+ MEGA_CD_MIME_TYPE,
+ };
+ }
+
+ public UriGameFactory[] get_uri_game_factories () {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ factory.add_mime_type (MEGA_DRIVE_MIME_TYPE);
+ factory.add_mime_type (32X_MIME_TYPE);
+ factory.add_mime_type (PICO_MIME_TYPE);
+
var cd_game_uri_adapter = new GenericSyncGameUriAdapter (cd_game_for_uri);
- // FIXME We should be able to use one factory for Mega Drive and
- // 32X.
- var mega_drive_factory = new GenericUriGameFactory (game_uri_adapter);
- var 32x_factory = new GenericUriGameFactory (game_uri_adapter);
var mega_cd_factory = new GenericUriGameFactory (cd_game_uri_adapter);
- var mega_drive_query = new MimeTypeTrackerQuery (MEGA_DRIVE_MIME_TYPE, mega_drive_factory);
- var 32x_query = new MimeTypeTrackerQuery (32X_MIME_TYPE, 32x_factory);
- var mega_cd_query = new MimeTypeTrackerQuery (CUE_MIME_TYPE, mega_cd_factory);
- var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (mega_drive_query);
- source.add_query (32x_query);
- source.add_query (mega_cd_query);
-
- return source;
+ mega_cd_factory.add_mime_type (CUE_MIME_TYPE);
+ mega_cd_factory.add_mime_type (MEGA_CD_MIME_TYPE);
+
+ return { factory, mega_cd_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]