summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-07-10 12:20:16 -0700
committerStefano Karapetsas <[email protected]>2013-07-10 12:20:16 -0700
commitdba25d0e45128b297b76c33e78f3e4615171da5f (patch)
tree9b065f2d8ffcf05850369d02bc95f3b61f6a00a1
parentda13489e6b1f6f015a684c9b2c0d30297485952a (diff)
parent1bfa3e834d64e35b98474b75702487908684321b (diff)
downloadmate-session-manager-dba25d0e45128b297b76c33e78f3e4615171da5f.tar.bz2
mate-session-manager-dba25d0e45128b297b76c33e78f3e4615171da5f.tar.xz
Merge pull request #28 from lxnay/master
Use LOGIND_RUNNING() macro instead of sd_booted(), drop libsystemd-daemon dependency
-rw-r--r--configure.ac2
-rw-r--r--mate-session/gsm-logout-dialog.c11
-rw-r--r--mate-session/gsm-manager.c15
-rw-r--r--mate-session/gsm-systemd.h3
-rw-r--r--mate-session/main.c3
5 files changed, 17 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index 1a98252..dab65c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,7 @@ AC_ARG_WITH(systemd,
use_systemd=no
if test "x$with_systemd" != "xno" ; then
- PKG_CHECK_MODULES(SYSTEMD, libsystemd-login libsystemd-daemon, use_systemd=yes, use_systemd=no)
+ PKG_CHECK_MODULES(SYSTEMD, libsystemd-login, use_systemd=yes, use_systemd=no)
if test "x$use_systemd" = "xyes"; then
AC_DEFINE(HAVE_SYSTEMD, 1, [systemd support])
diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c
index ba28105..2d2947c 100644
--- a/mate-session/gsm-logout-dialog.c
+++ b/mate-session/gsm-logout-dialog.c
@@ -32,7 +32,6 @@
#include "gsm-logout-dialog.h"
#ifdef HAVE_SYSTEMD
#include "gsm-systemd.h"
-#include <systemd/sd-daemon.h>
#endif
#include "gsm-consolekit.h"
#include "mdm.h"
@@ -152,7 +151,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 +215,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 +230,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 +248,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 +318,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..1e393ac 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -62,7 +62,6 @@
#include "gsm-consolekit.h"
#ifdef HAVE_SYSTEMD
#include "gsm-systemd.h"
-#include <systemd/sd-daemon.h>
#endif
#include "gsm-session-save.h"
@@ -448,7 +447,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 +476,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 +1929,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 +2457,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 +2743,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 +2855,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 +3201,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..6fa03b0 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -45,7 +45,6 @@
#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"
@@ -293,7 +292,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;