[gtk: 1/2] gtkapplication-dbus: Initialise screensaver-active property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gtkapplication-dbus: Initialise screensaver-active property
- Date: Sun, 15 Sep 2019 15:54:45 +0000 (UTC)
commit 6bfe17105828b0b2eb0f4a362d3039d9416e3519
Author: Bob Ham <bob ham puri sm>
Date: Fri Sep 6 14:59:27 2019 +0100
gtkapplication-dbus: Initialise screensaver-active property
When GtkApplication starts listening to the screensaver's D-Bus
status, the screensaver-active property is not initialised and
applications making use of the property are out of sync until the
first state change. Any application starting when the screensaver is
active will think it's inactive.
To fix this, we set the property when we first start monitoring the
screensaver.
gtk/gtkapplication-dbus.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c
index b73d86046c..a58112a503 100644
--- a/gtk/gtkapplication-dbus.c
+++ b/gtk/gtkapplication-dbus.c
@@ -358,8 +358,31 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
if (dbus->ss_proxy)
{
+ GVariant *active_var;
+ gboolean active;
+
g_signal_connect (dbus->ss_proxy, "g-signal",
G_CALLBACK (screensaver_signal_session), impl->application);
+
+ active_var = g_dbus_proxy_call_sync (dbus->ss_proxy,
+ "GetActive",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ &error);
+ if (!active_var)
+ {
+ g_debug ("Error calling GetActive on GNOME screensaver: %s",
+ error->message);
+ g_clear_error (&error);
+ }
+ else
+ {
+ g_variant_get (active_var, "(b)", &active);
+ g_variant_unref (active_var);
+ gtk_application_set_screensaver_active (dbus->impl.application, active);
+ }
}
g_debug ("Registering client '%s' '%s'", dbus->application_id, client_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]