[Spice-devel] [PATCH v2 1/6] UsbDeviceManager add redirecting state

Kirill Moizik kirill at daynix.com
Mon Jul 6 10:59:01 PDT 2015


add redirecting  property to UsbDeviceManager and expose get/set API

Signed-off-by: Kirill Moizik <kirill at daynix.com>
---
 src/usb-device-manager.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 5b8151f..1b334d3 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -93,6 +93,7 @@ enum {
     PROP_AUTO_CONNECT,
     PROP_AUTO_CONNECT_FILTER,
     PROP_REDIRECT_ON_CONNECT,
+    PROP_REDIRECTING,
 };
 
 enum
@@ -130,6 +131,7 @@ struct _SpiceUsbDeviceManagerPrivate {
     SpiceWinUsbDriver     *installer;
 #endif
     gboolean               use_usbclerk;
+    gboolean               redirecting;
 #endif
     GPtrArray *devices;
     GPtrArray *channels;
@@ -241,6 +243,7 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
 #ifdef USE_USBREDIR
     priv->devices  = g_ptr_array_new_with_free_func((GDestroyNotify)
                                                     spice_usb_device_unref);
+    priv->redirecting = FALSE;
 #endif
 }
 
@@ -421,6 +424,11 @@ static void spice_usb_device_manager_get_property(GObject     *gobject,
     case PROP_REDIRECT_ON_CONNECT:
         g_value_set_string(value, priv->redirect_on_connect);
         break;
+    case PROP_REDIRECTING:
+#ifdef USE_USBREDIR
+        g_value_set_boolean(value, priv->redirecting);
+#endif
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
         break;
@@ -504,6 +512,11 @@ static void spice_usb_device_manager_set_property(GObject       *gobject,
         priv->redirect_on_connect = g_strdup(filter);
         break;
     }
+    case PROP_REDIRECTING:
+#ifdef USE_USBREDIR
+        priv->redirecting = g_value_get_boolean(value);
+#endif
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
         break;
@@ -595,6 +608,21 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
                                     pspec);
 
     /**
+     * SpiceUsbDeviceManager:redirecting:
+     *
+     * Boolean variable specifying async usb redirection flow
+     *
+     * See #SpiceUsbDeviceManager:auto-connect-filter for the filter string
+     * format.
+     */
+    pspec = g_param_spec_boolean("redirecting", "Redirecting",
+                                 "Usb redirection in process",
+                                 FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+    g_object_class_install_property(gobject_class, PROP_REDIRECTING,
+                                    pspec);
+
+    /**
      * SpiceUsbDeviceManager::device-added:
      * @manager: the #SpiceUsbDeviceManager that emitted the signal
      * @device: #SpiceUsbDevice boxed object corresponding to the added device
-- 
2.1.0



More information about the Spice-devel mailing list