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

Lukas Venhoda lvenhoda at redhat.com
Wed Apr 29 12:39:29 UTC 2015


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: GUID is Unknown when using VNC.
---
 src/virt-viewer-display-vnc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
index 6605b1b..9121e5f 100644
--- a/src/virt-viewer-display-vnc.c
+++ b/src/virt-viewer-display-vnc.c
@@ -116,9 +116,20 @@ static void
 virt_viewer_display_vnc_initialized(VncDisplay *vnc G_GNUC_UNUSED,
                                     VirtViewerDisplay *display)
 {
+    char *name = NULL;
+    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') {
+        g_object_set(app, "guest-name", vnc_display_get_name(vnc), 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




More information about the virt-tools-list mailing list