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



commit d8752c3a5761289d3f6f9719371222d654e88c20
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 c3ef3cf4..4eb2d68a 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 7d1797fe..1e21abd4 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -265,6 +265,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) {
@@ -276,7 +277,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]