[virt-tools-list] [PATCH virt-viewer] Always ask user about closing session

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jan 29 13:05:51 UTC 2013


Currently, virt-viewer doesn't ask for user confirmation when closing
a single monitor session. Always ask before closing, as requested by
user.

https://bugzilla.redhat.com/show_bug.cgi?id=803912
---
 src/virt-viewer-app.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index ec5e403..eea77e0 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -254,12 +254,6 @@ virt_viewer_app_get_n_windows_visible(VirtViewerApp *self)
     return n;
 }
 
-static guint
-virt_viewer_app_get_n_windows(VirtViewerApp *self)
-{
-    return g_hash_table_size(self->priv->windows);
-}
-
 gboolean
 virt_viewer_app_window_set_visible(VirtViewerApp *self,
                                    VirtViewerWindow *window,
@@ -275,13 +269,13 @@ virt_viewer_app_window_set_visible(VirtViewerApp *self,
         if (virt_viewer_app_get_n_windows_visible(self) > 1) {
             virt_viewer_window_hide(window);
             return FALSE;
-        } else if (virt_viewer_app_get_n_windows(self) > 1) {
+        } else {
             GtkWidget *dialog =
                 gtk_message_dialog_new (virt_viewer_window_get_window(window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                         GTK_MESSAGE_QUESTION,
                                         GTK_BUTTONS_OK_CANCEL,
-                                        _("This is the last visible display. Do you want to quit?"));
+                                        _("Do you want to close the session?"));
             gint result = gtk_dialog_run (GTK_DIALOG (dialog));
             gtk_widget_destroy(dialog);
             switch (result) {
@@ -292,9 +286,6 @@ virt_viewer_app_window_set_visible(VirtViewerApp *self,
                 break;
             }
             return FALSE;
-        } else {
-            virt_viewer_app_quit(self);
-            return FALSE;
         }
     }
 
-- 
1.8.1.1.439.g50a6b54




More information about the virt-tools-list mailing list