[gnome-games] tracker: Make MimeTypeTrackerQuery use UriGameFactory
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] tracker: Make MimeTypeTrackerQuery use UriGameFactory
- Date: Fri, 19 Aug 2016 07:35:23 +0000 (UTC)
commit 036a158431964296f2f3f463d976da0559e86e79
Author: Ricard Gascons <gascons1995 gmail com>
Date: Thu Aug 18 12:16:10 2016 +0200
tracker: Make MimeTypeTrackerQuery use UriGameFactory
This allows to split querying Tracker to get game URIs from
the creation of the games.
This is part in a series of commits to add multi-source support.
plugins/amiga/src/amiga-plugin.vala | 3 +-
plugins/atari-2600/src/atari-2600-plugin.vala | 3 +-
plugins/atari-7800/src/atari-7800-plugin.vala | 3 +-
plugins/doom/src/doom-plugin.vala | 3 +-
plugins/dreamcast/src/dreamcast-plugin.vala | 3 +-
.../src/game-boy-advance-plugin.vala | 3 +-
plugins/game-boy/src/game-boy-plugin.vala | 3 +-
plugins/game-cube/src/game-cube-plugin.vala | 3 +-
plugins/love/src/love-plugin.vala | 3 +-
plugins/mame/src/mame-plugin.vala | 3 +-
.../master-system/src/master-system-plugin.vala | 8 ++-
plugins/mega-drive/src/mega-drive-plugin.vala | 8 ++-
.../neo-geo-pocket/src/neo-geo-pocket-plugin.vala | 3 +-
plugins/nes/src/nes-plugin.vala | 3 +-
plugins/nintendo-64/src/nintendo-64-plugin.vala | 3 +-
plugins/nintendo-ds/src/nintendo-ds-plugin.vala | 3 +-
plugins/pc-engine/src/pc-engine-plugin.vala | 6 ++-
plugins/playstation/src/playstation-plugin.vala | 3 +-
plugins/sega-saturn/src/sega-saturn-plugin.vala | 3 +-
plugins/snes/src/snes-plugin.vala | 3 +-
plugins/wii-ware/src/wii-ware-plugin.vala | 3 +-
plugins/wii/src/wii-plugin.vala | 3 +-
src/tracker/mime-type-tracker-query.vala | 49 ++-----------------
23 files changed, 58 insertions(+), 70 deletions(-)
---
diff --git a/plugins/amiga/src/amiga-plugin.vala b/plugins/amiga/src/amiga-plugin.vala
index f8e6584..c58d76a 100644
--- a/plugins/amiga/src/amiga-plugin.vala
+++ b/plugins/amiga/src/amiga-plugin.vala
@@ -8,7 +8,8 @@ private class Games.AmigaPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/atari-2600/src/atari-2600-plugin.vala b/plugins/atari-2600/src/atari-2600-plugin.vala
index 5849f82..b0f2da5 100644
--- a/plugins/atari-2600/src/atari-2600-plugin.vala
+++ b/plugins/atari-2600/src/atari-2600-plugin.vala
@@ -8,7 +8,8 @@ private class Games.Atari2600 : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/atari-7800/src/atari-7800-plugin.vala b/plugins/atari-7800/src/atari-7800-plugin.vala
index a0cdcb3..b5d7387 100644
--- a/plugins/atari-7800/src/atari-7800-plugin.vala
+++ b/plugins/atari-7800/src/atari-7800-plugin.vala
@@ -8,7 +8,8 @@ private class Games.Atari7800 : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/doom/src/doom-plugin.vala b/plugins/doom/src/doom-plugin.vala
index 319738c..917e13e 100644
--- a/plugins/doom/src/doom-plugin.vala
+++ b/plugins/doom/src/doom-plugin.vala
@@ -8,7 +8,8 @@ private class Games.DoomPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 75cd853..283c929 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -7,7 +7,8 @@ private class Games.DreamcastPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
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 8ae8c35..c567936 100644
--- a/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
+++ b/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
@@ -8,7 +8,8 @@ private class Games.GameBoyAdvancePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index 8426cb8..4cae682 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -8,7 +8,8 @@ private class Games.GameBoyPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index 2a71593..a22232c 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -7,7 +7,8 @@ private class Games.GameCubePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/love/src/love-plugin.vala b/plugins/love/src/love-plugin.vala
index a5f8be0..1956f42 100644
--- a/plugins/love/src/love-plugin.vala
+++ b/plugins/love/src/love-plugin.vala
@@ -5,7 +5,8 @@ private class Games.LovePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index f798fe9..c14e0b7 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -5,7 +5,8 @@ private class Games.MamePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new MameGameUriAdapter ();
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, game_uri_adapter);
+ 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);
diff --git a/plugins/master-system/src/master-system-plugin.vala
b/plugins/master-system/src/master-system-plugin.vala
index 175063c..0d0b3dc 100644
--- a/plugins/master-system/src/master-system-plugin.vala
+++ b/plugins/master-system/src/master-system-plugin.vala
@@ -16,9 +16,11 @@ private class Games.MasterSystemPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
var sg_1000_game_uri_adapter = new GenericSyncGameUriAdapter (sg_1000_game_for_uri);
- var master_system_query = new MimeTypeTrackerQuery (MASTER_SYSTEM_MIME_TYPE,
game_uri_adapter);
- var game_gear_query = new MimeTypeTrackerQuery (GAME_GEAR_MIME_TYPE, game_uri_adapter);
- var sg_1000_query = new MimeTypeTrackerQuery (GAME_GEAR_MIME_TYPE, sg_1000_game_uri_adapter);
+ var 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, factory);
+ var game_gear_query = new MimeTypeTrackerQuery (GAME_GEAR_MIME_TYPE, factory);
+ var sg_1000_query = new MimeTypeTrackerQuery (SG_1000_MIME_TYPE, sg_1000_factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (master_system_query);
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index 7311553..e386387 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -20,9 +20,11 @@ private class Games.MegaDrivePlugin : 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 mega_drive_query = new MimeTypeTrackerQuery (MEGA_DRIVE_MIME_TYPE, game_uri_adapter);
- var 32x_query = new MimeTypeTrackerQuery (32X_MIME_TYPE, game_uri_adapter);
- var mega_cd_query = new MimeTypeTrackerQuery (CUE_MIME_TYPE, cd_game_uri_adapter);
+ var 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, factory);
+ var 32x_query = new MimeTypeTrackerQuery (32X_MIME_TYPE, 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);
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 5b6a1b7..3d4e14b 100644
--- a/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
+++ b/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
@@ -8,7 +8,8 @@ private class Games.NeoGeoPocketPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/nes/src/nes-plugin.vala b/plugins/nes/src/nes-plugin.vala
index 449507c..72fbc45 100644
--- a/plugins/nes/src/nes-plugin.vala
+++ b/plugins/nes/src/nes-plugin.vala
@@ -8,7 +8,8 @@ private class Games.NesPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/nintendo-64/src/nintendo-64-plugin.vala b/plugins/nintendo-64/src/nintendo-64-plugin.vala
index 08a2df4..d071fba 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -8,7 +8,8 @@ private class Games.Nintendo64Plugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 7831be4..b9d6284 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -8,7 +8,8 @@ private class Games.NintendoDsPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/pc-engine/src/pc-engine-plugin.vala b/plugins/pc-engine/src/pc-engine-plugin.vala
index d5838b3..0429846 100644
--- a/plugins/pc-engine/src/pc-engine-plugin.vala
+++ b/plugins/pc-engine/src/pc-engine-plugin.vala
@@ -14,8 +14,10 @@ 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 query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
- var cd_query = new MimeTypeTrackerQuery (CUE_MIME_TYPE, cd_game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ 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);
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index ef94862..50feebe 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -8,7 +8,8 @@ private class Games.PlayStation : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, game_uri_adapter);
+ 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);
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index 037f6af..a09943a 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -8,7 +8,8 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, game_uri_adapter);
+ 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);
diff --git a/plugins/snes/src/snes-plugin.vala b/plugins/snes/src/snes-plugin.vala
index f0b4708..7b399a2 100644
--- a/plugins/snes/src/snes-plugin.vala
+++ b/plugins/snes/src/snes-plugin.vala
@@ -8,7 +8,8 @@ private class Games.SnesPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/wii-ware/src/wii-ware-plugin.vala b/plugins/wii-ware/src/wii-ware-plugin.vala
index 4d6cb19..a1c24e2 100644
--- a/plugins/wii-ware/src/wii-ware-plugin.vala
+++ b/plugins/wii-ware/src/wii-ware-plugin.vala
@@ -8,7 +8,8 @@ private class Games.WiiWarePlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index 0da5215..1b73bea 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -7,7 +7,8 @@ private class Games.WiiPlugin : Object, Plugin {
public GameSource get_game_source () throws Error {
var game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
- var query = new MimeTypeTrackerQuery (MIME_TYPE, game_uri_adapter);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ var query = new MimeTypeTrackerQuery (MIME_TYPE, factory);
var connection = Tracker.Sparql.Connection.@get ();
var source = new TrackerGameSource (connection);
source.add_query (query);
diff --git a/src/tracker/mime-type-tracker-query.vala b/src/tracker/mime-type-tracker-query.vala
index 69d2dc5..07076a1 100644
--- a/src/tracker/mime-type-tracker-query.vala
+++ b/src/tracker/mime-type-tracker-query.vala
@@ -1,16 +1,12 @@
// This file is part of GNOME Games. License: GPLv3
public class Games.MimeTypeTrackerQuery : Object, TrackerQuery {
- private const uint HANDLED_URIS_PER_CYCLE = 5;
-
private string mime_type;
- private GameUriAdapter game_for_uri;
- private string[] uris;
+ private UriGameFactory uri_game_factory;
- public MimeTypeTrackerQuery (string mime_type, GameUriAdapter game_for_uri) {
+ public MimeTypeTrackerQuery (string mime_type, UriGameFactory uri_game_factory) {
this.mime_type = mime_type;
- this.game_for_uri = game_for_uri;
- this.uris = {};
+ this.uri_game_factory = uri_game_factory;
}
public string get_query () {
@@ -20,48 +16,15 @@ public class Games.MimeTypeTrackerQuery : Object, TrackerQuery {
public bool is_cursor_valid (Tracker.Sparql.Cursor cursor) {
var uri = cursor.get_string (0);
- return is_uri_valid (uri);
- }
-
- public bool is_uri_valid (string uri) {
- File file = File.new_for_uri(uri);
-
- return file.query_exists ();
+ return uri_game_factory.is_uri_valid (uri);
}
public void process_cursor (Tracker.Sparql.Cursor cursor) {
var uri = cursor.get_string (0);
- uris += uri;
+ uri_game_factory.add_uri (uri);
}
public async void foreach_game (GameCallback game_callback) {
- uint handled_uris = 0;
- foreach (var uri in uris) {
- var file = File.new_for_uri (uri);
- if (!file.query_exists ())
- continue;
-
- try {
- var game = yield game_for_uri.game_for_uri (uri);
- game_callback (game);
- }
- catch (Error e) {
- debug (e.message);
-
- continue;
- }
-
- handled_uris++;
-
- // Free the execution only once every HANDLED_URIS_PER_CYCLE
- // games to speed up the execution by avoiding too many context
- // switching.
- if (handled_uris >= HANDLED_URIS_PER_CYCLE) {
- handled_uris = 0;
-
- Idle.add (this.foreach_game.callback);
- yield;
- }
- }
+ yield uri_game_factory.foreach_game (game_callback);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]