[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH virt-viewer 19/19] Show status page by default if display not ready



On Mon, Jul 16, 2012 at 06:57:54PM +0200, Marc-André Lureau wrote:
> GtkNotebook will use the currently visible widget as default page.
> If we don't show status widget before we append the display, the
> current page will be on display. Quoting Gtk+ documentation:
> 
> "Note that due to historical reasons, GtkNotebook refuses to switch to
> a page unless the child widget is visible. Therefore, it is
> recommended to show child widgets before adding them to a notebook."

ACK for the first hunk, the second hunk seems to be unrelated to the change
described here.

Christophe

> ---
>  src/virt-viewer-notebook.c |    1 +
>  src/virt-viewer-window.c   |    6 +++++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
> index 09e8ec4..cc7136b 100644
> --- a/src/virt-viewer-notebook.c
> +++ b/src/virt-viewer-notebook.c
> @@ -86,6 +86,7 @@ virt_viewer_notebook_init (VirtViewerNotebook *self)
>      priv->status = gtk_label_new("");
>      gtk_notebook_set_show_tabs(GTK_NOTEBOOK(self), FALSE);
>      gtk_notebook_set_show_border(GTK_NOTEBOOK(self), FALSE);
> +    gtk_widget_show_all(priv->status);
>      gtk_notebook_append_page(GTK_NOTEBOOK(self), priv->status, NULL);
>      gdk_color_parse("white", &color);
>      gtk_widget_modify_fg(priv->status, GTK_STATE_NORMAL, &color);
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 4bc427a..7c6e41f 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -1040,8 +1040,12 @@ virt_viewer_window_set_display(VirtViewerWindow *self, VirtViewerDisplay *displa
>          virt_viewer_display_set_zoom_level(VIRT_VIEWER_DISPLAY(priv->display), priv->zoomlevel);
>          virt_viewer_display_set_auto_resize(VIRT_VIEWER_DISPLAY(priv->display), priv->auto_resize);
>  
> -        gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), GTK_WIDGET(display), NULL);
>          gtk_widget_show_all(GTK_WIDGET(display));
> +        gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), GTK_WIDGET(display), NULL);
> +        /* switch back to non-display if not ready */
> +        if (!(virt_viewer_display_get_show_hint(display) &
> +              VIRT_VIEWER_DISPLAY_SHOW_HINT_READY))
> +            gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook), 0);
>  
>          virt_viewer_signal_connect_object(display, "display-pointer-grab",
>                                            G_CALLBACK(virt_viewer_window_pointer_grab), self, 0);
> -- 
> 1.7.10.4
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list redhat com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: pgp3ia0198ZZd.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]