chiark / gitweb /
logind: call udev_device_get_is_initialized() to trigger lazy loading, as a temporary...
[elogind.git] / src / logind-session-dbus.c
index 0ce880c590b80f9323a404d33fa753af762b04b7..2435a6512b79f3a422931cd9d92711189c09f517 100644 (file)
@@ -49,6 +49,7 @@
         "  <property name=\"Remote\" type=\"b\" access=\"read\"/>\n"    \
         "  <property name=\"RemoteHost\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"RemoteUser\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"Service\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"Leader\" type=\"u\" access=\"read\"/>\n"    \
         "  <property name=\"Audit\" type=\"u\" access=\"read\"/>\n"     \
         "  <property name=\"Type\" type=\"s\" access=\"read\"/>\n"      \
@@ -144,7 +145,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 +160,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;
 
@@ -236,6 +237,7 @@ static DBusHandlerResult session_message_dispatch(
                 { "org.freedesktop.login1.Session", "Remote",             bus_property_append_bool,     "b",    &s->remote              },
                 { "org.freedesktop.login1.Session", "RemoteUser",         bus_property_append_string,   "s",    s->remote_user          },
                 { "org.freedesktop.login1.Session", "RemoteHost",         bus_property_append_string,   "s",    s->remote_host          },
+                { "org.freedesktop.login1.Session", "Service",            bus_property_append_string,   "s",    s->service              },
                 { "org.freedesktop.login1.Session", "Leader",             bus_property_append_pid,      "u",    &s->leader              },
                 { "org.freedesktop.login1.Session", "Audit",              bus_property_append_uint32,   "u",    &s->audit_id            },
                 { "org.freedesktop.login1.Session", "Type",               bus_session_append_type,      "s",    &s->type                },
@@ -427,6 +429,9 @@ int session_send_changed(Session *s, const char *properties) {
 
         assert(s);
 
+        if (!s->started)
+                return 0;
+
         p = session_bus_path(s);
         if (!p)
                 return -ENOMEM;