[Spice-devel] [PATCH v7 11/14] UsbDeviceWidget: Show info bar during redirection flows
Jonathon Jongsma
jjongsma at redhat.com
Thu Mar 10 20:38:40 UTC 2016
Previously acked
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
On Tue, 2016-03-08 at 16:05 +0200, Dmitry Fleytman wrote:
> From: Kirill Moizik <kmoizik at redhat.com>
>
> Signed-off-by: Kirill Moizik <kmoizik at redhat.com>
> Signed-off-by: Dmitry Fleytman <dfleytma at redhat.com>
> ---
> src/map-file | 1 +
> src/usb-device-manager.c | 23 +++++++++++++++++++++++
> src/usb-device-manager.h | 2 ++
> src/usb-device-widget.c | 7 +++++++
> 4 files changed, 33 insertions(+)
>
> diff --git a/src/map-file b/src/map-file
> index 7f1dc2b..0decba8 100644
> --- a/src/map-file
> +++ b/src/map-file
> @@ -129,6 +129,7 @@ spice_usb_device_manager_connect_device_finish;
> spice_usb_device_manager_disconnect_device;
> spice_usb_device_manager_disconnect_device_async;
> spice_usb_device_manager_disconnect_device_finish;
> +spice_usb_device_manager_is_redirecting;
> spice_usb_device_manager_get;
> spice_usb_device_manager_get_devices;
> spice_usb_device_manager_get_devices_with_filter;
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 73f9083..60d3f6c 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -232,6 +232,29 @@ _set_redirecting(SpiceUsbDeviceManager *self, gboolean
> is_redirecting)
> G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, g_object_ref,
> g_object_unref)
> #endif
>
> +/**
> +* spice_usb_device_manager_is_redirecting:
> +* @manager: the #SpiceUsbDeviceManager manager
> +*
> +* Returns: %TRUE if device redirection negotiation flow is in progress
> +*/
> +gboolean spice_usb_device_manager_is_redirecting(SpiceUsbDeviceManager *self)
> +{
> +#ifdef USE_USBREDIR
> +
> +#ifdef USE_GUDEV
> + gboolean redirecting;
> + g_object_get(self->priv->udev, "redirecting", &redirecting, NULL);
> + return redirecting;
> +#else
> + return self->priv->redirecting;
> +#endif
> +
> +#else
> + return FALSE;
> +#endif
> +}
> +
> static void spice_usb_device_manager_initable_iface_init(GInitableIface
> *iface);
>
> static guint signals[LAST_SIGNAL] = { 0, };
> diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
> index d1b0a96..a9a4f7a 100644
> --- a/src/usb-device-manager.h
> +++ b/src/usb-device-manager.h
> @@ -138,6 +138,8 @@
> spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager *self,
> SpiceUsbDevice *device,
> GError **err);
>
> +gboolean spice_usb_device_manager_is_redirecting(SpiceUsbDeviceManager
> *self);
> +
> G_END_DECLS
>
> #endif /* __SPICE_USB_DEVICE_MANAGER_H__ */
> diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
> index fe983c9..9409036 100644
> --- a/src/usb-device-widget.c
> +++ b/src/usb-device-widget.c
> @@ -401,6 +401,9 @@ static gboolean
> spice_usb_device_widget_update_status(gpointer user_data)
> {
> SpiceUsbDeviceWidget *self = SPICE_USB_DEVICE_WIDGET(user_data);
> SpiceUsbDeviceWidgetPrivate *priv = self->priv;
> + gboolean redirecting;
> +
> + redirecting = spice_usb_device_manager_is_redirecting(priv->manager);
>
> priv->device_count = 0;
> gtk_container_foreach(GTK_CONTAINER(self), check_can_redirect, self);
> @@ -411,6 +414,10 @@ static gboolean
> spice_usb_device_widget_update_status(gpointer user_data)
> GTK_STOCK_DIALOG_WARNING);
> g_free(priv->err_msg);
> priv->err_msg = NULL;
> + } else if (redirecting) {
> + spice_usb_device_widget_show_info_bar(self, _("Redirecting USB
> Device..."),
> + GTK_MESSAGE_INFO,
> + GTK_STOCK_DIALOG_INFO);
> } else {
> spice_usb_device_widget_hide_info_bar(self);
> }
More information about the Spice-devel
mailing list