[gnome-games] steam: Add SteamUid



commit 3ddea97309a22025d022e28e222220ac5ad9a5bd
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Jul 10 18:51:43 2018 +0500

    steam: Add SteamUid
    
    This will be used in subsequent commits to represent uid for Steam games.
    
    Uses steam app id as identifier.

 plugins/steam/src/meson.build    |  1 +
 plugins/steam/src/steam-uid.vala | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/plugins/steam/src/meson.build b/plugins/steam/src/meson.build
index 2dd2f0c..a473a85 100644
--- a/plugins/steam/src/meson.build
+++ b/plugins/steam/src/meson.build
@@ -7,6 +7,7 @@ vala_sources = [
   'steam-title.vala',
   'steam-uri-iterator.vala',
   'steam-uri-source.vala',
+  'steam-uid.vala',
 ]
 
 c_args = [
diff --git a/plugins/steam/src/steam-uid.vala b/plugins/steam/src/steam-uid.vala
new file mode 100644
index 0000000..6bd7025
--- /dev/null
+++ b/plugins/steam/src/steam-uid.vala
@@ -0,0 +1,19 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.SteamUid: Object, Uid {
+       private string uid;
+       private string app_id;
+
+       public SteamUid (string app_id) {
+               this.app_id = app_id;
+       }
+
+       public string get_uid () throws Error {
+               if (uid != null)
+                       return uid;
+
+               uid = @"steam-$app_id".down ();
+
+               return uid;
+       }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]