From 77527da0a02029ce9c5ec86d5db5ea42147a658f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Jun 2011 22:29:25 +0200 Subject: [PATCH] logind: make idle hint logic work --- src/logind-dbus.c | 4 ++-- src/logind-seat-dbus.c | 4 ++-- src/logind-seat.c | 3 +-- src/logind-session-dbus.c | 6 +++--- src/logind-user-dbus.c | 5 +++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/logind-dbus.c b/src/logind-dbus.c index f73307f8..662ffd0b 100644 --- a/src/logind-dbus.c +++ b/src/logind-dbus.c @@ -130,13 +130,13 @@ static int bus_manager_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { Manager *m = data; - bool b; + dbus_bool_t b; assert(i); assert(property); assert(m); - b = manager_get_idle_hint(m, NULL); + b = manager_get_idle_hint(m, NULL) > 0; if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) return -ENOMEM; diff --git a/src/logind-seat-dbus.c b/src/logind-seat-dbus.c index 1895fe6c..4a4527d0 100644 --- a/src/logind-seat-dbus.c +++ b/src/logind-seat-dbus.c @@ -151,13 +151,13 @@ static int bus_seat_append_can_activate(DBusMessageIter *i, const char *property static int bus_seat_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { Seat *s = data; - bool b; + dbus_bool_t b; assert(i); assert(property); assert(s); - b = seat_get_idle_hint(s, NULL); + b = seat_get_idle_hint(s, NULL) > 0; if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) return -ENOMEM; diff --git a/src/logind-seat.c b/src/logind-seat.c index 09356b6b..12a1b806 100644 --- a/src/logind-seat.c +++ b/src/logind-seat.c @@ -230,8 +230,7 @@ int seat_set_active(Seat *s, Session *session) { Session *old_active; assert(s); - assert(session); - assert(session->seat == s); + assert(!session || session->seat == s); if (session == s->active) return 0; diff --git a/src/logind-session-dbus.c b/src/logind-session-dbus.c index 0ce880c5..b0e592d2 100644 --- a/src/logind-session-dbus.c +++ b/src/logind-session-dbus.c @@ -144,7 +144,7 @@ static int bus_session_append_user(DBusMessageIter *i, const char *property, voi static int bus_session_append_active(DBusMessageIter *i, const char *property, void *data) { Session *s = data; - bool b; + dbus_bool_t b; assert(i); assert(property); @@ -159,13 +159,13 @@ static int bus_session_append_active(DBusMessageIter *i, const char *property, v static int bus_session_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { Session *s = data; - bool b; + int b; assert(i); assert(property); assert(s); - b = session_get_idle_hint(s, NULL); + b = session_get_idle_hint(s, NULL) > 0; if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) return -ENOMEM; diff --git a/src/logind-user-dbus.c b/src/logind-user-dbus.c index 623f2c9c..5926dcfb 100644 --- a/src/logind-user-dbus.c +++ b/src/logind-user-dbus.c @@ -154,13 +154,14 @@ static int bus_user_append_sessions(DBusMessageIter *i, const char *property, vo static int bus_user_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { User *u = data; - bool b; + dbus_bool_t b; assert(i); assert(property); assert(u); - b = user_get_idle_hint(u, NULL); + b = user_get_idle_hint(u, NULL) > 0; + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) return -ENOMEM; -- 2.39.5