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

Daniel P. Berrange berrange at redhat.com
Tue Aug 20 12:31:25 UTC 2013


On Tue, Aug 20, 2013 at 02:19:53PM +0200, Marc-André Lureau wrote:
> 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));


ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list