summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-29 19:38:35 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-29 19:38:35 +0200
commit5e4a79da3ac3859c2a1295e019b95a1e5589b9c1 (patch)
tree359297a3c30ed5cc2630436c2a12abf80978e76a /src/login
parent9d074e618db1d5cbfad24419dc678c4f23fc0410 (diff)
logind: add PreparingForShutdown/PreparingForSleep properties
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-dbus.c20
1 files changed, 20 insertions, 0 deletions
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, }
};