[gnome-games/wip/exalm/uid: 11/13] game: Make uri a property
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/uid: 11/13] game: Make uri a property
- Date: Sun, 23 Feb 2020 12:35:25 +0000 (UTC)
commit d51b3323eb238fa72bf107c589097728fa45cacb
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Feb 21 21:35:56 2020 +0500
game: Make uri a property
plugins/desktop/src/desktop-plugin.vala | 3 +--
plugins/libretro/src/libretro-plugin.vala | 3 +--
plugins/love/src/love-plugin.vala | 4 ++--
plugins/steam/src/steam-plugin.vala | 2 +-
src/core/game-collection.vala | 4 ++--
src/core/game.vala | 8 ++------
src/database/database.vala | 4 ++--
src/retro/retro-runner.vala | 4 ++--
8 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/plugins/desktop/src/desktop-plugin.vala b/plugins/desktop/src/desktop-plugin.vala
index 163b4b9e..e3aa2e04 100644
--- a/plugins/desktop/src/desktop-plugin.vala
+++ b/plugins/desktop/src/desktop-plugin.vala
@@ -72,8 +72,7 @@ private class Games.DesktopPlugin : Object, Plugin {
}
private static Runner? create_runner (Game game) throws Error {
- var uri = game.get_uri ();
- var file = uri.to_file ();
+ var file = game.uri.to_file ();
var path = file.get_path ();
var app_info = new DesktopAppInfo.from_filename (path);
diff --git a/plugins/libretro/src/libretro-plugin.vala b/plugins/libretro/src/libretro-plugin.vala
index 0653a5f8..7376511a 100644
--- a/plugins/libretro/src/libretro-plugin.vala
+++ b/plugins/libretro/src/libretro-plugin.vala
@@ -71,8 +71,7 @@ private class Games.LibretroPlugin : Object, Plugin {
}
private static Runner? create_runner (Game game) throws Error {
- var uri = game.get_uri ();
- var core_descriptor = get_core_descriptor (uri);
+ var core_descriptor = get_core_descriptor (game.uri);
var runner = new RetroRunner.from_descriptor (game, core_descriptor);
runner.input_capabilities = new GenericInputCapabilities (true);
diff --git a/plugins/love/src/love-plugin.vala b/plugins/love/src/love-plugin.vala
index 75a98caa..439d5eb9 100644
--- a/plugins/love/src/love-plugin.vala
+++ b/plugins/love/src/love-plugin.vala
@@ -50,8 +50,8 @@ private class Games.LovePlugin : Object, Plugin {
}
private static Runner? create_runner (Game game) throws Error {
- var uri = game.get_uri ();
- string[] args = { "love", uri.to_string () };
+ string[] args = { "love", game.uri.to_string () };
+
return new CommandRunner (args);
}
}
diff --git a/plugins/steam/src/steam-plugin.vala b/plugins/steam/src/steam-plugin.vala
index 3069c648..a9c7fde0 100644
--- a/plugins/steam/src/steam-plugin.vala
+++ b/plugins/steam/src/steam-plugin.vala
@@ -115,7 +115,7 @@ private class Games.SteamPlugin : Object, Plugin {
}
private static Runner? create_runner (Game game) throws Error {
- var uri = game.get_uri ();
+ var uri = game.uri;
var scheme = uri.get_scheme ();
var steam_uri = new Uri.from_uri_and_scheme (uri, STEAM_SCHEME);
diff --git a/src/core/game-collection.vala b/src/core/game-collection.vala
index a9e547af..932c6715 100644
--- a/src/core/game-collection.vala
+++ b/src/core/game-collection.vala
@@ -101,7 +101,7 @@ private class Games.GameCollection : Object {
if (!is_preloading_done) {
try {
database.list_cached_games ((game) => {
- cached_games[game.get_uri ().to_string ()] = game;
+ cached_games[game.uri.to_string ()] = game;
if (games.contains (game.uid))
return;
@@ -236,7 +236,7 @@ private class Games.GameCollection : Object {
}
private void store_game (Game game) {
- var uri = game.get_uri ().to_string ();
+ var uri = game.uri.to_string ();
if (cached_games.contains (uri)) {
var cached_game = cached_games.take (uri);
diff --git a/src/core/game.vala b/src/core/game.vala
index dd1084b4..b3043b6d 100644
--- a/src/core/game.vala
+++ b/src/core/game.vala
@@ -21,8 +21,8 @@ public class Games.Game : Object {
}
public string uid { get; private set; }
+ public Uri uri { get; private set; }
- private Uri game_uri;
private Title game_title;
private Icon game_icon;
private Cover game_cover;
@@ -31,15 +31,11 @@ public class Games.Game : Object {
public Game (string uid, Uri uri, Title title, Platform platform) {
this.uid = uid;
- game_uri = uri;
+ this.uri = uri;
game_title = title;
game_platform = platform;
}
- public Uri get_uri () {
- return game_uri;
- }
-
public Icon get_icon () {
if (game_icon == null)
game_icon = new DummyIcon ();
diff --git a/src/database/database.vala b/src/database/database.vala
index 70efc3e6..7f7f0890 100644
--- a/src/database/database.vala
+++ b/src/database/database.vala
@@ -195,7 +195,7 @@ private class Games.Database : Object {
public Game? store_game (Game game) throws Error {
var uid = game.uid;
- var uri = game.get_uri ().to_string ();
+ var uri = game.uri.to_string ();
var title = game.name;
var platform = game.get_platform ().get_id ();
var media_set = serialize_media_set (game);
@@ -229,7 +229,7 @@ private class Games.Database : Object {
public void update_game (Game game, Game? prev_game = null) throws Error {
var uid = game.uid;
- var uri = game.get_uri ().to_string ();
+ var uri = game.uri.to_string ();
var title = game.name;
var media_set = serialize_media_set (game);
var old_title = prev_game != null ? prev_game.name : null;
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 21e0ee48..4e53fb0d 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -67,9 +67,9 @@ public class Games.RetroRunner : Object, Runner {
this.game = game;
_media_set = game.get_media_set ();
- if (media_set == null && game.get_uri () != null) {
+ if (media_set == null && game.uri != null) {
var media = new Media ();
- media.add_uri (game.get_uri ());
+ media.add_uri (game.uri);
_media_set = new MediaSet ();
_media_set.add_media (media);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]