[gnome-games/wip/aplazas/781334-refactor-game-source: 6/12] pc-engine: 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: 6/12] pc-engine: Provide MIME types and URI game factories
- Date: Thu, 4 May 2017 17:41:51 +0000 (UTC)
commit c7687ac9f95d53e465eca437b0e2976326b5b32f
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu May 4 15:39:33 2017 +0200
pc-engine: 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/pc-engine/src/pc-engine-plugin.vala | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/plugins/pc-engine/src/pc-engine-plugin.vala b/plugins/pc-engine/src/pc-engine-plugin.vala
index a3c2e50..376ec07 100644
--- a/plugins/pc-engine/src/pc-engine-plugin.vala
+++ b/plugins/pc-engine/src/pc-engine-plugin.vala
@@ -10,19 +10,23 @@ private class Games.PcEnginePlugin : Object, Plugin {
private const string CD_MAGIC_VALUE = "PC Engine CD-ROM SYSTEM";
private const string CD_PLATFORM = "TurboGrafxCD";
- public GameSource? get_game_source () throws Error {
+ public string[] get_mime_types () {
+ return {
+ MIME_TYPE,
+ CUE_MIME_TYPE,
+ };
+ }
+
+ public UriGameFactory[] get_uri_game_factories () {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var cd_game_uri_adapter = new GenericSyncGameUriAdapter (cd_game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
+ factory.add_mime_type (MIME_TYPE);
+
+ var cd_game_uri_adapter = new GenericSyncGameUriAdapter (cd_game_for_uri);
var cd_factory = new GenericUriGameFactory (cd_game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
- var cd_query = new MimeTypeTrackerQuery (CUE_MIME_TYPE, cd_factory);
- var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
- source.add_query (cd_query);
-
- return source;
+ cd_factory.add_mime_type (CUE_MIME_TYPE);
+
+ return { factory, 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]