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



commit c0dc8e55183931a8ee2631e41bc3eaee32224d7b
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 f41dc45b..78d6a974 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -264,6 +264,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) {
@@ -275,7 +276,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]