logind: add PreparingForShutdown/PreparingForSleep properties
This commit is contained in:
parent
9d074e618d
commit
5e4a79da3a
4
TODO
4
TODO
|
@ -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
|
||||
|
||||
|
|
|
@ -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, }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue