mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 06:08:02 +02:00
sleep-monitor: cleanup #if usage by using USE_UPOWER in "nm-sleep-monitor.c"
(cherry picked from commit 2b087b4782)
This commit is contained in:
parent
1242147efa
commit
90733d970d
1 changed files with 10 additions and 10 deletions
|
|
@ -35,12 +35,16 @@
|
||||||
#define SUSPEND_DBUS_NAME "org.freedesktop.UPower"
|
#define SUSPEND_DBUS_NAME "org.freedesktop.UPower"
|
||||||
#define SUSPEND_DBUS_PATH "/org/freedesktop/UPower"
|
#define SUSPEND_DBUS_PATH "/org/freedesktop/UPower"
|
||||||
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.UPower"
|
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.UPower"
|
||||||
|
#define USE_UPOWER 1
|
||||||
|
#define _NMLOG_PREFIX_NAME "sleep-monitor-up"
|
||||||
|
|
||||||
#elif defined (SUSPEND_RESUME_SYSTEMD)
|
#elif defined (SUSPEND_RESUME_SYSTEMD)
|
||||||
|
|
||||||
#define SUSPEND_DBUS_NAME "org.freedesktop.login1"
|
#define SUSPEND_DBUS_NAME "org.freedesktop.login1"
|
||||||
#define SUSPEND_DBUS_PATH "/org/freedesktop/login1"
|
#define SUSPEND_DBUS_PATH "/org/freedesktop/login1"
|
||||||
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
|
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
|
||||||
|
#define USE_UPOWER 0
|
||||||
|
#define _NMLOG_PREFIX_NAME "sleep-monitor-sd"
|
||||||
|
|
||||||
#elif defined(SUSPEND_RESUME_CONSOLEKIT)
|
#elif defined(SUSPEND_RESUME_CONSOLEKIT)
|
||||||
|
|
||||||
|
|
@ -51,6 +55,8 @@
|
||||||
#define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit"
|
#define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit"
|
||||||
#define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager"
|
#define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager"
|
||||||
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager"
|
#define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager"
|
||||||
|
#define USE_UPOWER 0
|
||||||
|
#define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
@ -89,12 +95,6 @@ NM_DEFINE_SINGLETON_GETTER (NMSleepMonitor, nm_sleep_monitor_get, NM_TYPE_SLEEP_
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifdef SUSPEND_RESUME_SYSTEMD
|
|
||||||
#define _NMLOG_PREFIX_NAME "sleep-monitor-sd"
|
|
||||||
#else
|
|
||||||
#define _NMLOG_PREFIX_NAME "sleep-monitor-ck"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _NMLOG_DOMAIN LOGD_SUSPEND
|
#define _NMLOG_DOMAIN LOGD_SUSPEND
|
||||||
#define _NMLOG(level, ...) \
|
#define _NMLOG(level, ...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
|
|
@ -116,7 +116,7 @@ NM_DEFINE_SINGLETON_GETTER (NMSleepMonitor, nm_sleep_monitor_get, NM_TYPE_SLEEP_
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#if defined (SUSPEND_RESUME_UPOWER)
|
#if USE_UPOWER
|
||||||
|
|
||||||
static void
|
static void
|
||||||
upower_sleeping_cb (GDBusProxy *proxy, gpointer user_data)
|
upower_sleeping_cb (GDBusProxy *proxy, gpointer user_data)
|
||||||
|
|
@ -275,12 +275,12 @@ on_proxy_acquired (GObject *object,
|
||||||
static void
|
static void
|
||||||
nm_sleep_monitor_init (NMSleepMonitor *self)
|
nm_sleep_monitor_init (NMSleepMonitor *self)
|
||||||
{
|
{
|
||||||
#if defined (SUSPEND_RESUME_UPOWER)
|
#if USE_UPOWER
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
self->inhibit_fd = -1;
|
self->inhibit_fd = -1;
|
||||||
#if defined (SUSPEND_RESUME_UPOWER)
|
#if USE_UPOWER
|
||||||
self->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
self->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||||
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
|
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
|
||||||
| G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
|
| G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
|
||||||
|
|
@ -315,7 +315,7 @@ dispose (GObject *object)
|
||||||
{
|
{
|
||||||
NMSleepMonitor *self = NM_SLEEP_MONITOR (object);
|
NMSleepMonitor *self = NM_SLEEP_MONITOR (object);
|
||||||
|
|
||||||
#if ! defined (SUSPEND_RESUME_UPOWER)
|
#if !USE_UPOWER
|
||||||
drop_inhibitor (self);
|
drop_inhibitor (self);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue