summaryrefslogtreecommitdiff
path: root/mate-session
diff options
context:
space:
mode:
Diffstat (limited to 'mate-session')
-rw-r--r--mate-session/gsm-manager.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index 3ffcbf3..f9bdda0 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -889,6 +889,51 @@ _client_stop (const char *id,
return FALSE;
}
+#ifdef HAVE_SYSTEMD
+static void
+maybe_restart_user_bus (GsmManager *manager)
+{
+ GsmSystemd *systemd;
+ GsmManagerPrivate *priv;
+ GDBusConnection *connection;
+
+ g_autoptr(GVariant) reply = NULL;
+ g_autoptr(GError) error = NULL;
+
+ priv = gsm_manager_get_instance_private (manager);
+ if (priv->dbus_disconnected)
+ return;
+
+ systemd = gsm_get_systemd ();
+
+ if (!gsm_systemd_is_last_session_for_user (systemd))
+ return;
+
+ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+
+ if (error != NULL) {
+ g_debug ("GsmManager: failed to connect to session bus: %s", error->message);
+ return;
+ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "TryRestartUnit",
+ g_variant_new ("(ss)", "dbus.service", "replace"),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_debug ("GsmManager: reloading user bus failed: %s", error->message);
+ }
+}
+#endif
+
static void
do_phase_exit (GsmManager *manager)
{
@@ -901,6 +946,10 @@ do_phase_exit (GsmManager *manager)
NULL);
}
+#ifdef HAVE_SYSTEMD
+ maybe_restart_user_bus (manager);
+#endif
+
end_phase (manager);
}