[virt-tools-list] [PATCH virt-viewer] VirtViewerDisplayVnc: set 'session' property

Fabiano Fidêncio fidencio at redhat.com
Wed Sep 3 22:09:16 UTC 2014


On Wed, 2014-09-03 at 17:03 -0500, Jonathon Jongsma wrote:
> Set the display's session property in the constructor. If the session is
> not set, then virt_viewer_display_get_session() doesn't return anything
> useful.
> ---
> 
> The previous patchset also introduced a regression when connecting to vnc
> servers. I was relying on virt_viewer_display_get_session() to return the
> display's session, but it turns out that VNC displays never had the session
> set. So I've included the session as a constructor argument (similar to the
> spice display) so that the session property gets set as expected.
> 
>  src/virt-viewer-display-vnc.c | 5 +++--
>  src/virt-viewer-display-vnc.h | 3 ++-
>  src/virt-viewer-session-vnc.c | 4 ++--
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
> index 8bf7b80..1f7c11b 100644
> --- a/src/virt-viewer-display-vnc.c
> +++ b/src/virt-viewer-display-vnc.c
> @@ -165,11 +165,12 @@ virt_viewer_display_vnc_resize_desktop(VncDisplay *vnc G_GNUC_UNUSED,
>  
> 
>  GtkWidget *
> -virt_viewer_display_vnc_new(VncDisplay *vnc)
> +virt_viewer_display_vnc_new(VirtViewerSessionVnc *session,
> +                            VncDisplay *vnc)
>  {
>      VirtViewerDisplayVnc *display;
>  
> -    display = g_object_new(VIRT_VIEWER_TYPE_DISPLAY_VNC, NULL);
> +    display = g_object_new(VIRT_VIEWER_TYPE_DISPLAY_VNC, "session", session, NULL);
>  
>      g_object_ref(vnc);
>      display->priv->vnc = vnc;
> diff --git a/src/virt-viewer-display-vnc.h b/src/virt-viewer-display-vnc.h
> index 7020437..0b50563 100644
> --- a/src/virt-viewer-display-vnc.h
> +++ b/src/virt-viewer-display-vnc.h
> @@ -28,6 +28,7 @@
>  #include <vncdisplay.h>
>  
>  #include "virt-viewer-display.h"
> +#include "virt-viewer-session-vnc.h"
>  
>  G_BEGIN_DECLS
>  
> @@ -64,7 +65,7 @@ struct _VirtViewerDisplayVncClass {
>  
>  GType virt_viewer_display_vnc_get_type(void);
>  
> -GtkWidget* virt_viewer_display_vnc_new(VncDisplay *display);
> +GtkWidget* virt_viewer_display_vnc_new(VirtViewerSessionVnc *session, VncDisplay *display);
>  
>  G_END_DECLS
>  
> diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
> index e2f90f2..7c31f87 100644
> --- a/src/virt-viewer-session-vnc.c
> +++ b/src/virt-viewer-session-vnc.c
> @@ -98,7 +98,7 @@ static void
>  virt_viewer_session_vnc_connected(VncDisplay *vnc G_GNUC_UNUSED,
>                                    VirtViewerSessionVnc *session)
>  {
> -    GtkWidget *display = virt_viewer_display_vnc_new(session->priv->vnc);
> +    GtkWidget *display = virt_viewer_display_vnc_new(session, session->priv->vnc);
>      g_signal_emit_by_name(session, "session-connected");
>      virt_viewer_session_add_display(VIRT_VIEWER_SESSION(session),
>                                      VIRT_VIEWER_DISPLAY(display));
> @@ -111,7 +111,7 @@ virt_viewer_session_vnc_disconnected(VncDisplay *vnc G_GNUC_UNUSED,
>      GtkWidget *display;
>  
>      virt_viewer_session_clear_displays(VIRT_VIEWER_SESSION(session));
> -    display = virt_viewer_display_vnc_new(session->priv->vnc);
> +    display = virt_viewer_display_vnc_new(session, session->priv->vnc);
>      g_debug("Disconnected");
>      g_signal_emit_by_name(session, "session-disconnected", NULL);
>      virt_viewer_display_set_show_hint(VIRT_VIEWER_DISPLAY(display),

ACK!




More information about the virt-tools-list mailing list