summaryrefslogtreecommitdiff
path: root/rcm-server-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-server-main.c')
-rw-r--r--rcm-server-main.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/rcm-server-main.c b/rcm-server-main.c
index 28a1ff0..f44c0ac 100644
--- a/rcm-server-main.c
+++ b/rcm-server-main.c
@@ -656,52 +656,6 @@ static const sd_bus_vtable device_vtable[] = {
SD_BUS_VTABLE_END
};
-static int
-my_bus_emit_object_changed(sd_bus *bus, const char *path, bool added)
-{
- int r;
- _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
-
- printf("Sending signal %s for path %s\n",
- added ? "InterfacesAdded" : "InterfacesRemoved",
- path);
-
- r = sd_bus_message_new_signal(bus, &m, "/org/gnome/RemoteControlManager",
- "org.freedesktop.DBus.ObjectManager",
- added ? "InterfacesAdded" : "InterfacesRemoved");
- if (r < 0)
- return r;
-
- r = sd_bus_message_append_basic(m, 'o', path);
- if (r < 0)
- return r;
-
- if (added) {
- r = sd_bus_message_open_container(m, 'a', "{sa{sv}}");
- if (r < 0)
- return r;
-
- r = sd_bus_message_append(m, "{sa{sv}}", "org.gnome.RemoteControlManager.Device", 0);
- if (r < 0)
- return r;
- } else {
- r = sd_bus_message_open_container(m, 'a', "s");
- if (r < 0)
- return r;
-
- r = sd_bus_message_append(m, "s", "org.gnome.RemoteControlManager.Device");
- if (r < 0)
- return r;
- }
-
- r = sd_bus_message_close_container(m);
- if (r < 0)
- return r;
-
- r = sd_bus_send(bus, m, NULL);
- return r;
-}
-
static void
remove_device(struct manager *mgr, struct udev_device *udev)
{
@@ -715,7 +669,7 @@ remove_device(struct manager *mgr, struct udev_device *udev)
if (strcmp(device->name, name))
continue;
list_del(&device->list);
- my_bus_emit_object_changed(mgr->bus, device->path, false);
+ sd_bus_emit_object_removed(mgr->bus, device->path);
mgr->num_devices--;
break;
}
@@ -957,7 +911,7 @@ add_device(struct manager *mgr, struct udev_device *udev)
list_add(&device->list, &mgr->devices);
mgr->num_devices++;
- my_bus_emit_object_changed(mgr->bus, path, true);
+ sd_bus_emit_object_added(mgr->bus, path);
}
static int