Re: [PATCH v5 11/13] UsbDeviceWidget: Consider asynchronous redirection flows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11 Feb 2016, at 01:00 AM, Jonathon Jongsma <jjongsma@xxxxxxxxxx> wrote:

On Thu, 2015-10-29 at 17:27 +0200, Dmitry Fleytman wrote:
From: Kirill Moizik <kmoizik@xxxxxxxxxx>

Gray out redirection controls while there are
asynchronous redirection flows in progress.

Signed-off-by: Kirill Moizik <kmoizik@xxxxxxxxxx>
Signed-off-by: Dmitry Fleytman <dfleytma@xxxxxxxxxx>
---
src/usb-device-widget.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index f88573a..29967d1 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -374,27 +374,29 @@ static void check_can_redirect(GtkWidget *widget,
gpointer user_data)
        return; /* Non device widget, ie the info_bar */

    priv->device_count++;
-    can_redirect = spice_usb_device_manager_can_redirect_device(priv
->manager,
-                                                                device,
&err);
-    gtk_widget_set_sensitive(widget, can_redirect);
-
-    /* If we cannot redirect this device, append the error message to
-       err_msg, but only if it is *not* already there! */
-    if (!can_redirect) {
-        if (priv->err_msg) {
-            if (!strstr(priv->err_msg, err->message)) {
-                gchar *old_err_msg = priv->err_msg;

-                priv->err_msg = g_strdup_printf("%s\n%s", priv->err_msg,
-                                                err->message);
-                g_free(old_err_msg);
+    if (spice_usb_device_manager_is_redirecting(priv->manager)) {
+        can_redirect = FALSE;
+    } else {
+        can_redirect = spice_usb_device_manager_can_redirect_device(priv
->manager,
+                                                                    device,
&err);
+        /* If we cannot redirect this device, append the error message to
+           err_msg, but only if it is *not* already there! */
+        if (!can_redirect) {
+            if (priv->err_msg) {
+                if (!strstr(priv->err_msg, err->message)) {
+                    gchar *old_err_msg = priv->err_msg;
+                    priv->err_msg = g_strdup_printf("%s\n%s", priv->err_msg,
+                                                    err->message);
+                    g_free(old_err_msg);
+                }
+            } else {
+                priv->err_msg = g_strdup(err->message);
            }
-        } else {
-            priv->err_msg = g_strdup(err->message);
        }
+        g_clear_error(&err);
    }
-
-    g_clear_error(&err);
+    gtk_widget_set_sensitive(widget, can_redirect);
}

static gboolean spice_usb_device_widget_update_status(gpointer user_data)
@@ -458,9 +460,9 @@ static void connect_cb(GObject *gobject, GAsyncResult
*res, gpointer user_data)
        g_error_free(err);

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->check), FALSE);
-        spice_usb_device_widget_update_status(self);
-    }

+    }
+    spice_usb_device_widget_update_status(self);

I'd prefer the newline to be after the brace (as it was before) rather than
before the brace.

Fixed. Thanks.



    g_object_unref(data->check);
    g_object_unref(data->self);
    g_free(data);

ACK with minor change above.

Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]