[gnome-games] gameinfo: Add GameinfoDiscIdGameTitle
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gameinfo: Add GameinfoDiscIdGameTitle
- Date: Fri, 19 Aug 2016 21:11:11 +0000 (UTC)
commit 09bcdcf2398cbca5e03a36dcd52f90ea3f76bf37
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Aug 19 21:36:26 2016 +0200
gameinfo: Add GameinfoDiscIdGameTitle
This will be used in a subsequent commit to get a game's title from a
Gameinfo document and a disc ID.
src/Makefile.am | 1 +
src/gameinfo/gameinfo-disc-id-game-title.vala | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 202c079..22de1bf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,6 +60,7 @@ gnome_games_SOURCES = \
\
gameinfo/gameinfo-doc.vala \
gameinfo/gameinfo-error.vala \
+ gameinfo/gameinfo-disc-id-game-title.vala \
\
gamepad/gamepad.vala \
gamepad/gamepad-callbacks.vala \
diff --git a/src/gameinfo/gameinfo-disc-id-game-title.vala b/src/gameinfo/gameinfo-disc-id-game-title.vala
new file mode 100644
index 0000000..9ba6123
--- /dev/null
+++ b/src/gameinfo/gameinfo-disc-id-game-title.vala
@@ -0,0 +1,23 @@
+// This file is part of GNOME Games. License: GPLv3
+
+public class Games.GameinfoDiscIdGameTitle : Object, Title {
+ private GameinfoDoc gameinfo;
+ private string disc_id;
+ private string? domain;
+ private string title;
+
+ public GameinfoDiscIdGameTitle (GameinfoDoc gameinfo, string disc_id, string? domain = null) {
+ this.gameinfo = gameinfo;
+ this.disc_id = disc_id;
+ this.domain = domain;
+ }
+
+ public string get_title () throws Error {
+ if (title != null)
+ return dgettext (domain, title);
+
+ title = gameinfo.get_game_title_for_disc_id (disc_id);
+
+ return dgettext (domain, title);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]