[gnome-games/wip/exalm/rebrand: 47/102] platform: Change runner type into a property




commit ce2de32af5764c7148924b24ba0eeaaf33edc8be
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Mar 30 01:42:22 2021 +0500

    platform: Change runner type into a property
    
    This was the last reason to subclass platforms.

 plugins/nintendo-3ds/src/nintendo-3ds-platform.vala | 4 ----
 plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala   | 1 +
 plugins/nintendo-64/src/nintendo-64-platform.vala   | 4 ----
 plugins/nintendo-64/src/nintendo-64-plugin.vala     | 1 +
 plugins/nintendo-ds/src/nintendo-ds-platform.vala   | 4 ----
 plugins/nintendo-ds/src/nintendo-ds-plugin.vala     | 1 +
 src/core/game-collection.vala                       | 2 +-
 src/core/platform.vala                              | 5 +----
 8 files changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala 
b/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
index 9db61696..db98aab5 100644
--- a/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
@@ -4,8 +4,4 @@ public class Games.Nintendo3DsPlatform : Platform {
        public Nintendo3DsPlatform (string id, string name, string[] mime_types, string grilo_mime_type, 
string prefix) {
                base.with_mime_types (id, name, mime_types, grilo_mime_type, prefix);
        }
-
-       public override Type get_runner_type () {
-               return typeof (Nintendo3DsRunner);
-       }
 }
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala 
b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
index 8b68b18d..afefb4a7 100644
--- a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
@@ -12,6 +12,7 @@ private class Games.Nintendo3DsPlugin : Object, Plugin {
 
        static construct {
                platform = new Nintendo3DsPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES, 3DS_MIME_TYPE, 
PLATFORM_UID_PREFIX);
+               platform.runner_type = typeof (Nintendo3DsRunner);
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/nintendo-64/src/nintendo-64-platform.vala 
b/plugins/nintendo-64/src/nintendo-64-platform.vala
index 7eabbb96..39a2c391 100644
--- a/plugins/nintendo-64/src/nintendo-64-platform.vala
+++ b/plugins/nintendo-64/src/nintendo-64-platform.vala
@@ -4,8 +4,4 @@ public class Games.Nintendo64Platform : Platform {
        public Nintendo64Platform (string id, string name, string mime_type, string prefix) {
                base (id, name, mime_type, prefix);
        }
-
-       public override Type get_runner_type () {
-               return typeof (Nintendo64Runner);
-       }
 }
diff --git a/plugins/nintendo-64/src/nintendo-64-plugin.vala b/plugins/nintendo-64/src/nintendo-64-plugin.vala
index 52e3695f..dc4f8036 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -11,6 +11,7 @@ private class Games.Nintendo64Plugin : Object, Plugin {
        static construct {
                platform = new Nintendo64Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, 
PLATFORM_UID_PREFIX);
                platform.snapshot_type = typeof (Nintendo64Snapshot);
+               platform.runner_type = typeof (Nintendo64Runner);
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/nintendo-ds/src/nintendo-ds-platform.vala 
b/plugins/nintendo-ds/src/nintendo-ds-platform.vala
index dad3eb24..bc78a881 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-platform.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-platform.vala
@@ -4,8 +4,4 @@ public class Games.NintendoDsPlatform : Platform {
        public NintendoDsPlatform (string id, string name, string mime_type, string prefix) {
                base (id, name, mime_type, prefix);
        }
-
-       public override Type get_runner_type () {
-               return typeof (NintendoDsRunner);
-       }
 }
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 740400e9..6e132855 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -11,6 +11,7 @@ private class Games.NintendoDsPlugin : Object, Plugin {
        static construct {
                platform = new NintendoDsPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, 
PLATFORM_UID_PREFIX);
                platform.snapshot_type = typeof (NintendoDsSnapshot);
+               platform.runner_type = typeof (NintendoDsRunner);
        }
 
        public Platform[] get_platforms () {
diff --git a/src/core/game-collection.vala b/src/core/game-collection.vala
index 1b7e3ae0..1f1ac15a 100644
--- a/src/core/game-collection.vala
+++ b/src/core/game-collection.vala
@@ -153,7 +153,7 @@ private class Games.GameCollection : Object {
 
        public Runner? create_runner (Game game) {
                var core_source = new RetroCoreSource (game.platform);
-               var type = game.platform.get_runner_type ();
+               var type = game.platform.runner_type;
 
                return Object.new (type, game: game, core_source: core_source) as Runner;
        }
diff --git a/src/core/platform.vala b/src/core/platform.vala
index 7ea6a2be..fe3ffe0a 100644
--- a/src/core/platform.vala
+++ b/src/core/platform.vala
@@ -9,6 +9,7 @@ public class Games.Platform : Object {
 
        public bool autodiscovery { get; set; }
        public Type snapshot_type { get; set; default = typeof (Snapshot); }
+       public Type runner_type { get; set; default = typeof (Runner); }
 
        public Platform (string id, string name,  string mime_type, string prefix) {
                this.id = id;
@@ -46,10 +47,6 @@ public class Games.Platform : Object {
                return presentation_mime_type;
        }
 
-       public virtual Type get_runner_type () {
-               return typeof (Runner);
-       }
-
        public static uint hash (Platform platform) {
                return str_hash (platform.get_id ());
        }


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