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



commit 0e422b834870b6e7f638556661ab49878510bdc3
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 | 8 +++-----
 src/ui/application.vala                      | 7 ++++++-
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/retro/retro-simple-game-uri-adapter.vala b/src/retro/retro-simple-game-uri-adapter.vala
index afb0a1f1..1c80d561 100644
--- a/src/retro/retro-simple-game-uri-adapter.vala
+++ b/src/retro/retro-simple-game-uri-adapter.vala
@@ -2,13 +2,11 @@
 
 private class Games.RetroSimpleGameUriAdapter : GameUriAdapter, Object {
        private RetroSimpleType simple_type;
-       private Platform platform;
+       private RetroPlatform platform;
 
-       public RetroSimpleGameUriAdapter (RetroSimpleType simple_type) {
+       public RetroSimpleGameUriAdapter (RetroSimpleType simple_type, RetroPlatform 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 5e49b90b..a5e08251 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -277,6 +277,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) {
@@ -288,7 +289,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 RetroPlatform (simple_type.platform, platform_name, { 
simple_type.mime_type });
+                       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]