[Spice-devel] [PATCH spice-gtk 09/16] channel-main: file_xfer_failed -> file_xfer_completed

Hans de Goede hdegoede at redhat.com
Fri Mar 29 04:40:21 PDT 2013


Make file_xfer_failed usable for all file_stream closing.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index bd27ef4..10ba175 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2581,12 +2581,13 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean
     update_display_timer(channel, 1);
 }
 
-static void file_xfer_failed(SpiceFileXferTask *task, GError *error)
+static void file_xfer_completed(SpiceFileXferTask *task, GError *error)
 {
-    SPICE_DEBUG("File %s xfer failed: %s",
-                g_file_get_path(task->file), error->message);
-
-    task->error = error;
+    if (error) {
+        SPICE_DEBUG("File %s xfer failed: %s",
+                    g_file_get_path(task->file), error->message);
+        task->error = error;
+    }
     g_input_stream_close_async(G_INPUT_STREAM(task->file_stream),
                                G_PRIORITY_DEFAULT,
                                task->cancellable,
@@ -2642,7 +2643,7 @@ static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer da
     return;
 
 failed:
-    file_xfer_failed(task, error);
+    file_xfer_completed(task, error);
 }
 
 static void file_xfer_read_async_cb(GObject *obj, GAsyncResult *res, gpointer data)
@@ -2653,7 +2654,7 @@ static void file_xfer_read_async_cb(GObject *obj, GAsyncResult *res, gpointer da
 
     task->file_stream = g_file_read_finish(file, res, &error);
     if (error) {
-        file_xfer_failed (task, error);
+        file_xfer_completed(task, error);
         return;
     }
 
-- 
1.8.1.4



More information about the Spice-devel mailing list