[gnome-flashback] session: don't call Setenv method in Running phase
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] session: don't call Setenv method in Running phase
- Date: Sat, 17 Aug 2019 12:28:08 +0000 (UTC)
commit f12025c94701176c73f7b95ccf2fdc4ad6223b20
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Aug 17 15:25:34 2019 +0300
session: don't call Setenv method in Running phase
gnome-flashback/gf-session.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
---
diff --git a/gnome-flashback/gf-session.c b/gnome-flashback/gf-session.c
index 9925750..6a505ab 100644
--- a/gnome-flashback/gf-session.c
+++ b/gnome-flashback/gf-session.c
@@ -47,6 +47,34 @@ struct _GfSession
G_DEFINE_TYPE (GfSession, gf_session, G_TYPE_OBJECT)
+static gboolean
+is_session_running (GfSession *self)
+{
+ GError *error;
+ GVariant *variant;
+ gboolean is_session_running;
+
+ error = NULL;
+ variant = g_dbus_proxy_call_sync (self->manager_proxy,
+ "IsSessionRunning", NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ if (error != NULL)
+ {
+ g_warning ("Failed to check if the session has entered the Running phase: %s",
+ error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ g_variant_get_child (variant, 0, "b", &is_session_running, NULL);
+ g_variant_unref (variant);
+
+ return is_session_running;
+}
+
static void
respond_to_end_session (GDBusProxy *proxy)
{
@@ -258,7 +286,8 @@ gf_session_new (gboolean replace,
* @value: the value
*
* Set environment variable to specified value. May only be used during the
- * Session Manager initialization phase.
+ * Session Manager Initialization phase. If session has entered Running phase
+ * this function does nothing.
*/
void
gf_session_set_environment (GfSession *session,
@@ -269,6 +298,9 @@ gf_session_set_environment (GfSession *session,
GError *error;
GVariant *variant;
+ if (is_session_running (session))
+ return;
+
parameters = g_variant_new ("(ss)", name, value);
error = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]