diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-22 03:22:34 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-22 03:50:52 +0100 |
commit | a03e4337fd2ae1cc90989e9b7b5f160b42cdb021 (patch) | |
tree | 0118c4bab19df5bd9287b4af8c4446bda736f0b3 /src/libsystemd-bus/test-bus-objects.c | |
parent | 556089dc57b10a12a03edd3d3e90ca17398ad206 (diff) |
bus: allow invocation of sd_bus_emit_properties_changed_strv() with NULL list
When NULL is passed this shall indicate that a PropertiesChanged message
for all properties marked as EMITS_CHANGE or EMITS_INVALIDATION should
be generated.
Diffstat (limited to 'src/libsystemd-bus/test-bus-objects.c')
-rw-r--r-- | src/libsystemd-bus/test-bus-objects.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libsystemd-bus/test-bus-objects.c b/src/libsystemd-bus/test-bus-objects.c index 0ab7a148d3..e2423c7f67 100644 --- a/src/libsystemd-bus/test-bus-objects.c +++ b/src/libsystemd-bus/test-bus-objects.c @@ -143,6 +143,17 @@ static int notify_test(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_er return 1; } +static int notify_test2(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { + int r; + + assert_se(sd_bus_emit_properties_changed_strv(bus, m->path, "org.freedesktop.systemd.ValueTest", NULL) >= 0); + + r = sd_bus_reply_method_return(m, NULL); + assert_se(r >= 0); + + return 1; +} + static int emit_interfaces_added(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) { int r; @@ -181,7 +192,11 @@ static const sd_bus_vtable vtable[] = { static const sd_bus_vtable vtable2[] = { SD_BUS_VTABLE_START(0), SD_BUS_METHOD("NotifyTest", "", "", notify_test, 0), + SD_BUS_METHOD("NotifyTest2", "", "", notify_test2, 0), SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Value2", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), + SD_BUS_PROPERTY("Value3", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("Value4", "s", value_handler, 10, 0), SD_BUS_VTABLE_END }; @@ -405,6 +420,18 @@ static int client(struct context *c) { sd_bus_message_unref(reply); reply = NULL; + r = sd_bus_call_method(bus, "org.freedesktop.systemd.test", "/value/a", "org.freedesktop.systemd.ValueTest", "NotifyTest2", &error, NULL, ""); + assert_se(r >= 0); + + r = sd_bus_process(bus, &reply); + assert_se(r > 0); + + assert_se(sd_bus_message_is_signal(reply, "org.freedesktop.DBus.Properties", "PropertiesChanged")); + bus_message_dump(reply, stdout, true); + + sd_bus_message_unref(reply); + reply = NULL; + r = sd_bus_call_method(bus, "org.freedesktop.systemd.test", "/foo", "org.freedesktop.systemd.test", "EmitInterfacesAdded", &error, NULL, ""); assert_se(r >= 0); |