summaryrefslogtreecommitdiff
path: root/mate-session
diff options
context:
space:
mode:
Diffstat (limited to 'mate-session')
-rw-r--r--mate-session/gsm-logout-dialog.c10
-rw-r--r--mate-session/gsm-manager.c14
-rw-r--r--mate-session/gsm-systemd.h3
-rw-r--r--mate-session/main.c2
4 files changed, 16 insertions, 13 deletions
diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c
index ba28105..a98ffa9 100644
--- a/mate-session/gsm-logout-dialog.c
+++ b/mate-session/gsm-logout-dialog.c
@@ -152,7 +152,7 @@ gsm_logout_dialog_init (GsmLogoutDialog *logout_dialog)
logout_dialog->priv->up_client = up_client_new ();
#ifdef HAVE_SYSTEMD
- if (sd_booted() > 0)
+ if (LOGIND_RUNNING())
logout_dialog->priv->systemd = gsm_get_systemd ();
else
#endif
@@ -216,7 +216,7 @@ gsm_logout_supports_switch_user (GsmLogoutDialog *logout_dialog)
gboolean ret;
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0)
+ if (LOGIND_RUNNING())
ret = gsm_systemd_can_switch_user (logout_dialog->priv->systemd);
else
#endif
@@ -231,7 +231,7 @@ gsm_logout_supports_reboot (GsmLogoutDialog *logout_dialog)
gboolean ret;
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0)
+ if (LOGIND_RUNNING())
ret = gsm_systemd_can_restart (logout_dialog->priv->systemd);
else
#endif
@@ -249,7 +249,7 @@ gsm_logout_supports_shutdown (GsmLogoutDialog *logout_dialog)
gboolean ret;
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0)
+ if (LOGIND_RUNNING())
ret = gsm_systemd_can_stop (logout_dialog->priv->systemd);
else
#endif
@@ -319,7 +319,7 @@ gsm_logout_dialog_timeout (gpointer data)
if (session_type == NULL) {
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
GsmSystemd *systemd;
systemd = gsm_get_systemd ();
session_type = gsm_systemd_get_current_session_type (systemd);
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index d765322..59b71e4 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -448,7 +448,7 @@ gsm_manager_quit (GsmManager *manager)
mdm_set_logout_action (MDM_LOGOUT_ACTION_NONE);
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
g_signal_connect (systemd,
"request-completed",
@@ -477,7 +477,7 @@ gsm_manager_quit (GsmManager *manager)
mdm_set_logout_action (MDM_LOGOUT_ACTION_NONE);
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
g_signal_connect (systemd,
"request-completed",
@@ -1930,7 +1930,7 @@ maybe_save_session (GsmManager *manager)
GError *error;
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
session_type = gsm_systemd_get_current_session_type (systemd);
@@ -2458,7 +2458,7 @@ on_presence_status_changed (GsmPresence *presence,
GsmManager *manager)
{
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
GsmSystemd *systemd;
systemd = gsm_get_systemd ();
@@ -2744,7 +2744,7 @@ request_reboot (GsmManager *manager)
*/
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
g_signal_connect (systemd,
"privileges-completed",
@@ -2856,7 +2856,7 @@ request_shutdown (GsmManager *manager)
* this works. */
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
g_signal_connect (systemd,
"privileges-completed",
@@ -3202,7 +3202,7 @@ gsm_manager_can_shutdown (GsmManager *manager,
g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
#ifdef HAVE_SYSTEMD
- if (sd_booted () > 0) {
+ if (LOGIND_RUNNING()) {
systemd = gsm_get_systemd ();
*shutdown_available = gsm_systemd_can_stop (systemd)
|| gsm_systemd_can_restart (systemd)
diff --git a/mate-session/gsm-systemd.h b/mate-session/gsm-systemd.h
index ad38ac7..8e886ba 100644
--- a/mate-session/gsm-systemd.h
+++ b/mate-session/gsm-systemd.h
@@ -23,6 +23,7 @@
#ifndef __GSM_SYSTEMD_H__
#define __GSM_SYSTEMD_H__
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
@@ -38,6 +39,8 @@ extern "C" {
#define GSM_SYSTEMD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSM_TYPE_SYSTEMD, GsmSystemdClass))
#define GSM_SYSTEMD_ERROR (gsm_systemd_error_quark ())
+#define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0)
+
typedef struct _GsmSystemd GsmSystemd;
typedef struct _GsmSystemdClass GsmSystemdClass;
typedef struct _GsmSystemdPrivate GsmSystemdPrivate;
diff --git a/mate-session/main.c b/mate-session/main.c
index 4dd8fd1..9bd8219 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -293,7 +293,7 @@ static void maybe_load_saved_session_apps(GsmManager* manager)
gboolean is_login;
#ifdef HAVE_SYSTEMD
- if (sd_booted() > 0) {
+ if (LOGIND_RUNNING()) {
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;