diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 20 |
2 files changed, 21 insertions, 3 deletions
@@ -36,9 +36,7 @@ Features: - Update Syslog Interface docs - Journal C API manual pages -* logind: export a bool property that tells user whether a - suspend/shutdown is currently scheduled, i.e. where are between - PrepareForSuspend(true) and PrepareForSuspend(false) +* wiki: document logind's PreparingForShutdown, PreparingForSleep * support debian's console-setup logic diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 3cde83166f..a2ead8609b 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -209,6 +209,8 @@ " <property name=\"HandlePowerKey\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"HandleSleepKey\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"HandleLidSwitch\" type=\"s\" access=\"read\"/>\n" \ + " <property name=\"PreparingForShutdown\" type=\"b\" access=\"read\"/>\n" \ + " <property name=\"PreparingForSleep\" type=\"b\" access=\"read\"/>\n" \ " </interface>\n" #define INTROSPECTION_BEGIN \ @@ -273,6 +275,22 @@ static int bus_manager_append_inhibited(DBusMessageIter *i, const char *property return 0; } +static int bus_manager_append_preparing(DBusMessageIter *i, const char *property, void *data) { + Manager *m = data; + dbus_bool_t b; + + assert(i); + assert(property); + + if (streq(property, "PreparingForShutdown")) + b = !!(m->delayed_what & INHIBIT_SHUTDOWN); + else + b = !!(m->delayed_what & INHIBIT_SLEEP); + + dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b); + return 0; +} + static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMessage **_reply) { Session *session = NULL; User *user = NULL; @@ -1266,6 +1284,8 @@ static const BusProperty bus_login_manager_properties[] = { { "HandlePowerKey", bus_manager_append_handle_button, "s", offsetof(Manager, handle_power_key) }, { "HandleSleepKey", bus_manager_append_handle_button, "s", offsetof(Manager, handle_sleep_key) }, { "HandleLidSwitch", bus_manager_append_handle_button, "s", offsetof(Manager, handle_lid_switch) }, + { "PreparingForShutdown", bus_manager_append_preparing, "b", 0 }, + { "PreparingForSleep", bus_manager_append_preparing, "b", 0 }, { NULL, } }; |