[gnome-games/wip/exalm/loading: 5/29] game-collection: Add add_runner_factory()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/loading: 5/29] game-collection: Add add_runner_factory()
- Date: Mon, 11 Nov 2019 21:45:04 +0000 (UTC)
commit 36803b42961bf74b8a0682a2bf32ccb24a467967
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Nov 11 23:05:04 2019 +0500
game-collection: Add add_runner_factory()
src/core/game-collection.vala | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/src/core/game-collection.vala b/src/core/game-collection.vala
index 3dacd275..f6cc1309 100644
--- a/src/core/game-collection.vala
+++ b/src/core/game-collection.vala
@@ -6,9 +6,11 @@ private class Games.GameCollection : Object {
private GenericSet<Game> games;
private UriSource[] sources;
private UriGameFactory[] factories;
+ private RunnerFactory[] runner_factories;
private HashTable<string, Array<UriGameFactory>> factories_for_mime_type;
private HashTable<string, Array<UriGameFactory>> factories_for_scheme;
+ private HashTable<Platform, Array<RunnerFactory>> runner_factories_for_platforms;
public bool paused { get; set; }
@@ -16,6 +18,7 @@ private class Games.GameCollection : Object {
games = new GenericSet<Game> (Game.hash, Game.equal);
factories_for_mime_type = new HashTable<string, Array<UriGameFactory>> (str_hash, str_equal);
factories_for_scheme = new HashTable<string, Array<UriGameFactory>> (str_hash, str_equal);
+ runner_factories_for_platforms = new HashTable<Platform, Array<RunnerFactory>>
(Platform.hash, Platform.equal);
}
public void add_source (UriSource source) {
@@ -40,6 +43,16 @@ private class Games.GameCollection : Object {
factory.game_added.connect ((game) => store_game (game));
}
+ public void add_runner_factory (RunnerFactory factory) {
+ runner_factories += factory;
+
+ foreach (var platform in factory.get_platforms ()) {
+ if (!runner_factories_for_platforms.contains (platform))
+ runner_factories_for_platforms[platform] = new Array<RunnerFactory> ();
+ runner_factories_for_platforms[platform].append_val (factory);
+ }
+ }
+
public string[] get_accepted_mime_types () {
return factories_for_mime_type.get_keys_as_array ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]