summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-06-16 11:02:40 +0200
committerDaniel Mack <github@zonque.org>2015-06-16 11:02:40 +0200
commit1a770c60ee6a15ec5bd1f8db7cc0ffaebf4bcedc (patch)
tree660bf67a597c3c5e30b7904eabe6904dc302f651 /src
parent4fba57963b8c83085c58d59c1bfc03633df22bae (diff)
parent148560792af3275a2bd3765659296985577e564e (diff)
Merge pull request #219 from poettering/logind-docked
logind: expose "Docked" bool as property on the bus
Diffstat (limited to 'src')
-rw-r--r--src/login/logind-dbus.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index b272401e5b..2766505e86 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -243,6 +243,24 @@ static int property_get_scheduled_shutdown(
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_handle_action, handle_action, HandleAction);
+static int property_get_docked(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ Manager *m = userdata;
+
+ assert(bus);
+ assert(reply);
+ assert(m);
+
+ return sd_bus_message_append(reply, "b", manager_is_docked_or_multiple_displays(m));
+}
+
static int method_get_session(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
@@ -2406,6 +2424,7 @@ const sd_bus_vtable manager_vtable[] = {
SD_BUS_PROPERTY("PreparingForShutdown", "b", property_get_preparing, 0, 0),
SD_BUS_PROPERTY("PreparingForSleep", "b", property_get_preparing, 0, 0),
SD_BUS_PROPERTY("ScheduledShutdown", "(st)", property_get_scheduled_shutdown, 0, 0),
+ SD_BUS_PROPERTY("Docked", "b", property_get_docked, 0, 0),
SD_BUS_METHOD("GetSession", "s", "o", method_get_session, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("GetSessionByPID", "u", "o", method_get_session_by_pid, SD_BUS_VTABLE_UNPRIVILEGED),