From 8537c7593c2e6f25dbae00ae64ca1b3d8d0f2d0b Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 9 Nov 2021 00:56:48 -0300 Subject: [PATCH] linux-capture: Add getter to screencast portal version This will be used by the next commit to verify whether or not to pass the restore token and persist mode options. --- plugins/linux-capture/portal.c | 16 ++++++++++++++++ plugins/linux-capture/portal.h | 1 + 2 files changed, 17 insertions(+) diff --git a/plugins/linux-capture/portal.c b/plugins/linux-capture/portal.c index 1b0118f56c124c..f203470b630079 100644 --- a/plugins/linux-capture/portal.c +++ b/plugins/linux-capture/portal.c @@ -73,6 +73,22 @@ uint32_t portal_get_available_capture_types(void) return available_source_types; } +uint32_t portal_get_screencast_version(void) +{ + g_autoptr(GVariant) cached_version = NULL; + uint32_t version; + + ensure_proxy(); + + if (!proxy) + return 0; + + cached_version = g_dbus_proxy_get_cached_property(proxy, "version"); + version = cached_version ? g_variant_get_uint32(cached_version) : 0; + + return version; +} + GDBusConnection *portal_get_dbus_connection(void) { ensure_proxy(); diff --git a/plugins/linux-capture/portal.h b/plugins/linux-capture/portal.h index 3178591bee8899..e26bdeabdafba3 100644 --- a/plugins/linux-capture/portal.h +++ b/plugins/linux-capture/portal.h @@ -24,6 +24,7 @@ #include uint32_t portal_get_available_capture_types(void); +uint32_t portal_get_screencast_version(void); GDBusConnection *portal_get_dbus_connection(void); GDBusProxy *portal_get_dbus_proxy(void);