[gtk/portal-session-state] Application: Support sandboxed session state changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/portal-session-state] Application: Support sandboxed session state changes
- Date: Sun, 20 Jan 2019 16:30:48 +0000 (UTC)
commit 0c712c20c36b1ae446d55dccebbd2b49e5f07147
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 20 11:29:04 2019 -0500
Application: Support sandboxed session state changes
React to the session-state in StateChanged signals from
the inhibit portal.
gtk/gtkapplication-dbus.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c
index 05af8f2ecc..27a356c655 100644
--- a/gtk/gtkapplication-dbus.c
+++ b/gtk/gtkapplication-dbus.c
@@ -191,6 +191,13 @@ screensaver_signal_session (GDBusProxy *proxy,
gtk_application_set_screensaver_active (application, active);
}
+enum {
+ UNKNOWN = 0,
+ RUNNING = 1,
+ QUERY_END = 2,
+ ENDING = 3
+};
+
static void
screensaver_signal_portal (GDBusConnection *connection,
const char *sender_name,
@@ -200,9 +207,10 @@ screensaver_signal_portal (GDBusConnection *connection,
GVariant *parameters,
gpointer data)
{
- GtkApplication *application = data;
+ GtkApplication *application = data;
gboolean active;
GVariant *state;
+ guint32 session_state;
if (!g_str_equal (signal_name, "StateChanged"))
return;
@@ -210,6 +218,10 @@ screensaver_signal_portal (GDBusConnection *connection,
g_variant_get (parameters, "(o@a{sv})", NULL, &state);
g_variant_lookup (state, "screensaver-active", "b", &active);
gtk_application_set_screensaver_active (application, active);
+
+ g_variant_lookup (state, "session-state", "u", &session_state);
+ if (session_state == ENDING)
+ g_application_quit (G_APPLICATION (application));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]