summaryrefslogtreecommitdiff
path: root/src/logind-seat-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-21 20:43:34 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-21 20:43:34 +0200
commitda11939561b1e6eeb1131b68dbf43042fd633a05 (patch)
tree56b654d78e646a0de6a0db4656da9b758e49258c /src/logind-seat-dbus.c
parente1c9c2d53606f987110b4215cf08c236af637ff1 (diff)
logind: send dbus signals when sessions/users/seats come and go
Diffstat (limited to 'src/logind-seat-dbus.c')
-rw-r--r--src/logind-seat-dbus.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/logind-seat-dbus.c b/src/logind-seat-dbus.c
index 32171ce401..33eafe5ee5 100644
--- a/src/logind-seat-dbus.c
+++ b/src/logind-seat-dbus.c
@@ -333,3 +333,40 @@ char *seat_bus_path(Seat *s) {
return r;
}
+
+int seat_send_signal(Seat *s, bool new_seat) {
+ DBusMessage *m;
+ int r = -ENOMEM;
+ char *p = NULL;
+
+ assert(s);
+
+ m = dbus_message_new_signal("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ new_seat ? "SeatNew" : "SeatRemoved");
+
+ if (!m)
+ return -ENOMEM;
+
+ p = seat_bus_path(s);
+ if (!p)
+ goto finish;
+
+ if (!dbus_message_append_args(
+ m,
+ DBUS_TYPE_STRING, &s->id,
+ DBUS_TYPE_OBJECT_PATH, &p,
+ DBUS_TYPE_INVALID))
+ goto finish;
+
+ if (!dbus_connection_send(s->manager->bus, m, NULL))
+ goto finish;
+
+ r = 0;
+
+finish:
+ dbus_message_unref(m);
+ free(p);
+
+ return r;
+}