summaryrefslogtreecommitdiff
path: root/mate-session/main.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-03-05 20:39:33 +0100
committerStefano Karapetsas <[email protected]>2013-03-05 20:39:33 +0100
commit31fdf9eb550e0f2e69fa1ba96a1d7d78b8d2e060 (patch)
tree832bb7dcfcbdbba34eaf2b66cbbb659a7c692c93 /mate-session/main.c
parent29e5cd2f28f6ddc253d393064c0b24130af0ee35 (diff)
downloadmate-session-manager-31fdf9eb550e0f2e69fa1ba96a1d7d78b8d2e060.tar.bz2
mate-session-manager-31fdf9eb550e0f2e69fa1ba96a1d7d78b8d2e060.tar.xz
Add initial systemd support
Diffstat (limited to 'mate-session/main.c')
-rw-r--r--mate-session/main.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/mate-session/main.c b/mate-session/main.c
index 0a6259c..da2a687 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -42,6 +42,10 @@
#include "mdm-log.h"
#include "gsm-consolekit.h"
+#ifdef HAVE_SYSTEMD
+#include "gsm-systemd.h"
+#include <systemd/sd-daemon.h>
+#endif
#include "gsm-util.h"
#include "gsm-manager.h"
#include "gsm-xsmp-server.h"
@@ -259,26 +263,47 @@ static void append_required_apps(GsmManager* manager)
static void maybe_load_saved_session_apps(GsmManager* manager)
{
- GsmConsolekit* consolekit;
+ GsmConsolekit* consolekit = NULL;
+#ifdef HAVE_SYSTEMD
+ GsmSystemd* systemd = NULL;
+#endif
char* session_type;
+ gboolean is_login;
+#ifdef HAVE_SYSTEMD
+ if (sd_booted() > 0) {
+ systemd = gsm_get_systemd();
+ session_type = gsm_systemd_get_current_session_type(systemd);
+ is_login = g_strcmp0 (session_type, GSM_SYSTEMD_SESSION_TYPE_LOGIN_WINDOW) == 0;
+ }
+ else {
+#endif
consolekit = gsm_get_consolekit();
session_type = gsm_consolekit_get_current_session_type(consolekit);
+ is_login = g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) == 0;
+#ifdef HAVE_SYSTEMD
+ }
+#endif
- if (g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) != 0)
+ if (!is_login)
{
- GSettings* settings;
- gboolean autostart;
+ GSettings* settings;
+ gboolean autostart;
settings = g_settings_new (GSM_SCHEMA);
- autostart = g_settings_get_boolean (settings, KEY_AUTOSAVE);
- g_object_unref (settings);
+ autostart = g_settings_get_boolean (settings, KEY_AUTOSAVE);
+ g_object_unref (settings);
- if (autostart == TRUE)
+ if (autostart == TRUE)
gsm_manager_add_autostart_apps_from_dir(manager, gsm_util_get_saved_session_dir());
}
- g_object_unref(consolekit);
+ if (consolekit != NULL)
+ g_object_unref(consolekit);
+#ifdef HAVE_SYSTEMD
+ if (systemd != NULL)
+ g_object_unref(systemd);
+#endif
g_free(session_type);
}