[gnome-games] retro-runner: Replace UID string by Uid
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro-runner: Replace UID string by Uid
- Date: Fri, 25 Mar 2016 06:44:17 +0000 (UTC)
commit 540d16b37f88f1d1c384d31c83ed4dd699c4b31d
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Mar 22 19:15:50 2016 +0100
retro-runner: Replace UID string by Uid
This allow lazy computation of the UIDs, hence helping to construct a
RetroRunner earlier with no performance impact.
This is needed to create a generic game type.
plugins/amiga/src/amiga-game.vala | 4 +---
plugins/doom/src/doom-game.vala | 4 +---
plugins/dreamcast/src/dreamcast-game.vala | 4 +---
.../src/game-boy-advance-game.vala | 4 +---
plugins/game-boy/src/game-boy-game.vala | 4 +---
plugins/game-cube/src/game-cube-game.vala | 4 +---
plugins/mame/src/mame-game.vala | 4 +---
plugins/master-system/src/master-system-game.vala | 4 +---
plugins/mega-drive/src/mega-drive-game.vala | 4 +---
.../neo-geo-pocket/src/neo-geo-pocket-game.vala | 4 +---
plugins/nes/src/nes-game.vala | 4 +---
plugins/nintendo-64/src/nintendo-64-game.vala | 4 +---
plugins/nintendo-ds/src/nintendo-ds-game.vala | 4 +---
plugins/pc-engine/src/pc-engine-game.vala | 4 +---
plugins/sega-saturn/src/sega-saturn-game.vala | 4 +---
plugins/snes/src/snes-game.vala | 4 +---
plugins/wii-ware/src/wii-ware-game.vala | 4 +---
plugins/wii/src/wii-game.vala | 4 +---
src/retro/retro-runner.vala | 7 +++++--
19 files changed, 23 insertions(+), 56 deletions(-)
---
diff --git a/plugins/amiga/src/amiga-game.vala b/plugins/amiga/src/amiga-game.vala
index 6fb2d80..afdbec8 100644
--- a/plugins/amiga/src/amiga-game.vala
+++ b/plugins/amiga/src/amiga-game.vala
@@ -38,8 +38,6 @@ private class Games.AmigaGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/doom/src/doom-game.vala b/plugins/doom/src/doom-game.vala
index c5286fe..b562f00 100644
--- a/plugins/doom/src/doom-game.vala
+++ b/plugins/doom/src/doom-game.vala
@@ -38,8 +38,6 @@ private class Games.DoomGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/dreamcast/src/dreamcast-game.vala b/plugins/dreamcast/src/dreamcast-game.vala
index 65eb135..6333895 100644
--- a/plugins/dreamcast/src/dreamcast-game.vala
+++ b/plugins/dreamcast/src/dreamcast-game.vala
@@ -41,8 +41,6 @@ private class Games.DreamcastGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/game-boy-advance/src/game-boy-advance-game.vala
b/plugins/game-boy-advance/src/game-boy-advance-game.vala
index a940f9b..aebca65 100644
--- a/plugins/game-boy-advance/src/game-boy-advance-game.vala
+++ b/plugins/game-boy-advance/src/game-boy-advance-game.vala
@@ -38,8 +38,6 @@ private class Games.GameBoyAdvanceGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/game-boy/src/game-boy-game.vala b/plugins/game-boy/src/game-boy-game.vala
index b41c823..b28c80b 100644
--- a/plugins/game-boy/src/game-boy-game.vala
+++ b/plugins/game-boy/src/game-boy-game.vala
@@ -41,8 +41,6 @@ private class Games.GameBoyGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/game-cube/src/game-cube-game.vala b/plugins/game-cube/src/game-cube-game.vala
index d30b839..e0233ad 100644
--- a/plugins/game-cube/src/game-cube-game.vala
+++ b/plugins/game-cube/src/game-cube-game.vala
@@ -41,8 +41,6 @@ private class Games.GameCubeGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/mame/src/mame-game.vala b/plugins/mame/src/mame-game.vala
index 23a7ab3..0c6d4e5 100644
--- a/plugins/mame/src/mame-game.vala
+++ b/plugins/mame/src/mame-game.vala
@@ -45,8 +45,6 @@ private class Games.MameGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/master-system/src/master-system-game.vala
b/plugins/master-system/src/master-system-game.vala
index e0c6c39..8118f1c 100644
--- a/plugins/master-system/src/master-system-game.vala
+++ b/plugins/master-system/src/master-system-game.vala
@@ -41,8 +41,6 @@ private class Games.MasterSystemGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/mega-drive/src/mega-drive-game.vala b/plugins/mega-drive/src/mega-drive-game.vala
index fe6e9e4..8a04ee6 100644
--- a/plugins/mega-drive/src/mega-drive-game.vala
+++ b/plugins/mega-drive/src/mega-drive-game.vala
@@ -41,8 +41,6 @@ private class Games.MegaDriveGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/neo-geo-pocket/src/neo-geo-pocket-game.vala
b/plugins/neo-geo-pocket/src/neo-geo-pocket-game.vala
index 0847647..7f76b21 100644
--- a/plugins/neo-geo-pocket/src/neo-geo-pocket-game.vala
+++ b/plugins/neo-geo-pocket/src/neo-geo-pocket-game.vala
@@ -38,8 +38,6 @@ private class Games.NeoGeoPocketGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/nes/src/nes-game.vala b/plugins/nes/src/nes-game.vala
index 1691798..753ff3c 100644
--- a/plugins/nes/src/nes-game.vala
+++ b/plugins/nes/src/nes-game.vala
@@ -38,8 +38,6 @@ private class Games.NesGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/nintendo-64/src/nintendo-64-game.vala b/plugins/nintendo-64/src/nintendo-64-game.vala
index d11528c..ec92667 100644
--- a/plugins/nintendo-64/src/nintendo-64-game.vala
+++ b/plugins/nintendo-64/src/nintendo-64-game.vala
@@ -38,8 +38,6 @@ private class Games.Nintendo64Game : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/nintendo-ds/src/nintendo-ds-game.vala b/plugins/nintendo-ds/src/nintendo-ds-game.vala
index e3f78c5..4b56f4e 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-game.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-game.vala
@@ -38,8 +38,6 @@ private class Games.NintendoDsGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/pc-engine/src/pc-engine-game.vala b/plugins/pc-engine/src/pc-engine-game.vala
index c3ff6ba..bbe4ead 100644
--- a/plugins/pc-engine/src/pc-engine-game.vala
+++ b/plugins/pc-engine/src/pc-engine-game.vala
@@ -38,8 +38,6 @@ private class Games.PcEngineGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/sega-saturn/src/sega-saturn-game.vala b/plugins/sega-saturn/src/sega-saturn-game.vala
index 26a8a9a..6979c9e 100644
--- a/plugins/sega-saturn/src/sega-saturn-game.vala
+++ b/plugins/sega-saturn/src/sega-saturn-game.vala
@@ -43,9 +43,7 @@ private class Games.SegaSaturnGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
private string? get_associated_cue_sheet (File file) throws Error {
diff --git a/plugins/snes/src/snes-game.vala b/plugins/snes/src/snes-game.vala
index 6ae74ee..d766faf 100644
--- a/plugins/snes/src/snes-game.vala
+++ b/plugins/snes/src/snes-game.vala
@@ -69,9 +69,7 @@ private class Games.SnesGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/wii-ware/src/wii-ware-game.vala b/plugins/wii-ware/src/wii-ware-game.vala
index 2eb8eef..24bc2c2 100644
--- a/plugins/wii-ware/src/wii-ware-game.vala
+++ b/plugins/wii-ware/src/wii-ware-game.vala
@@ -38,8 +38,6 @@ private class Games.WiiWareGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/plugins/wii/src/wii-game.vala b/plugins/wii/src/wii-game.vala
index 825dbd2..b7240d0 100644
--- a/plugins/wii/src/wii-game.vala
+++ b/plugins/wii/src/wii-game.vala
@@ -41,8 +41,6 @@ private class Games.WiiGame : Object, Game {
}
public Runner get_runner () throws Error {
- var uid_string = uid.get_uid ();
-
- return new RetroRunner (MODULE_BASENAME, uri, uid_string);
+ return new RetroRunner (MODULE_BASENAME, uri, uid);
}
}
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index e8852f6..d26d7e4 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -33,7 +33,7 @@ public class Games.RetroRunner : Object, Runner {
private string snapshot_path;
private string screenshot_path;
- private string uid;
+ private Uid uid;
private bool _running;
private bool running {
@@ -47,7 +47,7 @@ public class Games.RetroRunner : Object, Runner {
private bool construction_succeeded;
- public RetroRunner (string module_basename, string uri, string uid) throws Error {
+ public RetroRunner (string module_basename, string uri, Uid uid) throws Error {
construction_succeeded = false;
this.uid = uid;
@@ -203,6 +203,7 @@ public class Games.RetroRunner : Object, Runner {
return save_path;
var dir = Application.get_saves_dir ();
+ var uid = uid.get_uid ();
save_path = @"$dir/$uid.save";
return save_path;
@@ -242,6 +243,7 @@ public class Games.RetroRunner : Object, Runner {
return snapshot_path;
var dir = Application.get_snapshots_dir ();
+ var uid = uid.get_uid ();
snapshot_path = @"$dir/$uid.snapshot";
return snapshot_path;
@@ -284,6 +286,7 @@ public class Games.RetroRunner : Object, Runner {
return screenshot_path;
var dir = Application.get_snapshots_dir ();
+ var uid = uid.get_uid ();
screenshot_path = @"$dir/$uid.png";
return screenshot_path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]