[virt-tools-list] [PATCH virt-viewer 1/2] Remove special-case for getting window n=0

Jonathon Jongsma jjongsma at redhat.com
Thu Mar 6 22:17:33 UTC 2014


virt_viewer_app_get_nth_window() will return the proper window when passed 0 for
the 'nth' argument, so there's no need to avoid calling it in this case.  It
just complicates the code logic.
---
 src/virt-viewer-app.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index e134894..484762e 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -838,20 +838,16 @@ virt_viewer_app_display_added(VirtViewerSession *session G_GNUC_UNUSED,
     gint nth;
 
     g_object_get(display, "nth-display", &nth, NULL);
-    if (nth == 0) {
-        window = priv->main_window;
-    } else {
-        window = virt_viewer_app_get_nth_window(self, nth);
-        if (window == NULL) {
-            if (priv->kiosk) {
-                /* don't show extra monitors that don't fit on client */
-                g_debug("kiosk mode: skip extra monitors that don't fit on client");
-                g_object_unref(display);
-                return;
-            }
-
-            window = virt_viewer_app_window_new(self, nth);
+    window = virt_viewer_app_get_nth_window(self, nth);
+    if (window == NULL) {
+        if (priv->kiosk) {
+            /* don't show extra monitors that don't fit on client */
+            g_debug("kiosk mode: skip extra monitors that don't fit on client");
+            g_object_unref(display);
+            return;
         }
+
+        window = virt_viewer_app_window_new(self, nth);
     }
 
     virt_viewer_window_set_display(window, display);
-- 
1.8.5.3




More information about the virt-tools-list mailing list