[gnome-games] gameinfo: Add GameinfoDiscIdDiscTitle
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gameinfo: Add GameinfoDiscIdDiscTitle
- Date: Fri, 19 Aug 2016 21:11:16 +0000 (UTC)
commit 7727b6f5633da01a0b652cecb7db13146218e887
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Aug 19 21:36:26 2016 +0200
gameinfo: Add GameinfoDiscIdDiscTitle
This will be used in subsequent commits to get a disc's title from a
Gameinfo document and its ID.
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
src/Makefile.am | 1 +
src/gameinfo/gameinfo-disc-id-disc-title.vala | 29 +++++++++++++++++++++++++
4 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c2e3f86..0399df6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -32,6 +32,7 @@ plugins/steam/src/steam-title.vala
plugins/wii/src/wii-header.vala
src/command/command-runner.vala
src/core/plugin-registrar.vala
+src/gameinfo/gameinfo-disc-id-disc-title.vala
src/gamepad/gamepad-mapping.vala
src/gamepad/linux/linux-raw-gamepad.vala
src/retro/retro-runner.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 0f6fad4..9af222d 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -19,6 +19,7 @@ plugins/steam/src/steam-title.c
plugins/wii/src/wii-header.c
src/command/command-runner.c
src/core/plugin-registrar.c
+src/gameinfo/gameinfo-disc-id-disc-title.c
src/gamepad/gamepad-mapping.c
src/gamepad/linux/linux-raw-gamepad.c
src/retro/retro-runner.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 22de1bf..2064097 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-disc-title.vala \
gameinfo/gameinfo-disc-id-game-title.vala \
\
gamepad/gamepad.vala \
diff --git a/src/gameinfo/gameinfo-disc-id-disc-title.vala b/src/gameinfo/gameinfo-disc-id-disc-title.vala
new file mode 100644
index 0000000..541dfc2
--- /dev/null
+++ b/src/gameinfo/gameinfo-disc-id-disc-title.vala
@@ -0,0 +1,29 @@
+// This file is part of GNOME Games. License: GPLv3
+
+public class Games.GameinfoDiscIdDiscTitle : Object, Title {
+ private GameinfoDoc gameinfo;
+ private string disc_id;
+ private string? domain;
+ private string title;
+
+ public GameinfoDiscIdDiscTitle (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);
+
+ try {
+ title = gameinfo.get_disc_title_for_disc_id (disc_id);
+ }
+ catch (Error e) {
+ var index = gameinfo.get_disc_set_index_for_disc_id (disc_id);
+ title = _("Disc %d").printf (index + 1);
+ }
+
+ return dgettext (domain, title);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]