From 601c910c478262212197e93fe3b03ad10a7b1b1c Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Thu, 2 Apr 2020 12:29:24 +0200
Subject: [PATCH] Create a new srt_system_info_get_steam_details function

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 steam-runtime-tools/system-info.c | 18 ++++++++++++++++++
 steam-runtime-tools/system-info.h |  1 +
 tests/system-info.c               |  9 +++++++++
 3 files changed, 28 insertions(+)

diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c
index 8136281f9..c0061848a 100644
--- a/steam-runtime-tools/system-info.c
+++ b/steam-runtime-tools/system-info.c
@@ -1655,6 +1655,24 @@ srt_system_info_get_steam_issues (SrtSystemInfo *self)
   return srt_steam_get_issues (self->steam_data);
 }
 
+/**
+ * srt_system_info_get_steam_details:
+ * @self: The #SrtSystemInfo object
+ *
+ * Gather and return information about the Steam installation.
+ *
+ * Returns: (transfer full): An #SrtSteam object. Free with
+ *  `g_object_unref ()`.
+ */
+SrtSteam *
+srt_system_info_get_steam_details (SrtSystemInfo *self)
+{
+  g_return_val_if_fail (SRT_IS_SYSTEM_INFO (self), NULL);
+
+  ensure_steam_cached (self);
+  return g_object_ref (self->steam_data);
+}
+
 /**
  * srt_system_info_dup_steam_installation_path:
  * @self: The #SrtSystemInfo object
diff --git a/steam-runtime-tools/system-info.h b/steam-runtime-tools/system-info.h
index 731d5d622..266ef0584 100644
--- a/steam-runtime-tools/system-info.h
+++ b/steam-runtime-tools/system-info.h
@@ -165,6 +165,7 @@ gchar *srt_system_info_dup_runtime_path (SrtSystemInfo *self);
 gchar *srt_system_info_dup_runtime_version (SrtSystemInfo *self);
 
 SrtSteamIssues srt_system_info_get_steam_issues (SrtSystemInfo *self);
+SrtSteam *srt_system_info_get_steam_details (SrtSystemInfo *self);
 gchar *srt_system_info_dup_steam_installation_path (SrtSystemInfo *self);
 gchar *srt_system_info_dup_steam_data_path (SrtSystemInfo *self);
 
diff --git a/tests/system-info.c b/tests/system-info.c
index 7905874e4..cd0ed8108 100644
--- a/tests/system-info.c
+++ b/tests/system-info.c
@@ -733,6 +733,7 @@ steam_runtime (Fixture *f,
   SrtSystemInfo *info;
   SrtRuntimeIssues runtime_issues;
   SrtSteamIssues steam_issues;
+  SrtSteam *steam_details;
   gchar *runtime_path = NULL;
   gchar *installation_path = NULL;
   FakeHome *fake_home;
@@ -764,13 +765,21 @@ steam_runtime (Fixture *f,
   /* Check for Steam issues */
   steam_issues = srt_system_info_get_steam_issues (info);
   g_assert_cmpint (steam_issues, ==, SRT_STEAM_ISSUES_NONE);
+  steam_details = srt_system_info_get_steam_details (info);
+  steam_issues = srt_steam_get_issues (steam_details);
+  g_assert_cmpint (steam_issues, ==, SRT_STEAM_ISSUES_NONE);
+  g_object_unref (steam_details);
 
   /* Do the check again, this time using the cache */
   steam_issues = srt_system_info_get_steam_issues (info);
   g_assert_cmpint (steam_issues, ==, SRT_STEAM_ISSUES_NONE);
+  steam_details = srt_system_info_get_steam_details (info);
+  steam_issues = srt_steam_get_issues (steam_details);
+  g_assert_cmpint (steam_issues, ==, SRT_STEAM_ISSUES_NONE);
 
   fake_home_clean_up (fake_home);
   g_object_unref (info);
+  g_object_unref (steam_details);
   g_free (runtime_path);
   g_free (installation_path);
 }
-- 
GitLab