[gnome-games/wip/exalm/rebrand: 64/124] platform: Change snapshot type to a property
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/rebrand: 64/124] platform: Change snapshot type to a property
- Date: Sat, 19 Jun 2021 14:37:45 +0000 (UTC)
commit a03b87a83389e128be4ea7610ac8e6d98aeb1b71
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Mar 30 01:39:44 2021 +0500
platform: Change snapshot type to a property
One less reason to subclass platform
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/platform.vala | 5 +----
src/core/snapshot.vala | 2 +-
6 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/plugins/nintendo-64/src/nintendo-64-platform.vala
b/plugins/nintendo-64/src/nintendo-64-platform.vala
index 3b1362b7..7eabbb96 100644
--- a/plugins/nintendo-64/src/nintendo-64-platform.vala
+++ b/plugins/nintendo-64/src/nintendo-64-platform.vala
@@ -5,10 +5,6 @@ public class Games.Nintendo64Platform : Platform {
base (id, name, mime_type, prefix);
}
- public override Type get_snapshot_type () {
- return typeof (Nintendo64Snapshot);
- }
-
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 6a4931f8..52e3695f 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -10,6 +10,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);
}
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 31caa94f..dad3eb24 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-platform.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-platform.vala
@@ -5,10 +5,6 @@ public class Games.NintendoDsPlatform : Platform {
base (id, name, mime_type, prefix);
}
- public override Type get_snapshot_type () {
- return typeof (NintendoDsSnapshot);
- }
-
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 364334d2..740400e9 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -10,6 +10,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);
}
public Platform[] get_platforms () {
diff --git a/src/core/platform.vala b/src/core/platform.vala
index 7c4aa435..7ea6a2be 100644
--- a/src/core/platform.vala
+++ b/src/core/platform.vala
@@ -8,6 +8,7 @@ public class Games.Platform : Object {
private string prefix;
public bool autodiscovery { get; set; }
+ public Type snapshot_type { get; set; default = typeof (Snapshot); }
public Platform (string id, string name, string mime_type, string prefix) {
this.id = id;
@@ -45,10 +46,6 @@ public class Games.Platform : Object {
return presentation_mime_type;
}
- public virtual Type get_snapshot_type () {
- return typeof (Snapshot);
- }
-
public virtual Type get_runner_type () {
return typeof (Runner);
}
diff --git a/src/core/snapshot.vala b/src/core/snapshot.vala
index 4f23fd5c..98df4fc7 100644
--- a/src/core/snapshot.vala
+++ b/src/core/snapshot.vala
@@ -13,7 +13,7 @@ public class Games.Snapshot : Object {
public double screenshot_aspect_ratio { get; set; }
public static Snapshot load (Platform platform, string core_id, string path) {
- var type = platform.get_snapshot_type ();
+ var type = platform.snapshot_type;
var snapshot = Object.new (type,
"path", path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]