[PATCH v4 13/16] UsbDeviceWidget: Show info bar during redirection flows

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

 



From: Kirill Moizik <kmoizik@xxxxxxxxxx>

Signed-off-by: Kirill Moizik <kmoizik@xxxxxxxxxx>
Signed-off-by: Dmitry Fleytman <dfleytma@xxxxxxxxxx>
---
 src/map-file             |  1 +
 src/usb-device-manager.c | 23 +++++++++++++++++++++++
 src/usb-device-manager.h |  2 ++
 src/usb-device-widget.c  |  8 ++++++++
 4 files changed, 34 insertions(+)

diff --git a/src/map-file b/src/map-file
index bae4d37..35054af 100644
--- a/src/map-file
+++ b/src/map-file
@@ -122,6 +122,7 @@ spice_usb_device_manager_connect_device_async;
 spice_usb_device_manager_connect_device_finish;
 spice_usb_device_manager_disconnect_device;
 spice_usb_device_manager_disconnect_device_async;
+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 99ff4d9..ba1c7d2 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -229,6 +229,29 @@ _set_redirecting(SpiceUsbDeviceManager *self, gboolean is_redirecting)
 G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, g_object_ref, g_object_unref)
 #endif
 
+/**
+* spcie_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 025262a..bd10aa9 100644
--- a/src/usb-device-manager.h
+++ b/src/usb-device-manager.h
@@ -125,6 +125,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 1ec30e3..1f762fb 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -399,6 +399,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);
@@ -417,6 +420,11 @@ static gboolean spice_usb_device_widget_update_status(gpointer user_data)
         spice_usb_device_widget_show_info_bar(self, _("No USB devices detected"),
                                               GTK_MESSAGE_INFO,
                                               GTK_STOCK_DIALOG_INFO);
+    if (redirecting == TRUE) {
+        spice_usb_device_widget_show_info_bar(self, _("Redirecting USB Device..."),
+                                              GTK_MESSAGE_INFO,
+                                              GTK_STOCK_DIALOG_INFO);
+    }
     return FALSE;
 }
 
-- 
2.4.3

_______________________________________________
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]