[virt-tools-list] [virt-viewer] Don't show 'do you want to quit' dialog in kiosk mode

Christophe Fergeau cfergeau at redhat.com
Thu Feb 6 09:10:08 UTC 2014


In some situation, (for example, guest without vdagent running), it's
possible to pass key combinations to virt-viewer. When using alt+f4,
this can cause the 'do you want to quit?' dialog to show while it's
non-functional.
This commit moves the check for kiosk mode to before we show this dialog.
---
 src/virt-viewer-app.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 0cdf95a..6698c2e 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -252,13 +252,9 @@ static void
 virt_viewer_app_quit(VirtViewerApp *self)
 {
     g_return_if_fail(VIRT_VIEWER_IS_APP(self));
+    g_return_if_fail(!self->priv->kiosk);
     VirtViewerAppPrivate *priv = self->priv;
 
-    if (self->priv->kiosk) {
-        g_warning("The app is in kiosk mode and can't quit");
-        return;
-    }
-
     virt_viewer_app_save_config(self);
 
     if (priv->session) {
@@ -367,6 +363,11 @@ virt_viewer_app_maybe_quit(VirtViewerApp *self, VirtViewerWindow *window)
 {
     GError *error = NULL;
 
+    if (self->priv->kiosk) {
+        g_warning("The app is in kiosk mode and can't quit");
+        return;
+    }
+
     gboolean ask = g_key_file_get_boolean(self->priv->config,
                                           "virt-viewer", "ask-quit", &error);
     if (error) {
-- 
1.8.5.3




More information about the virt-tools-list mailing list