[gnome-games] steam: Add SteamTitle
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] steam: Add SteamTitle
- Date: Thu, 12 May 2016 16:53:45 +0000 (UTC)
commit d7a101a72d6bffaca49e8533ff2c0dbc48982af2
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu May 12 18:36:39 2016 +0200
steam: Add SteamTitle
This will be used in the next commit to provide Steam game titles to
GenericGame and hence to allow to replace SteamGame by GenericGame.
plugins/steam/src/Makefile.am | 1 +
plugins/steam/src/steam-title.vala | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/plugins/steam/src/Makefile.am b/plugins/steam/src/Makefile.am
index 3a79455..104913b 100644
--- a/plugins/steam/src/Makefile.am
+++ b/plugins/steam/src/Makefile.am
@@ -11,6 +11,7 @@ libgames_steam_plugin_la_SOURCES = \
steam-icon.vala \
steam-plugin.vala \
steam-registry.vala \
+ steam-title.vala \
$(NULL)
libgames_steam_plugin_la_VALAFLAGS = \
diff --git a/plugins/steam/src/steam-title.vala b/plugins/steam/src/steam-title.vala
new file mode 100644
index 0000000..5a5c3f8
--- /dev/null
+++ b/plugins/steam/src/steam-title.vala
@@ -0,0 +1,21 @@
+// This file is part of GNOME Games. License: GPLv3
+
+private class Games.SteamTitle : Object, Title {
+ private SteamRegistry registry;
+ private string name;
+
+ public SteamTitle (SteamRegistry registry) {
+ this.registry = registry;
+ }
+
+ public string get_title () throws Error {
+ if (name != null)
+ return name;
+
+ name = registry.get_data ({"AppState", "name"});
+ if (name == null)
+ throw new SteamGameError.NO_NAME (@"Couldn't get name from Steam registry.");
+
+ return name;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]