[Spice-devel] [PATCH spice-gtk] Spicy: cancel file transfer when dialog is closed

Victor Toso victortoso at redhat.com
Wed Feb 8 07:47:29 UTC 2017


Hi,

On Tue, Feb 07, 2017 at 03:09:29PM -0600, Jonathon Jongsma wrote:
> 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.

Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  tools/spicy.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tools/spicy.c b/tools/spicy.c
> index c502428..9279f9b 100644
> --- a/tools/spicy.c
> +++ b/tools/spicy.c
> @@ -1487,6 +1487,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)
> @@ -1580,6 +1588,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));
> -- 
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170208/44d57b86/attachment.sig>


More information about the Spice-devel mailing list