summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-10-15 14:06:56 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2015-10-15 17:15:08 -0500
commit17a6b8a78a3f48f669cf1ccda32a92cc8faef513 (patch)
treef1cbcf62a393f582e022ed8444036698ca2e590a
parent93182f22a9b807a3ee5d663f7ff7b9fb0ce215a1 (diff)
downloadspice-gtk-17a6b8a78a3f48f669cf1ccda32a92cc8faef513.tar.gz
spice-gtk-17a6b8a78a3f48f669cf1ccda32a92cc8faef513.tar.xz
spice-gtk-17a6b8a78a3f48f669cf1ccda32a92cc8faef513.zip
FileTransferTask: ensure we emit 'finished' signal
In the case where a file cannot be opened for reading, we were not emitting a 'finished' signal to communicate the error to the client. I was intending to further fix this issue by 'rejecting' the drop (in SpiceDisplay) when the URI list contains invalid files (e.g. directories). This would prevent a 'new-file-transfer' signal from even being emitted for these invalid files. But this turns out to be not very useful since there's no real feedback given to the user to indicate why the drop failed. So it's probably better for client applications to get the 'new-file-transfer' and 'finished' signals so that they can present the error to the user to explain why the attempted transfer did not work.
-rw-r--r--src/channel-main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/channel-main.c b/src/channel-main.c
index ffeb0ba..3a8c1dd 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2935,7 +2935,7 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
if (!self->priv->file_stream) {
file_xfer_close_cb(NULL, NULL, self);
- return;
+ goto signal;
}
g_input_stream_close_async(G_INPUT_STREAM(self->priv->file_stream),
@@ -2944,6 +2944,7 @@ static void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
file_xfer_close_cb,
self);
self->priv->pending = TRUE;
+signal:
g_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, error);
}