[Spice-devel] [PATCH spice-gtk 2/3] spicy: Don't show an error dialog on a cancelled device open

Hans de Goede hdegoede at redhat.com
Thu Dec 1 05:12:56 PST 2011

If for example the user plugs in a new device, then gets the policykit agent
authentication dialog and then unplugs the device, spice-gtk will cancel
the acl-helper request, which in turn will dismiss the policykit agent
authentication dialog. Which is all a nice and smooth user experience,
except that when this happens spicy throws a dialog with an error
that the open was cancelled. Since a cancel usually is done deliberately
(such as on the user unpluging the device) no error dialog should be thrown
for it.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
 gtk/spicy.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gtk/spicy.c b/gtk/spicy.c
index 427b8d1..c662983 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -1618,6 +1618,9 @@ static void auto_connect_failed(SpiceUsbDeviceManager *manager,
     GtkWidget *dialog;
+    if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)
+        return;
     dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
                                     "USB redirection error");

More information about the Spice-devel mailing list