[gnome-games/wip/exalm/loading: 6/29] game-collection: Add create_runner()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/loading: 6/29] game-collection: Add create_runner()
- Date: Mon, 11 Nov 2019 21:45:09 +0000 (UTC)
commit 6ab38e99f4e3a2748ce0537a4f2d9d8986f25567
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Nov 11 23:54:29 2019 +0500
game-collection: Add create_runner()
src/core/game-collection.vala | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/src/core/game-collection.vala b/src/core/game-collection.vala
index f6cc1309..3fb8db3f 100644
--- a/src/core/game-collection.vala
+++ b/src/core/game-collection.vala
@@ -88,6 +88,30 @@ private class Games.GameCollection : Object {
return true;
}
+ public Runner? create_runner (Game game) {
+ var platform = game.get_platform ();
+
+ if (!runner_factories_for_platforms.contains (platform))
+ return null;
+
+ var factories = runner_factories_for_platforms[platform];
+ if (factories == null)
+ return null;
+
+ foreach (var factory in factories.data) {
+ try {
+ var runner = factory.create_runner (game);
+ if (runner != null)
+ return runner;
+ }
+ catch (Error e) {
+ critical ("Couldn't create runner: %s", e.message);
+ }
+ }
+
+ return null;
+ }
+
private async UriGameFactory[] get_factories_for_uri (Uri uri) {
Idle.add (get_factories_for_uri.callback);
yield;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]