[Spice-commits] tools/spicy.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Wed Feb 8 15:26:45 UTC 2017


 tools/spicy.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 4d3e78993c4019e3d9769370ee8b47ebee07692a
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Feb 7 15:08:19 2017 -0600

    Spicy: cancel file transfer when dialog is closed
    
    Clicking the 'X' to close the file transfer dialog did not actually
    cancel the ongoing file transfer, and resulted in a bunch of critical
    warnings on the terminal. Make the delete-event explicitly cancel all
    ongoing file transfers.

diff --git a/tools/spicy.c b/tools/spicy.c
index 2c8941a..ce6b40b 100644
--- a/tools/spicy.c
+++ b/tools/spicy.c
@@ -1534,6 +1534,14 @@ static void transfer_task_finished(SpiceFileTransferTask *task, GError *error, s
         gtk_widget_hide(conn->transfer_dialog);
 }
 
+static gboolean dialog_delete_cb(GtkWidget *widget,
+                                 GdkEvent *event G_GNUC_UNUSED,
+                                 gpointer user_data G_GNUC_UNUSED)
+{
+    gtk_dialog_response(GTK_DIALOG(widget), GTK_RESPONSE_CANCEL);
+    return TRUE;
+}
+
 static void dialog_response_cb(GtkDialog *dialog,
                                gint response_id,
                                gpointer user_data)
@@ -1627,6 +1635,8 @@ static void spice_connection_add_task(spice_connection *conn, SpiceFileTransferT
         gtk_window_set_resizable(GTK_WINDOW(conn->transfer_dialog), FALSE);
         g_signal_connect(conn->transfer_dialog, "response",
                          G_CALLBACK(dialog_response_cb), conn);
+        g_signal_connect(conn->transfer_dialog, "delete-event",
+                         G_CALLBACK(dialog_delete_cb), conn);
     }
     gtk_widget_show(conn->transfer_dialog);
     content = gtk_dialog_get_content_area(GTK_DIALOG(conn->transfer_dialog));


More information about the Spice-commits mailing list