summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-04-16 18:21:07 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2012-04-17 10:11:09 +0200
commit37171c465fd762da6c398003340855cc7df062ac (patch)
tree4bdebd811a7b6e9833b38e7d1fbfb462afab0ff2
parent521116f51be04f2861bf1f02937974382f046073 (diff)
Fix automatic usb redir through controller
remote-viewer is currently trying to use SpiceUsbDeviceManager::auto-connect to control whether USB devices should be automatically 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 SpiceGtkSession::auto-usbredir defaults to be enabled in spice-gtk.
-rw-r--r--src/remote-viewer.c10
1 files 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);