[virt-tools-list] [virt-viewer] Fix automatic usb redir through controller
Christophe Fergeau
cfergeau at redhat.com
Mon Apr 16 16:27:16 UTC 2012
remote-viewer is currently trying to use
SpiceUsbDeviceManager::auto-connect to control whether USB devices
should be automatically be connected or not. However, this property
is more or less an internal spice-gtk property which is toggled
by SpiceGtkSession when the SPICE widget gets/loses focus.
SpiceGtkSession has an "auto-usbredir" property which can be used
by applications to enable/disable automatic usb redirection through
SPICE. Since this property is helpfully bound to
VirtViewerSession::auto-usbredir, use this when the controller
is told to enable/disable USB redirection.
Without this change, automatic USB redirection will always get reenabled
as soon as there's a focus change since it defaults to be enabled in
spice-gtk.
---
src/remote-viewer.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index c6ad70d..77c1414 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -595,11 +595,11 @@ spice_ctrl_notified(SpiceCtrlController *ctrl,
} else if (g_str_equal(pspec->name, "host-subject")) {
g_object_set_property(G_OBJECT(session), "cert-subject", &value);
} else if (g_str_equal(pspec->name, "enable-usb-autoshare")) {
- SpiceUsbDeviceManager *manager;
- manager = spice_usb_device_manager_get(session, NULL);
- if (manager != NULL) {
- g_object_set_property(G_OBJECT(manager), "auto-connect", &value);
- }
+ VirtViewerSession *vsession = NULL;
+
+ g_object_get(self, "session", &vsession, NULL);
+ g_object_set_property(G_OBJECT(vsession), "auto-usbredir", &value);
+ g_object_unref(G_OBJECT(vsession));
} else if (g_str_equal(pspec->name, "usb-filter")) {
SpiceUsbDeviceManager *manager;
manager = spice_usb_device_manager_get(session, NULL);
--
1.7.10
More information about the virt-tools-list
mailing list