[gnome-games/wip/exalm/platform-preferences: 40/65] application: Register platforms for libretro simple types



commit 32e0d4848e9fb6408ed506388ea438418945e023
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun May 20 21:37:59 2018 +0000

    application: Register platforms for libretro simple types

 src/retro/retro-simple-game-uri-adapter.vala | 6 ++----
 src/ui/application.vala                      | 7 ++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/retro/retro-simple-game-uri-adapter.vala b/src/retro/retro-simple-game-uri-adapter.vala
index afb0a1f1..f7e9e1ea 100644
--- a/src/retro/retro-simple-game-uri-adapter.vala
+++ b/src/retro/retro-simple-game-uri-adapter.vala
@@ -4,11 +4,9 @@ private class Games.RetroSimpleGameUriAdapter : GameUriAdapter, Object {
        private RetroSimpleType simple_type;
        private Platform platform;
 
-       public RetroSimpleGameUriAdapter (RetroSimpleType simple_type) {
+       public RetroSimpleGameUriAdapter (RetroSimpleType simple_type, Platform platform) {
                this.simple_type = simple_type;
-
-               var platform_name = simple_type.get_platform_name ();
-               platform = new GenericPlatform (simple_type.platform, platform_name);
+               this.platform = platform;
        }
 
        public async Game game_for_uri (Uri uri) throws Error {
diff --git a/src/ui/application.vala b/src/ui/application.vala
index c0b285cb..3ed84014 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -266,6 +266,7 @@ public class Games.Application : Gtk.Application {
                        game_collection.add_source (tracker_uri_source);
 
                var mime_types = new GenericSet<string> (str_hash, str_equal);
+               var platform_register = PlatformRegister.get_register ();
 
                /* Register simple Libretro-based game types */
                foreach (var simple_type in RETRO_SIMPLE_TYPES) {
@@ -277,7 +278,11 @@ public class Games.Application : Gtk.Application {
                                tracker_uri_source.add_query (query);
                        }
 
-                       var game_uri_adapter = new RetroSimpleGameUriAdapter (simple_type);
+                       var platform_name = simple_type.get_platform_name ();
+                       var platform = new GenericPlatform (simple_type.platform, platform_name);
+                       platform_register.add_platform (platform);
+
+                       var game_uri_adapter = new RetroSimpleGameUriAdapter (simple_type, platform);
                        var factory = new GenericUriGameFactory (game_uri_adapter);
                        factory.add_mime_type (simple_type.mime_type);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]