[virt-tools-list] [virt-viewer][PATCH v2 1/2] virt-viewer-display-vnc: Set guest name when using VNC

Fabiano Fidêncio fabiano at fidencio.org
Wed Apr 29 15:16:09 UTC 2015


On Wed, Apr 29, 2015 at 10:35 AM, Lukas Venhoda <lvenhoda at redhat.com> wrote:
> If it's not already set, set guest name field in virt-viewer-app when using VNC.
>
> Wait for VNC to be initialized (virt_viewer_display_vnc_initialized()).
> In this callback get field guest name from app and check whether it
> was already set before (FE from libvirt).
> If not, set the guest name to name provided by VNC from
> vnc_display_get_name().
>
> This fill fix issue in remote-viewer: Guest name is Unknown when using VNC.
> ---
> Changes since v1:
>  - Added NULL checking for name returned from vnc_display_get_name.
> ---
>  src/virt-viewer-display-vnc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
> index 6605b1b..ad7cec7 100644
> --- a/src/virt-viewer-display-vnc.c
> +++ b/src/virt-viewer-display-vnc.c
> @@ -116,9 +116,23 @@ static void
>  virt_viewer_display_vnc_initialized(VncDisplay *vnc G_GNUC_UNUSED,
>                                      VirtViewerDisplay *display)
>  {
> +    char *name = NULL;

Use gchar instead of char, please.

> +    VirtViewerSession *session = virt_viewer_display_get_session(display);
> +    VirtViewerApp *app = virt_viewer_session_get_app(session);
> +
> +    g_object_get(app, "guest-name", &name, NULL);
> +    if (name == NULL || *name == '\0') {
> +        const char * vnc_name = vnc_display_get_name(vnc);

Same here ...

> +        if (vnc_name != NULL) {
> +            g_object_set(app, "guest-name", vnc_name, NULL);
> +        }
> +    }
> +
>      virt_viewer_display_set_show_hint(display,
>                                        VIRT_VIEWER_DISPLAY_SHOW_HINT_READY, TRUE);
>      g_signal_emit_by_name(display, "display-desktop-resize");
> +
> +    g_free(name);
>  }
>
>  static void
> --
> 2.3.6
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list


Best Regards,
-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list