chiark / gitweb /
logind: ignore lid switch events for 30s after each suspend and 3min after startup
[elogind.git] / src / login / logind-session-dbus.c
index f1905e93f36ba938f07f06f1729f675342827119..f9305ddbee63c04147b98711e97eb6157d04ab7b 100644 (file)
@@ -188,7 +188,7 @@ static int method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata
         assert(message);
         assert(s);
 
-        r = session_stop(s);
+        r = session_stop(s, true);
         if (r < 0)
                 return r;
 
@@ -444,6 +444,7 @@ const sd_bus_vtable session_vtable[] = {
         SD_BUS_PROPERTY("RemoteHost", "s", NULL, offsetof(Session, remote_host), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("RemoteUser", "s", NULL, offsetof(Session, remote_user), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("Service", "s", NULL, offsetof(Session, service), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("Desktop", "s", NULL, offsetof(Session, desktop), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("Scope", "s", NULL, offsetof(Session, scope), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("Leader", "u", bus_property_get_pid, offsetof(Session, leader), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("Audit", "u", NULL, offsetof(Session, audit_id), SD_BUS_VTABLE_PROPERTY_CONST),
@@ -647,13 +648,16 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
 
         assert(s);
 
-        /* This is called after the session scope was successfully
-         * created, and finishes where bus_manager_create_session()
-         * left off. */
+        /* This is called after the session scope and the user service
+         * were successfully created, and finishes where
+         * bus_manager_create_session() left off. */
 
         if (!s->create_message)
                 return 0;
 
+        if (!sd_bus_error_is_set(error) && (s->scope_job || s->user->service_job))
+                return 0;
+
         c = s->create_message;
         s->create_message = NULL;