[Spice-devel] [PATCH v2 3/6] UsbWidget update widget on redirection flow

Christophe Fergeau cfergeau at redhat.com
Tue Jul 7 05:30:43 PDT 2015


On Mon, Jul 06, 2015 at 08:59:03PM +0300, Kirill Moizik wrote:
> expose functions to control usb widget sensitivity during  redirection flow
> 
> Signed-off-by: Kirill Moizik <kmoizik at redhat.com>
> ---
>  src/usb-device-widget.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
> index 1ec30e3..72f3b34 100644
> --- a/src/usb-device-widget.c
> +++ b/src/usb-device-widget.c
> @@ -52,6 +52,11 @@ static gboolean spice_usb_device_widget_update_status(gpointer user_data);
>  /* ------------------------------------------------------------------ */
>  /* gobject glue                                                       */
>  
> +
> +#ifdef USE_USBREDIR
> +static void set_sensitive_all(GtkWidget *widget, gpointer user_data);
> +#endif
> +
>  #define SPICE_USB_DEVICE_WIDGET_GET_PRIVATE(obj) \
>      (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_USB_DEVICE_WIDGET, \
>                                   SpiceUsbDeviceWidgetPrivate))
> @@ -425,6 +430,29 @@ typedef struct _connect_cb_data {
>      SpiceUsbDeviceWidget *self;
>  } connect_cb_data;
>  
> +static void set_redirecting(SpiceUsbDeviceWidget *self, gboolean val)
> +{
> +#ifdef USE_USBREDIR
> +    g_object_set(self->priv->manager,"redirecting", val, NULL);
> +#ifndef USE_LIBUSB_HOTPLUG
> +    spice_g_udev_set_redirecting(val);


I don't think this is done at the right level, what if a spice-gtk user
calls spice_usb_device_manager_connect_device_async directly and does
not use the USB selection widget? I think nothing prevents it from
trying to do several spice_usb_device_manager_connect_device_async()
calls at the same time, which, as I understand it, is a big no.
Setting SpiceUsbDeviceManager::redirecting to TRUE/FALSE most likely
belong to spice_usb_device_manager_connect_device_async()
implementation, with spice_usb_device_manager_connect_device_async()
failing if trying to call it when a redirection is already in progress
(or is this allowed?)

Then, this code can just do
g_signal_connect(self->priv->manager, "notify::redirecting", redirecting_changed_cb, self);
and adjust the widget sensitivity.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150707/1dd70549/attachment.sig>


More information about the Spice-devel mailing list