summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2016-09-14 10:03:31 +0200
committerPavel Grunt <pgrunt@redhat.com>2016-09-14 12:54:33 +0200
commit53c503d96ccd01b1c7a3c62c54ebf1e72af6674b (patch)
tree3cc6bde3ee5c469fecfa7c9beb63139ea50b3e77
parent7a7223c5d8a213176cde5144a4518dbb1d49f99d (diff)
widget: Inform about transfer failure
Call spice_main_file_copy_finish to get result of the transfer Acked-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r--src/spice-widget.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 9c8f7d1..06e332f 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -499,6 +499,24 @@ static gboolean grab_broken(SpiceDisplay *self, GdkEventGrabBroken *event,
return false;
}
+static void file_transfer_callback(GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data G_GNUC_UNUSED)
+{
+ SpiceMainChannel *channel = SPICE_MAIN_CHANNEL(source_object);
+ GError *error = NULL;
+
+ if (spice_main_file_copy_finish(channel, result, &error))
+ return;
+
+ if (error != NULL && error->message != NULL)
+ g_warning("File transfer failed with error: %s", error->message);
+ else
+ g_warning("File transfer failed");
+
+ g_clear_error(&error);
+}
+
static void drag_data_received_callback(SpiceDisplay *self,
GdkDragContext *drag_context,
gint x,
@@ -531,7 +549,7 @@ static void drag_data_received_callback(SpiceDisplay *self,
g_strfreev(file_urls);
spice_main_file_copy_async(d->main, files, 0, NULL, NULL,
- NULL, NULL, NULL);
+ NULL, file_transfer_callback, NULL);
for (i = 0; i < n_files; i++) {
g_object_unref(files[i]);
}