chiark / gitweb /
random-seed: fix error message typo
[elogind.git] / src / login / logind-device.c
index bbd370fbff75dc9721e6dc5bdae57795bbcb1a41..51b15358baa07684819d7c6717e46454ed1bd266 100644 (file)
@@ -6,16 +6,16 @@
   Copyright 2011 Lennart Poettering
 
   systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
   systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
 
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
@@ -65,22 +65,32 @@ void device_free(Device *d) {
 }
 
 void device_detach(Device *d) {
+        Seat *s;
         assert(d);
 
-        if (d->seat)
-                LIST_REMOVE(Device, devices, d->seat->devices, d);
+        if (!d->seat)
+                return;
 
-        seat_add_to_gc_queue(d->seat);
+        s = d->seat;
+        LIST_REMOVE(Device, devices, d->seat->devices, d);
         d->seat = NULL;
+
+        seat_add_to_gc_queue(s);
+        seat_send_changed(s, "CanGraphical\0");
 }
 
 void device_attach(Device *d, Seat *s) {
         assert(d);
         assert(s);
 
+        if (d->seat == s)
+                return;
+
         if (d->seat)
                 device_detach(d);
 
         d->seat = s;
         LIST_PREPEND(Device, devices, s->devices, d);
+
+        seat_send_changed(s, "CanGraphical\0");
 }