summaryrefslogtreecommitdiff
path: root/src/login/logind-button.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-10-28 00:49:04 +0200
committerLennart Poettering <lennart@poettering.net>2012-10-28 00:50:35 +0200
commit6524990fdc98370ecba5d9f73e67161e8798c010 (patch)
tree870ed57ed3c756dd34a0223692d1ec5b9e5ef44d /src/login/logind-button.c
parent2001208c2ab631a69896d1f670c26846b70d1fb7 (diff)
logind: support for hybrid sleep (i.e. suspend+hibernate at the same time)
Diffstat (limited to 'src/login/logind-button.c')
-rw-r--r--src/login/logind-button.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 8fdab789bc..753d95454c 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -163,16 +163,18 @@ static int button_handle(
[HANDLE_HALT] = "Halting...",
[HANDLE_KEXEC] = "Rebooting via kexec...",
[HANDLE_SUSPEND] = "Suspending...",
- [HANDLE_HIBERNATE] = "Hibernating..."
+ [HANDLE_HIBERNATE] = "Hibernating...",
+ [HANDLE_HYBRID_SLEEP] = "Hibernating and suspend...",
};
static const char * const target_table[_HANDLE_BUTTON_MAX] = {
- [HANDLE_POWEROFF] = "poweroff.target",
- [HANDLE_REBOOT] = "reboot.target",
- [HANDLE_HALT] = "halt.target",
- [HANDLE_KEXEC] = "kexec.target",
- [HANDLE_SUSPEND] = "suspend.target",
- [HANDLE_HIBERNATE] = "hibernate.target"
+ [HANDLE_POWEROFF] = SPECIAL_POWEROFF_TARGET,
+ [HANDLE_REBOOT] = SPECIAL_REBOOT_TARGET,
+ [HANDLE_HALT] = SPECIAL_HALT_TARGET,
+ [HANDLE_KEXEC] = SPECIAL_KEXEC_TARGET,
+ [HANDLE_SUSPEND] = SPECIAL_SUSPEND_TARGET,
+ [HANDLE_HIBERNATE] = SPECIAL_HIBERNATE_TARGET,
+ [HANDLE_HYBRID_SLEEP] = SPECIAL_HYBRID_SLEEP_TARGET
};
DBusError error;
@@ -193,7 +195,7 @@ static int button_handle(
return 0;
}
- inhibit_operation = handle == HANDLE_SUSPEND || handle == HANDLE_HIBERNATE ? INHIBIT_SLEEP : INHIBIT_SHUTDOWN;
+ inhibit_operation = handle == HANDLE_SUSPEND || handle == HANDLE_HIBERNATE || handle == HANDLE_HYBRID_SLEEP ? INHIBIT_SLEEP : INHIBIT_SHUTDOWN;
/* If the actual operation is inhibited, warn and fail */
if (!ignore_inhibited &&
@@ -305,7 +307,8 @@ static const char* const handle_button_table[_HANDLE_BUTTON_MAX] = {
[HANDLE_HALT] = "halt",
[HANDLE_KEXEC] = "kexec",
[HANDLE_SUSPEND] = "suspend",
- [HANDLE_HIBERNATE] = "hibernate"
+ [HANDLE_HIBERNATE] = "hibernate",
+ [HANDLE_HYBRID_SLEEP] = "hybrid-sleep",
};
DEFINE_STRING_TABLE_LOOKUP(handle_button, HandleButton);
DEFINE_CONFIG_PARSE_ENUM(config_parse_handle_button, handle_button, HandleButton, "Failed to parse handle button setting");