summaryrefslogtreecommitdiff
path: root/src/dbus-job.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus-job.c')
-rw-r--r--src/dbus-job.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/dbus-job.c b/src/dbus-job.c
index 82a23a85bd..ab6d610243 100644
--- a/src/dbus-job.c
+++ b/src/dbus-job.c
@@ -85,15 +85,15 @@ static int bus_job_append_unit(DBusMessageIter *i, const char *property, void *d
return 0;
}
-static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connection, DBusMessage *message) {
- const BusProperty properties[] = {
- { "org.freedesktop.systemd1.Job", "Id", bus_property_append_uint32, "u", &j->id },
- { "org.freedesktop.systemd1.Job", "State", bus_job_append_state, "s", &j->state },
- { "org.freedesktop.systemd1.Job", "JobType", bus_job_append_type, "s", &j->type },
- { "org.freedesktop.systemd1.Job", "Unit", bus_job_append_unit, "(so)", j },
- { NULL, NULL, NULL, NULL, NULL }
- };
+static const BusProperty bus_job_properties[] = {
+ { "Id", bus_property_append_uint32, "u", offsetof(Job, id) },
+ { "State", bus_job_append_state, "s", offsetof(Job, state) },
+ { "JobType", bus_job_append_type, "s", offsetof(Job, type) },
+ { "Unit", bus_job_append_unit, "(so)", 0 },
+ { NULL, }
+};
+static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connection, DBusMessage *message) {
DBusMessage *reply = NULL;
if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Job", "Cancel")) {
@@ -102,8 +102,13 @@ static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusConnection *connec
job_finish_and_invalidate(j, JOB_CANCELED);
- } else
- return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, properties);
+ } else {
+ const BusBoundProperties bps[] = {
+ { "org.freedesktop.systemd1.Job", bus_job_properties, j },
+ { NULL, }
+ };
+ return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, bps);
+ }
if (reply) {
if (!dbus_connection_send(connection, reply, NULL))