[gnome-games/wip/exalm/loading: 2/29] game: Add get_uri()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/loading: 2/29] game: Add get_uri()
- Date: Mon, 11 Nov 2019 21:44:49 +0000 (UTC)
commit 72b498a2b7c2b30e55d068a3cfc7a25f78a2c5e7
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Nov 11 23:46:38 2019 +0500
game: Add get_uri()
plugins/desktop/src/desktop-plugin.vala | 2 +-
plugins/dreamcast/src/dreamcast-plugin.vala | 2 +-
plugins/game-cube/src/game-cube-plugin.vala | 2 +-
plugins/libretro/src/libretro-plugin.vala | 2 +-
plugins/love/src/love-plugin.vala | 2 +-
plugins/mame/src/mame-game-uri-adapter.vala | 2 +-
plugins/ms-dos/src/ms-dos-plugin.vala | 2 +-
plugins/nintendo-ds/src/nintendo-ds-plugin.vala | 2 +-
plugins/playstation/src/playstation-game-factory.vala | 2 +-
plugins/sega-cd/src/sega-cd-plugin.vala | 2 +-
plugins/sega-saturn/src/sega-saturn-plugin.vala | 2 +-
plugins/steam/src/steam-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/game.vala | 1 +
src/database/database-game.vala | 4 ++++
src/dummy/dummy-game.vala | 8 ++++++++
src/generic/generic-game.vala | 8 +++++++-
src/retro/retro-simple-game-uri-adapter.vala | 2 +-
20 files changed, 36 insertions(+), 17 deletions(-)
---
diff --git a/plugins/desktop/src/desktop-plugin.vala b/plugins/desktop/src/desktop-plugin.vala
index 1b03dcd4..3b741c40 100644
--- a/plugins/desktop/src/desktop-plugin.vala
+++ b/plugins/desktop/src/desktop-plugin.vala
@@ -57,7 +57,7 @@ private class Games.DesktopPlugin : Object, Plugin {
throw new CommandError.INVALID_COMMAND (_("Invalid command ā%sā."), command);
var runner = new CommandRunner (args);
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_icon (icon);
return game;
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 09a4ed2e..5b245f79 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -48,7 +48,7 @@ private class Games.DreamcastPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index 41e59916..380961c8 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -48,7 +48,7 @@ private class Games.GameCubePlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/libretro/src/libretro-plugin.vala b/plugins/libretro/src/libretro-plugin.vala
index 8a4542ef..3e93f4da 100644
--- a/plugins/libretro/src/libretro-plugin.vala
+++ b/plugins/libretro/src/libretro-plugin.vala
@@ -54,7 +54,7 @@ private class Games.LibretroPlugin : Object, Plugin {
builder.input_capabilities = input_capabilities;
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_icon (icon);
return game;
diff --git a/plugins/love/src/love-plugin.vala b/plugins/love/src/love-plugin.vala
index 34e51038..b078e71a 100644
--- a/plugins/love/src/love-plugin.vala
+++ b/plugins/love/src/love-plugin.vala
@@ -37,7 +37,7 @@ private class Games.LovePlugin : Object, Plugin {
string[] args = { "love", uri.to_string () };
var runner = new CommandRunner (args);
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_icon (icon);
game.set_cover (cover);
diff --git a/plugins/mame/src/mame-game-uri-adapter.vala b/plugins/mame/src/mame-game-uri-adapter.vala
index 1db1b00d..7b3d3899 100644
--- a/plugins/mame/src/mame-game-uri-adapter.vala
+++ b/plugins/mame/src/mame-game-uri-adapter.vala
@@ -39,7 +39,7 @@ private class Games.MameGameUriAdapter : GameUriAdapter, Object {
Idle.add (this.game_for_uri.callback);
yield;
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
index 70f6e0b5..c1cfe7da 100644
--- a/plugins/ms-dos/src/ms-dos-plugin.vala
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -43,7 +43,7 @@ private class Games.MsDosPlugin : Object, Plugin {
builder.input_capabilities = input_capabilities;
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 4ec95b25..e50a557b 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -45,7 +45,7 @@ private class Games.NintendoDsPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner (typeof (NintendoDsRunner)) as NintendoDsRunner;
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_icon (icon);
game.set_cover (cover);
diff --git a/plugins/playstation/src/playstation-game-factory.vala
b/plugins/playstation/src/playstation-game-factory.vala
index 19dc0fb4..b8a7c33b 100644
--- a/plugins/playstation/src/playstation-game-factory.vala
+++ b/plugins/playstation/src/playstation-game-factory.vala
@@ -153,7 +153,7 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
builder.input_capabilities = input_capabilities;
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/sega-cd/src/sega-cd-plugin.vala b/plugins/sega-cd/src/sega-cd-plugin.vala
index d3e3072c..51afba35 100644
--- a/plugins/sega-cd/src/sega-cd-plugin.vala
+++ b/plugins/sega-cd/src/sega-cd-plugin.vala
@@ -89,7 +89,7 @@ private class Games.SegaCDPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index b75ea788..b06f23f1 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -72,7 +72,7 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/steam/src/steam-plugin.vala b/plugins/steam/src/steam-plugin.vala
index 5ea51ecc..9a90c88b 100644
--- a/plugins/steam/src/steam-plugin.vala
+++ b/plugins/steam/src/steam-plugin.vala
@@ -95,7 +95,7 @@ private class Games.SteamPlugin : Object, Plugin {
args += @"steam://rungameid/$game_id";
var runner = new CommandRunner (args);
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_icon (icon);
game.set_cover (cover);
diff --git a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
index 28712335..c9a24c56 100644
--- a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
+++ b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
@@ -51,7 +51,7 @@ private class Games.TurboGrafxCDPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/virtual-boy/src/virtual-boy-plugin.vala b/plugins/virtual-boy/src/virtual-boy-plugin.vala
index 13c0754e..9d026992 100644
--- a/plugins/virtual-boy/src/virtual-boy-plugin.vala
+++ b/plugins/virtual-boy/src/virtual-boy-plugin.vala
@@ -49,7 +49,7 @@ private class Games.VirtualBoyPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index fdc44413..cb3c08c7 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -48,7 +48,7 @@ private class Games.WiiPlugin : Object, Plugin {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
diff --git a/src/core/game.vala b/src/core/game.vala
index 056c18a5..e9ddc918 100644
--- a/src/core/game.vala
+++ b/src/core/game.vala
@@ -4,6 +4,7 @@ public interface Games.Game : Object {
public abstract string name { get; }
public abstract Uid get_uid ();
+ public abstract Uri get_uri ();
public abstract Icon get_icon ();
public abstract Cover get_cover ();
public abstract Platform get_platform ();
diff --git a/src/database/database-game.vala b/src/database/database-game.vala
index 5353f19e..6610db1b 100644
--- a/src/database/database-game.vala
+++ b/src/database/database-game.vala
@@ -17,6 +17,10 @@ private class Games.DatabaseGame : Object, Game {
return database.get_uid (game.get_uid ());
}
+ public Uri get_uri () {
+ return game.get_uri ();
+ }
+
public Icon get_icon () {
return game.get_icon ();
}
diff --git a/src/dummy/dummy-game.vala b/src/dummy/dummy-game.vala
index 869228e2..bdff2d8e 100644
--- a/src/dummy/dummy-game.vala
+++ b/src/dummy/dummy-game.vala
@@ -1,16 +1,20 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.DummyGame : Object, Game {
+ private Uri uri;
private string _name;
public string name {
get { return _name; }
}
public DummyGame (string name) {
+ uri = new Uri ("");
_name = name;
}
public DummyGame.for_uri (Uri uri) {
+ this.uri = uri;
+
var file = uri.to_file ();
var name = file.get_basename ();
name = name.split (".")[0];
@@ -22,6 +26,10 @@ private class Games.DummyGame : Object, Game {
return new DummyUid ();
}
+ public Uri get_uri () {
+ return uri;
+ }
+
public Icon get_icon () {
return new DummyIcon ();
}
diff --git a/src/generic/generic-game.vala b/src/generic/generic-game.vala
index a047fcc2..189daf93 100644
--- a/src/generic/generic-game.vala
+++ b/src/generic/generic-game.vala
@@ -19,14 +19,16 @@ public class Games.GenericGame : Object, Game {
}
private Uid game_uid;
+ private Uri game_uri;
private Title game_title;
private Icon game_icon;
private Cover game_cover;
private Platform game_platform;
private Runner game_runner;
- public GenericGame (Uid uid, Title title, Platform platform, Runner runner) {
+ public GenericGame (Uid uid, Uri uri, Title title, Platform platform, Runner runner) {
game_uid = uid;
+ game_uri = uri;
game_title = title;
game_runner = runner;
game_platform = platform;
@@ -36,6 +38,10 @@ public class Games.GenericGame : Object, Game {
return game_uid;
}
+ public Uri get_uri () {
+ return game_uri;
+ }
+
public Icon get_icon () {
if (game_icon == null)
game_icon = new DummyIcon ();
diff --git a/src/retro/retro-simple-game-uri-adapter.vala b/src/retro/retro-simple-game-uri-adapter.vala
index e8ee03cb..5f023d1e 100644
--- a/src/retro/retro-simple-game-uri-adapter.vala
+++ b/src/retro/retro-simple-game-uri-adapter.vala
@@ -28,7 +28,7 @@ private class Games.RetroSimpleGameUriAdapter : GameUriAdapter, Object {
builder.title = title.get_title ();
var runner = builder.to_runner ();
- var game = new GenericGame (uid, title, platform, runner);
+ var game = new GenericGame (uid, uri, title, platform, runner);
game.set_cover (cover);
return game;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]