summaryrefslogtreecommitdiff
path: root/src/dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-20 02:26:05 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-20 02:31:54 +0200
commitc4e2ceae941d02de5574becbfd3b4db15de2eda3 (patch)
treec0bda809e0b860f5b0f8e66942dd486c17f2e309 /src/dbus.c
parentd06dacd0020af7e31ff6089deff339b00ed979e3 (diff)
dbus: follow standardized fdo PropertiesChanged signal spec
Diffstat (limited to 'src/dbus.c')
-rw-r--r--src/dbus.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/dbus.c b/src/dbus.c
index e8828d02df..952806bb2a 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -1247,6 +1247,7 @@ DBusHandlerResult bus_default_message_handler(Manager *m, DBusConnection *c, DBu
if (!dbus_message_iter_close_container(&iter, &sub))
goto oom;
}
+
} else if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Properties", "GetAll") && properties) {
const char *interface;
const BusProperty *p;
@@ -1611,3 +1612,41 @@ bool bus_connection_has_subscriber(Manager *m, DBusConnection *c) {
return !set_isempty(BUS_CONNECTION_SUBSCRIBED(m, c));
}
+
+DBusMessage* bus_properties_changed_new(const char *path, const char *interface, const char *properties) {
+ DBusMessage *m;
+ DBusMessageIter iter, sub;
+ const char *i;
+
+ assert(interface);
+ assert(properties);
+
+ if (!(m = dbus_message_new_signal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged")))
+ goto oom;
+
+ dbus_message_iter_init_append(m, &iter);
+
+ /* We won't send any property values, since they might be
+ * large and sometimes not cheap to generated */
+
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface) ||
+ !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub) ||
+ !dbus_message_iter_close_container(&iter, &sub) ||
+ !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &sub))
+ goto oom;
+
+ NULSTR_FOREACH(i, properties)
+ if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &i))
+ goto oom;
+
+ if (!dbus_message_iter_close_container(&iter, &sub))
+ goto oom;
+
+ return m;
+
+oom:
+ if (m)
+ dbus_message_unref(m);
+
+ return NULL;
+}