[virt-tools-list] [PATCHv3 virt-viewer 03/12] Return existing window in app_window_new()

Marc-André Lureau marcandre.lureau at gmail.com
Tue Aug 20 12:19:53 UTC 2013


Since the returned window is weak, it can already returns existing
windows (instead of creating one and failing to insert).

This allows the following set_kiosk() function to create a main window
before the app constructor is called.
---
 src/virt-viewer-app.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 06a443b..bb502bc 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -658,6 +658,10 @@ virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
     VirtViewerWindow* window;
     GtkWindow *w;
 
+    window = virt_viewer_app_get_nth_window(self, nth);
+    if (window)
+        return window;
+
     window = g_object_new(VIRT_VIEWER_TYPE_WINDOW, "app", self, NULL);
     if (self->priv->main_window)
         virt_viewer_window_set_zoom_level(window, virt_viewer_window_get_zoom_level(self->priv->main_window));
-- 
1.8.3.rc1.49.g8d97506




More information about the virt-tools-list mailing list