summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-06-12 14:10:25 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-06-12 17:29:34 +0300
commitd2071191c0d787c6033e0fbafc0879866d7718e5 (patch)
tree9e1688dec227d8a31ac4436fec621c99b398d911
parentdc673a864c797ebecaac1a09e6f1dac98cbb1ad0 (diff)
downloadobexd-d2071191c0d787c6033e0fbafc0879866d7718e5.tar.gz
client: Remove obc_transfer_abort
Refactor the code to remove function obc_transfer_abort, which is used only once and is anyway coupled to the D-Bus API.
-rw-r--r--client/transfer.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/client/transfer.c b/client/transfer.c
index 0686afe..f296638 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -187,20 +187,6 @@ static void abort_complete(GObex *obex, GError *err, gpointer user_data)
}
}
-static gboolean obc_transfer_abort(struct obc_transfer *transfer)
-{
- if (transfer->xfer == 0)
- return FALSE;
-
- if (transfer->progress_id != 0) {
- g_source_remove(transfer->progress_id);
- transfer->progress_id = 0;
- }
-
- return g_obex_cancel_transfer(transfer->xfer, abort_complete,
- transfer);
-}
-
static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -218,7 +204,17 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
ERROR_INTERFACE ".InProgress",
"Cancellation already in progress");
- if (!obc_transfer_abort(transfer))
+ if (transfer->xfer == 0)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".Failed",
+ "Failed");
+
+ if (transfer->progress_id != 0) {
+ g_source_remove(transfer->progress_id);
+ transfer->progress_id = 0;
+ }
+
+ if (!g_obex_cancel_transfer(transfer->xfer, abort_complete, transfer))
return g_dbus_create_error(message,
ERROR_INTERFACE ".Failed",
"Failed");