[gnome-games/wip/aplazas/781334-refactor-game-source: 9/11] Replace TrackerGameSource by GenericUriGameSource
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/781334-refactor-game-source: 9/11] Replace TrackerGameSource by GenericUriGameSource
- Date: Thu, 4 May 2017 09:37:49 +0000 (UTC)
commit d236f16e7795034e094cc77a32d765f17fcbfb33
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed May 3 21:17:24 2017 +0200
Replace TrackerGameSource by GenericUriGameSource
Replace usage of MimeTypeTrackerQuery and TrackerGameSource by
MimeTypeUriQuery and GenericUriGameSource to better split game resources
discovery and game object creation.
plugins/amiga/src/amiga-plugin.vala | 14 ++++++--
plugins/atari-2600/src/atari-2600-plugin.vala | 14 ++++++--
plugins/atari-7800/src/atari-7800-plugin.vala | 14 ++++++--
plugins/desktop/src/desktop-plugin.vala | 5 +++
plugins/doom/src/doom-plugin.vala | 14 ++++++--
plugins/dreamcast/src/dreamcast-plugin.vala | 14 ++++++--
.../src/game-boy-advance-plugin.vala | 14 ++++++--
plugins/game-boy/src/game-boy-plugin.vala | 22 ++++++++-----
plugins/game-cube/src/game-cube-plugin.vala | 14 ++++++--
plugins/love/src/love-plugin.vala | 14 ++++++--
plugins/mame/src/mame-plugin.vala | 16 ++++++---
.../master-system/src/master-system-plugin.vala | 31 +++++++++++-------
plugins/mega-drive/src/mega-drive-plugin.vala | 33 ++++++++++++-------
.../neo-geo-pocket/src/neo-geo-pocket-plugin.vala | 14 ++++++--
plugins/nes/src/nes-plugin.vala | 23 +++++++++----
plugins/nintendo-64/src/nintendo-64-plugin.vala | 14 ++++++--
plugins/nintendo-ds/src/nintendo-ds-plugin.vala | 14 ++++++--
plugins/pc-engine/src/pc-engine-plugin.vala | 23 +++++++++----
plugins/playstation/src/playstation-plugin.vala | 15 ++++++---
plugins/sega-saturn/src/sega-saturn-plugin.vala | 15 ++++++--
plugins/snes/src/snes-plugin.vala | 14 ++++++--
plugins/wii-ware/src/wii-ware-plugin.vala | 14 ++++++--
plugins/wii/src/wii-plugin.vala | 14 ++++++--
23 files changed, 263 insertions(+), 116 deletions(-)
---
diff --git a/plugins/amiga/src/amiga-plugin.vala b/plugins/amiga/src/amiga-plugin.vala
index 2b59a9b..9b5a1c3 100644
--- a/plugins/amiga/src/amiga-plugin.vala
+++ b/plugins/amiga/src/amiga-plugin.vala
@@ -8,12 +8,18 @@ private class Games.AmigaPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/atari-2600/src/atari-2600-plugin.vala b/plugins/atari-2600/src/atari-2600-plugin.vala
index a9f5cca..a543122 100644
--- a/plugins/atari-2600/src/atari-2600-plugin.vala
+++ b/plugins/atari-2600/src/atari-2600-plugin.vala
@@ -8,12 +8,18 @@ private class Games.Atari2600 : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/atari-7800/src/atari-7800-plugin.vala b/plugins/atari-7800/src/atari-7800-plugin.vala
index 900fed3..1b62ce5 100644
--- a/plugins/atari-7800/src/atari-7800-plugin.vala
+++ b/plugins/atari-7800/src/atari-7800-plugin.vala
@@ -8,12 +8,18 @@ private class Games.Atari7800 : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/desktop/src/desktop-plugin.vala b/plugins/desktop/src/desktop-plugin.vala
index e0eb55b..b644e95 100644
--- a/plugins/desktop/src/desktop-plugin.vala
+++ b/plugins/desktop/src/desktop-plugin.vala
@@ -1,13 +1,18 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.DesktopPlugin : Object, Plugin {
+ private const string MIME_TYPE = "application/x-desktop";
+
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
+ factory.add_mime_type (MIME_TYPE);
+
var query = new DesktopTrackerUriQuery ();
var connection = Tracker.Sparql.Connection.@get ();
var uri_source = new TrackerUriSource (connection);
uri_source.add_query (query);
+
var game_source = new GenericUriGameSource ();
game_source.add_source (uri_source);
game_source.add_factory (factory);
diff --git a/plugins/doom/src/doom-plugin.vala b/plugins/doom/src/doom-plugin.vala
index 268c92f..c50b35e 100644
--- a/plugins/doom/src/doom-plugin.vala
+++ b/plugins/doom/src/doom-plugin.vala
@@ -8,12 +8,18 @@ private class Games.DoomPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 5601097..6e7e631 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -7,12 +7,18 @@ private class Games.DreamcastPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
b/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
index 98f2f5b..abb3831 100644
--- a/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
+++ b/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
@@ -8,12 +8,18 @@ private class Games.GameBoyAdvancePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index fcdb217..7644026 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -12,16 +12,22 @@ private class Games.GameBoyPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
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 factory = new GenericUriGameFactory (game_uri_adapter);
+ factory.add_mime_type (GAME_BOY_MIME_TYPE);
+ factory.add_mime_type (GAME_BOY_COLOR_MIME_TYPE);
+
+ var game_boy_query = new MimeTypeTrackerUriQuery (GAME_BOY_MIME_TYPE);
+ var game_boy_color_query = new MimeTypeTrackerUriQuery (GAME_BOY_COLOR_MIME_TYPE);
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 uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (game_boy_query);
+ uri_source.add_query (game_boy_color_query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index bdbe8a5..b7e917d 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -7,12 +7,18 @@ private class Games.GameCubePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/love/src/love-plugin.vala b/plugins/love/src/love-plugin.vala
index c412f41..2afd7c3 100644
--- a/plugins/love/src/love-plugin.vala
+++ b/plugins/love/src/love-plugin.vala
@@ -6,12 +6,18 @@ private class Games.LovePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index 578c8dd..ec336b8 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -1,17 +1,23 @@
// 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 {
var game_uri_adapter = new MameGameUriAdapter ();
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
}
diff --git a/plugins/master-system/src/master-system-plugin.vala
b/plugins/master-system/src/master-system-plugin.vala
index 6490362..17c94b6 100644
--- a/plugins/master-system/src/master-system-plugin.vala
+++ b/plugins/master-system/src/master-system-plugin.vala
@@ -15,22 +15,29 @@ private class Games.MasterSystemPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ factory.add_mime_type (MASTER_SYSTEM_MIME_TYPE);
+ factory.add_mime_type (GAME_GEAR_MIME_TYPE);
+
var sg_1000_game_uri_adapter = new GenericSyncGameUriAdapter (sg_1000_game_for_uri);
- // FIXME We should be able to use one factory for Master System and
- // Game Gear.
- var master_system_factory = new GenericUriGameFactory (game_uri_adapter);
- var game_gear_factory = new GenericUriGameFactory (game_uri_adapter);
var sg_1000_factory = new GenericUriGameFactory (sg_1000_game_uri_adapter);
- var master_system_query = new MimeTypeTrackerQuery (MASTER_SYSTEM_MIME_TYPE,
master_system_factory);
- var game_gear_query = new MimeTypeTrackerQuery (GAME_GEAR_MIME_TYPE, game_gear_factory);
- var sg_1000_query = new MimeTypeTrackerQuery (SG_1000_MIME_TYPE, sg_1000_factory);
+ sg_1000_factory.add_mime_type (SG_1000_MIME_TYPE);
+
+ var master_system_query = new MimeTypeTrackerUriQuery (MASTER_SYSTEM_MIME_TYPE);
+ var game_gear_query = new MimeTypeTrackerUriQuery (GAME_GEAR_MIME_TYPE);
+ var sg_1000_query = new MimeTypeTrackerUriQuery (SG_1000_MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (master_system_query);
- source.add_query (game_gear_query);
- source.add_query (sg_1000_query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (master_system_query);
+ uri_source.add_query (game_gear_query);
+ uri_source.add_query (sg_1000_query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
+ game_source.add_factory (sg_1000_factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index 5592423..61113ed 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -21,22 +21,31 @@ private class Games.MegaDrivePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
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);
+ mega_cd_factory.add_mime_type (CUE_MIME_TYPE);
+ mega_cd_factory.add_mime_type (MEGA_CD_MIME_TYPE);
+
+ var mega_drive_query = new MimeTypeTrackerUriQuery (MEGA_DRIVE_MIME_TYPE);
+ var 32x_query = new MimeTypeTrackerUriQuery (32X_MIME_TYPE);
+ var mega_cd_query = new MimeTypeTrackerUriQuery (CUE_MIME_TYPE);
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);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (mega_drive_query);
+ uri_source.add_query (32x_query);
+ uri_source.add_query (mega_cd_query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
+ game_source.add_factory (mega_cd_factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
b/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
index 3d90052..4e6f525 100644
--- a/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
+++ b/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
@@ -8,12 +8,18 @@ private class Games.NeoGeoPocketPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/nes/src/nes-plugin.vala b/plugins/nes/src/nes-plugin.vala
index 8fe52c7..54fbf50 100644
--- a/plugins/nes/src/nes-plugin.vala
+++ b/plugins/nes/src/nes-plugin.vala
@@ -14,17 +14,26 @@ private class Games.NesPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var nes_game_uri_adapter = new GenericSyncGameUriAdapter (nes_game_for_uri);
- var fds_game_uri_adapter = new GenericSyncGameUriAdapter (fds_game_for_uri);
var nes_factory = new GenericUriGameFactory (nes_game_uri_adapter);
+ nes_factory.add_mime_type (NES_MIME_TYPE);
+
+ var fds_game_uri_adapter = new GenericSyncGameUriAdapter (fds_game_for_uri);
var fds_factory = new GenericUriGameFactory (fds_game_uri_adapter);
- var nes_query = new MimeTypeTrackerQuery (NES_MIME_TYPE, nes_factory);
- var fds_query = new MimeTypeTrackerQuery (FDS_MIME_TYPE, fds_factory);
+ fds_factory.add_mime_type (FDS_MIME_TYPE);
+
+ var nes_query = new MimeTypeTrackerUriQuery (NES_MIME_TYPE);
+ var fds_query = new MimeTypeTrackerUriQuery (FDS_MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (nes_query);
- source.add_query (fds_query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (nes_query);
+ uri_source.add_query (fds_query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (nes_factory);
+ game_source.add_factory (fds_factory);
- return source;
+ return game_source;
}
private static Game nes_game_for_uri (string uri) throws Error {
diff --git a/plugins/nintendo-64/src/nintendo-64-plugin.vala b/plugins/nintendo-64/src/nintendo-64-plugin.vala
index df68204..5111e7e 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -8,12 +8,18 @@ private class Games.Nintendo64Plugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 23529a9..d8963a1 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -8,12 +8,18 @@ private class Games.NintendoDsPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/pc-engine/src/pc-engine-plugin.vala b/plugins/pc-engine/src/pc-engine-plugin.vala
index 4639c3d..10e7bbf 100644
--- a/plugins/pc-engine/src/pc-engine-plugin.vala
+++ b/plugins/pc-engine/src/pc-engine-plugin.vala
@@ -12,17 +12,26 @@ private class Games.PcEnginePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
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);
+ cd_factory.add_mime_type (CUE_MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
+ var cd_query = new MimeTypeTrackerUriQuery (CUE_MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
- source.add_query (cd_query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+ uri_source.add_query (cd_query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
+ game_source.add_factory (cd_factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index 3e555fd..becafe0 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -1,16 +1,21 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.PlayStation : Object, Plugin {
- private const string SEARCHED_MIME_TYPE = "application/x-cue";
+ private const string MIME_TYPE = "application/x-cue";
public GameSource get_game_source () throws Error {
var factory = new PlayStationGameFactory ();
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, factory);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
}
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index 2cea3e6..5e496b8 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -8,12 +8,19 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, factory);
+ factory.add_mime_type (SEARCHED_MIME_TYPE);
+ factory.add_mime_type (SPECIFIC_MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (SEARCHED_MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/snes/src/snes-plugin.vala b/plugins/snes/src/snes-plugin.vala
index 1217d1a..ac97370 100644
--- a/plugins/snes/src/snes-plugin.vala
+++ b/plugins/snes/src/snes-plugin.vala
@@ -8,12 +8,18 @@ private class Games.SnesPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/wii-ware/src/wii-ware-plugin.vala b/plugins/wii-ware/src/wii-ware-plugin.vala
index c689570..de06f45 100644
--- a/plugins/wii-ware/src/wii-ware-plugin.vala
+++ b/plugins/wii-ware/src/wii-ware-plugin.vala
@@ -8,12 +8,18 @@ private class Games.WiiWarePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index 188de46..2bdfca2 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -7,12 +7,18 @@ private class Games.WiiPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
+ factory.add_mime_type (MIME_TYPE);
+
+ var query = new MimeTypeTrackerUriQuery (MIME_TYPE);
var connection = Tracker.Sparql.Connection.@get ();
- var source = new TrackerGameSource (connection);
- source.add_query (query);
+ var uri_source = new TrackerUriSource (connection);
+ uri_source.add_query (query);
+
+ var game_source = new GenericUriGameSource ();
+ game_source.add_source (uri_source);
+ game_source.add_factory (factory);
- return source;
+ return game_source;
}
private static Game game_for_uri (string uri) throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]