[gnome-games/wip/exalm/rebrand: 61/124] platform: Add get_presentation_mime_type()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/rebrand: 61/124] platform: Add get_presentation_mime_type()
- Date: Sat, 19 Jun 2021 14:37:45 +0000 (UTC)
commit 778d391ccc06b3c41031ff4738a8a2a4e007f10e
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Mar 30 01:23:23 2021 +0500
platform: Add get_presentation_mime_type()
Another hack on the way to getting rid of custom game creation everywhere.
plugins/dreamcast/src/dreamcast-plugin.vala | 2 +-
plugins/game-cube/src/game-cube-platform.vala | 4 ++--
plugins/game-cube/src/game-cube-plugin.vala | 2 +-
plugins/mame/src/mame-plugin.vala | 7 +++++--
plugins/ms-dos/src/ms-dos-plugin.vala | 2 +-
plugins/nintendo-3ds/src/nintendo-3ds-platform.vala | 4 ++--
plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala | 2 +-
plugins/nintendo-64/src/nintendo-64-platform.vala | 4 ++--
plugins/nintendo-64/src/nintendo-64-plugin.vala | 2 +-
plugins/nintendo-ds/src/nintendo-ds-platform.vala | 4 ++--
plugins/nintendo-ds/src/nintendo-ds-plugin.vala | 2 +-
plugins/playstation/src/playstation-plugin.vala | 2 +-
plugins/sega-cd/src/sega-cd-plugin.vala | 4 ++--
plugins/sega-saturn/src/sega-saturn-plugin.vala | 2 +-
plugins/turbografx-cd/src/turbografx-cd-plugin.vala | 2 +-
plugins/virtual-boy/src/virtual-boy-plugin.vala | 2 +-
plugins/wii/src/wii-plugin.vala | 2 +-
src/core/platform.vala | 17 ++++++++++++++++-
src/ui/application.vala | 2 +-
19 files changed, 43 insertions(+), 25 deletions(-)
---
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index eaae5174..5b7cd54b 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -12,7 +12,7 @@ private class Games.DreamcastPlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES, PLATFORM_UID_PREFIX);
+ platform = new Platform.with_mime_types (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES,
DREAMCAST_MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/game-cube/src/game-cube-platform.vala b/plugins/game-cube/src/game-cube-platform.vala
index 5690e404..505d0dc3 100644
--- a/plugins/game-cube/src/game-cube-platform.vala
+++ b/plugins/game-cube/src/game-cube-platform.vala
@@ -1,8 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.GameCubePlatform : Platform {
- public GameCubePlatform (string id, string name, string[] mime_types, string prefix) {
- base (id, name, mime_types, prefix);
+ public GameCubePlatform (string id, string name, string mime_type, string prefix) {
+ base (id, name, mime_type, prefix);
}
public override Type get_runner_type () {
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index ab68350e..5be910a6 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -9,7 +9,7 @@ private class Games.GameCubePlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new GameCubePlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE },
PLATFORM_UID_PREFIX);
+ platform = new GameCubePlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index cf61129d..f60ce294 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -11,7 +11,7 @@ private class Games.MamePlugin : Object, Plugin {
static construct {
string[] mime_types = { SEARCHED_MIME_TYPE };
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, mime_types, PLATFORM_UID_PREFIX);
+ platform = new Platform.with_mime_types (PLATFORM_ID, PLATFORM_NAME, mime_types,
SPECIFIC_MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
@@ -43,7 +43,10 @@ private class Games.MamePlugin : Object, Plugin {
title_string = title_string.split ("(")[0];
title_string = title_string.strip ();
var title = new GenericTitle (title_string);
- var cover = new LocalCover (uri);
+ var media = new GriloMedia (title, SPECIFIC_MIME_TYPE);
+ var cover = new CompositeCover ({
+ new LocalCover (uri),
+ new GriloCover (media, uid)});
var game = new Game (uid, uri, title, platform);
game.set_cover (cover);
diff --git a/plugins/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
index 287baff4..a8905e05 100644
--- a/plugins/ms-dos/src/ms-dos-plugin.vala
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -9,7 +9,7 @@ private class Games.MsDosPlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE }, PLATFORM_UID_PREFIX,
false);
+ platform = new Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, PLATFORM_UID_PREFIX, false);
}
public Platform[] get_platforms () {
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
index 8b4436f2..9db61696 100644
--- a/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-platform.vala
@@ -1,8 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.Nintendo3DsPlatform : Platform {
- public Nintendo3DsPlatform (string id, string name, string[] mime_types, string prefix) {
- base (id, name, mime_types, prefix);
+ 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 () {
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
index 865918e6..8b68b18d 100644
--- a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
@@ -11,7 +11,7 @@ private class Games.Nintendo3DsPlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Nintendo3DsPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES,
PLATFORM_UID_PREFIX);
+ platform = new Nintendo3DsPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES, 3DS_MIME_TYPE,
PLATFORM_UID_PREFIX);
}
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 a88f80fd..3b1362b7 100644
--- a/plugins/nintendo-64/src/nintendo-64-platform.vala
+++ b/plugins/nintendo-64/src/nintendo-64-platform.vala
@@ -1,8 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.Nintendo64Platform : Platform {
- public Nintendo64Platform (string id, string name, string[] mime_types, string prefix) {
- base (id, name, mime_types, prefix);
+ public Nintendo64Platform (string id, string name, string mime_type, string prefix) {
+ base (id, name, mime_type, prefix);
}
public override Type get_snapshot_type () {
diff --git a/plugins/nintendo-64/src/nintendo-64-plugin.vala b/plugins/nintendo-64/src/nintendo-64-plugin.vala
index 8975faf9..6a4931f8 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -9,7 +9,7 @@ private class Games.Nintendo64Plugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Nintendo64Platform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE },
PLATFORM_UID_PREFIX);
+ platform = new Nintendo64Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE,
PLATFORM_UID_PREFIX);
}
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 487bf986..31caa94f 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-platform.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-platform.vala
@@ -1,8 +1,8 @@
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.NintendoDsPlatform : Platform {
- public NintendoDsPlatform (string id, string name, string[] mime_types, string prefix) {
- base (id, name, mime_types, prefix);
+ public NintendoDsPlatform (string id, string name, string mime_type, string prefix) {
+ base (id, name, mime_type, prefix);
}
public override Type get_snapshot_type () {
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 0ec89260..364334d2 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -9,7 +9,7 @@ private class Games.NintendoDsPlugin : Object, Plugin {
private static NintendoDsPlatform platform;
static construct {
- platform = new NintendoDsPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE },
PLATFORM_UID_PREFIX);
+ platform = new NintendoDsPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE,
PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index ee682535..3daeed0e 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -11,7 +11,7 @@ private class Games.PlayStation : Object, Plugin {
static construct {
string[] mime_types = { CUE_MIME_TYPE };
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, mime_types, PLATFORM_UID_PREFIX);
+ platform = new Platform.with_mime_types (PLATFORM_ID, PLATFORM_NAME, mime_types,
PHONY_MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/sega-cd/src/sega-cd-plugin.vala b/plugins/sega-cd/src/sega-cd-plugin.vala
index 68274560..506e4779 100644
--- a/plugins/sega-cd/src/sega-cd-plugin.vala
+++ b/plugins/sega-cd/src/sega-cd-plugin.vala
@@ -20,8 +20,8 @@ private class Games.SegaCDPlugin : Object, Plugin {
static construct {
string[] mime_types = { CUE_MIME_TYPE, SEGA_CD_MIME_TYPE };
string[] mime_types_32x = { CUE_MIME_TYPE, SEGA_CD_MIME_TYPE, 32X_MIME_TYPE };
- platform_sega_cd = new Platform (SEGA_CD_PLATFORM_ID, SEGA_CD_PLATFORM_NAME, mime_types,
SEGA_CD_UID_PREFIX);
- platform_sega_cd_32x = new Platform (SEGA_CD_32X_PLATFORM_ID, SEGA_CD_32X_PLATFORM_NAME,
mime_types_32x, SEGA_CD_32X_UID_PREFIX);
+ platform_sega_cd = new Platform.with_mime_types (SEGA_CD_PLATFORM_ID, SEGA_CD_PLATFORM_NAME,
mime_types, SEGA_CD_MIME_TYPE, SEGA_CD_UID_PREFIX);
+ platform_sega_cd_32x = new Platform.with_mime_types (SEGA_CD_32X_PLATFORM_ID,
SEGA_CD_32X_PLATFORM_NAME, mime_types_32x, SEGA_CD_MIME_TYPE, SEGA_CD_32X_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index 18eee85a..743b43be 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -11,7 +11,7 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
static construct {
string[] mime_types = { CUE_MIME_TYPE, SEGA_SATURN_MIME_TYPE };
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, mime_types, PLATFORM_UID_PREFIX);
+ platform = new Platform.with_mime_types (PLATFORM_ID, PLATFORM_NAME, mime_types,
SEGA_SATURN_MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
index 4e7c651a..41ecf67a 100644
--- a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
+++ b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
@@ -13,7 +13,7 @@ private class Games.TurboGrafxCDPlugin : Object, Plugin {
static construct {
string[] mime_types = { CUE_MIME_TYPE };
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, mime_types, PLATFORM_UID_PREFIX);
+ platform = new Platform.with_mime_types (PLATFORM_ID, PLATFORM_NAME, mime_types,
PHONY_MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/virtual-boy/src/virtual-boy-plugin.vala b/plugins/virtual-boy/src/virtual-boy-plugin.vala
index 7fe380eb..df8e5fcf 100644
--- a/plugins/virtual-boy/src/virtual-boy-plugin.vala
+++ b/plugins/virtual-boy/src/virtual-boy-plugin.vala
@@ -9,7 +9,7 @@ private class Games.VirtualBoyPlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE }, PLATFORM_UID_PREFIX);
+ platform = new Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index c1e6ff8d..81dec08c 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -9,7 +9,7 @@ private class Games.WiiPlugin : Object, Plugin {
private static Platform platform;
static construct {
- platform = new Platform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE }, PLATFORM_UID_PREFIX);
+ platform = new Platform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPE, PLATFORM_UID_PREFIX);
}
public Platform[] get_platforms () {
diff --git a/src/core/platform.vala b/src/core/platform.vala
index a553d9f5..39bcf322 100644
--- a/src/core/platform.vala
+++ b/src/core/platform.vala
@@ -4,14 +4,25 @@ public class Games.Platform : Object {
private string name;
private string id;
private string[] mime_types;
+ private string presentation_mime_type;
private string prefix;
public bool autodiscovery { get; private set; }
- public Platform (string id, string name, string[] mime_types, string prefix, bool autodiscovery =
true) {
+ public Platform (string id, string name, string mime_type, string prefix, bool autodiscovery = true)
{
+ this.id = id;
+ this.name = name;
+ this.mime_types = { mime_type };
+ this.presentation_mime_type = mime_type;
+ this.prefix = prefix;
+ this.autodiscovery = autodiscovery;
+ }
+
+ public Platform.with_mime_types (string id, string name, string[] mime_types, string
presentation_mime_type, string prefix, bool autodiscovery = true) {
this.id = id;
this.name = name;
this.mime_types = mime_types;
+ this.presentation_mime_type = presentation_mime_type;
this.prefix = prefix;
this.autodiscovery = autodiscovery;
}
@@ -32,6 +43,10 @@ public class Games.Platform : Object {
return mime_types;
}
+ public string get_presentation_mime_type () {
+ return presentation_mime_type;
+ }
+
public virtual Type get_snapshot_type () {
return typeof (Snapshot);
}
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 1651d817..9d8a5b01 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -460,7 +460,7 @@ public class Games.Application : Gtk.Application {
}
var platform_name = simple_type.get_platform_name ();
- var platform = new Platform (simple_type.platform, platform_name, {
simple_type.mime_type }, simple_type.prefix);
+ var platform = new Platform (simple_type.platform, platform_name,
simple_type.mime_type, simple_type.prefix);
platform_register.add_platform (platform);
var game_uri_adapter = new RetroSimpleGameUriAdapter (simple_type, platform);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]