[gnome-games] generic: Make GenericUriGameSource handle schemes
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] generic: Make GenericUriGameSource handle schemes
- Date: Sun, 7 May 2017 05:02:11 +0000 (UTC)
commit 2c3df368b6666c316f9a63fa674c5fc9546be00f
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat May 6 11:18:09 2017 +0200
generic: Make GenericUriGameSource handle schemes
https://bugzilla.gnome.org/show_bug.cgi?id=781334
src/generic/generic-uri-game-source.vala | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/generic/generic-uri-game-source.vala b/src/generic/generic-uri-game-source.vala
index 653923f..b9d1d19 100644
--- a/src/generic/generic-uri-game-source.vala
+++ b/src/generic/generic-uri-game-source.vala
@@ -7,9 +7,11 @@ public class Games.GenericUriGameSource : Object, GameSource {
private UriGameFactory[] factories;
private HashTable<string, Array<UriGameFactory>> factories_for_mime_type;
+ private HashTable<string, Array<UriGameFactory>> factories_for_scheme;
construct {
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);
}
public void add_source (UriSource source) {
@@ -25,6 +27,12 @@ public class Games.GenericUriGameSource : Object, GameSource {
factories_for_mime_type[mime_type].append_val (factory);
}
+ foreach (var scheme in factory.get_schemes ()) {
+ if (!factories_for_scheme.contains (scheme))
+ factories_for_scheme[scheme] = new Array<UriGameFactory> ();
+ factories_for_scheme[scheme].append_val (factory);
+ }
+
factory.game_added.connect ((game) => game_added (game));
}
@@ -82,7 +90,10 @@ public class Games.GenericUriGameSource : Object, GameSource {
debug (e.message);
}
}
- // TODO Add support for URN and other schemes.
+ // TODO Add support for URN.
+ if (factories_for_scheme.contains (scheme))
+ foreach (var factory in factories_for_scheme[scheme].data)
+ factories += factory;
return factories;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]