[Spice-devel] [PATCH v5 11/13] UsbDeviceWidget: Consider asynchronous redirection flows
Dmitry Fleytman
dmitry at daynix.com
Sun Feb 28 09:00:24 UTC 2016
> On 11 Feb 2016, at 01:00 AM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
>
> On Thu, 2015-10-29 at 17:27 +0200, Dmitry Fleytman wrote:
>> From: Kirill Moizik <kmoizik at redhat.com>
>>
>> Gray out redirection controls while there are
>> asynchronous redirection flows in progress.
>>
>> Signed-off-by: Kirill Moizik <kmoizik at redhat.com>
>> Signed-off-by: Dmitry Fleytman <dfleytma at redhat.com>
>> ---
>> 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 at redhat.com <mailto:jjongsma at redhat.com>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160228/0858e4a4/attachment-0001.html>
More information about the Spice-devel
mailing list