summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-27 17:15:29 +0200
committerThomas Haller <thaller@redhat.com>2016-04-28 13:00:12 +0200
commit400e9fc9fb0febae9b5ebc5e59d1d695cfe9faf9 (patch)
tree18351b715330bddee6ea868c86ac69685e2961d7 /src
parent6864a7036f6ea8aa441e411b57962e9b5829a150 (diff)
downloadNetworkManager-400e9fc9fb0febae9b5ebc5e59d1d695cfe9faf9.tar.gz
sleep-monitor: use defines for D-Bus paths for upower's sleep-monitor
Diffstat (limited to 'src')
-rw-r--r--src/nm-sleep-monitor.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/nm-sleep-monitor.c b/src/nm-sleep-monitor.c
index b3fc0ac9fd..d9551a7bce 100644
--- a/src/nm-sleep-monitor.c
+++ b/src/nm-sleep-monitor.c
@@ -29,19 +29,20 @@
#include "nm-sleep-monitor.h"
-#if (defined (SUSPEND_RESUME_SYSTEMD) + defined (SUSPEND_RESUME_CONSOLEKIT) + defined (SUSPEND_RESUME_UPOWER)) != 1
-#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
-#endif
-#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower"
+#if defined (SUSPEND_RESUME_UPOWER)
-#ifdef SUSPEND_RESUME_SYSTEMD
+#define SUSPEND_DBUS_NAME "org.freedesktop.UPower"
+#define SUSPEND_DBUS_PATH "/org/freedesktop/UPower"
+#define SUSPEND_DBUS_INTERFACE "org.freedesktop.UPower"
+
+#elif defined (SUSPEND_RESUME_SYSTEMD)
#define SUSPEND_DBUS_NAME "org.freedesktop.login1"
#define SUSPEND_DBUS_PATH "/org/freedesktop/login1"
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
-#else
+#elif defined(SUSPEND_RESUME_CONSOLEKIT)
/* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd
* uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit
@@ -51,6 +52,10 @@
#define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager"
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager"
+#else
+
+#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
+
#endif
struct _NMSleepMonitor {
@@ -280,9 +285,9 @@ nm_sleep_monitor_init (NMSleepMonitor *self)
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
| G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL,
- UPOWER_DBUS_SERVICE,
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower",
+ SUSPEND_DBUS_NAME,
+ SUSPEND_DBUS_PATH,
+ SUSPEND_DBUS_INTERFACE,
NULL, &error);
if (self->proxy) {
_nm_dbus_signal_connect (self->proxy, "Sleeping", NULL,