From 3eadc034c98928423f0f5771c25a8b352e11e267 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 17 Dec 2012 15:25:26 +0200 Subject: [PATCH] obex-client: Make use of g_dbus_get_properties to get transfer properties In addition fix the reply generated by obc_transfer_create_dbus_reply to not use a structure container instead use object, dict 'oa{sv}' as indicated in the documentation. --- obexd/client/transfer.c | 46 ++++------------------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c index 29d61f36a..fc3f87bd3 100644 --- a/obexd/client/transfer.c +++ b/obexd/client/transfer.c @@ -97,47 +97,6 @@ static void obc_transfer_append_dbus_properties(struct obc_transfer *transfer, &transfer->progress); } -static DBusMessage *obc_transfer_get_properties(DBusConnection *connection, - DBusMessage *message, void *user_data) -{ - struct obc_transfer *transfer = user_data; - DBusMessage *reply; - DBusMessageIter iter, dict; - - reply = dbus_message_new_method_return(message); - if (!reply) - return NULL; - - dbus_message_iter_init_append(reply, &iter); - dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, - OBC_PROPERTIES_ARRAY_SIGNATURE, - &dict); - - obc_transfer_append_dbus_properties(transfer, &dict); - - dbus_message_iter_close_container(&iter, &dict); - - return reply; -} - -static void obc_transfer_append_dbus_data(struct obc_transfer *transfer, - DBusMessageIter *iter) -{ - const char *path = transfer->path; - DBusMessageIter entry, dict; - - dbus_message_iter_open_container(iter, DBUS_TYPE_STRUCT, NULL, &entry); - dbus_message_iter_append_basic(&entry, DBUS_TYPE_OBJECT_PATH, &path); - dbus_message_iter_open_container(&entry, DBUS_TYPE_ARRAY, - OBC_PROPERTIES_ARRAY_SIGNATURE, - &dict); - - obc_transfer_append_dbus_properties(transfer, &dict); - - dbus_message_iter_close_container(&entry, &dict); - dbus_message_iter_close_container(iter, &entry); -} - DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer, DBusMessage *message) { @@ -149,7 +108,10 @@ DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer, return NULL; dbus_message_iter_init_append(reply, &iter); - obc_transfer_append_dbus_data(transfer, &iter); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, + &transfer->path); + g_dbus_get_properties(transfer->conn, transfer->path, + TRANSFER_INTERFACE, &iter); return reply; }