[virt-tools-list] [PATCH virt-viewer] app: Do not show usbredir button without session
Pavel Grunt
pgrunt at redhat.com
Fri Jan 22 14:00:56 UTC 2016
Avoid runtime warnings when waiting for a guest:
virt-viewer-CRITICAL **: virt_viewer_session_usb_device_selection: assertion 'VIRT_VIEWER_IS_SESSION(self)' failed
And also do not show the usb redirection button in fullscreen
if spice-gtk is built without the usb redirection support.
---
src/virt-viewer-app.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 653b30c..de7874b 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -903,6 +903,13 @@ viewer_window_focus_out_cb(GtkWindow *window G_GNUC_UNUSED,
return FALSE;
}
+static gboolean
+virt_viewer_app_has_usbredir(VirtViewerApp *self)
+{
+ return virt_viewer_app_has_session(self) &&
+ virt_viewer_session_get_has_usbredir(virt_viewer_app_get_session(self));
+}
+
static VirtViewerWindow*
virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
{
@@ -921,10 +928,7 @@ virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
self->priv->windows = g_list_append(self->priv->windows, window);
virt_viewer_app_set_window_subtitle(self, window, nth);
virt_viewer_app_update_menu_displays(self);
- if (self->priv->session) {
- virt_viewer_window_set_usb_options_sensitive(window,
- virt_viewer_session_get_has_usbredir(self->priv->session));
- }
+ virt_viewer_window_set_usb_options_sensitive(window, virt_viewer_app_has_usbredir(self));
g_signal_emit(self, signals[SIGNAL_WINDOW_ADDED], 0, window);
--
2.5.0
More information about the virt-tools-list
mailing list