Return existing window in app_window_new()

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.
This commit is contained in:
Marc-André Lureau 2013-08-19 19:44:25 +02:00
parent 563067341c
commit cd7b5761af

View File

@ -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));