Re: [PATCH v2 3/6] UsbWidget update widget on redirection flow

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

 



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@xxxxxxxxxx>
> ---
>  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

Attachment: pgpuswDeLZepl.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]