Blob Blame History Raw
From 4c253ab87dff0ce65071a36fd1b79b617567f1d8 Mon Sep 17 00:00:00 2001
From: Pavel Grunt <pgrunt@redhat.com>
Date: Mon, 2 Jan 2017 16:32:31 +0100
Subject: [PATCH 03/26] Set guest name at the same time as uuid

Avoid showing the "Unknown" name in the guest detail dialog when
waiting for the domain to be started.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
---
 src/virt-viewer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 3a3b64d..1121146 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -601,8 +601,6 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom, GError **error)
     virt_viewer_app_trace(app, "Guest %s is running, determining display",
                           priv->domkey);
 
-    g_object_set(app, "guest-name", virDomainGetName(dom), NULL);
-
     if (virt_viewer_app_has_session(app))
         return TRUE;
 
@@ -801,6 +799,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
     VirtViewer *self = VIRT_VIEWER(app);
     VirtViewerPrivate *priv = self->priv;
     char uuid_string[VIR_UUID_STRING_BUFLEN];
+    const char *guest_name;
     GError *err = NULL;
 
     g_debug("initial connect");
@@ -836,6 +835,10 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
     } else {
         g_object_set(app, "uuid", uuid_string, NULL);
     }
+    guest_name = virDomainGetName(dom);
+    if (guest_name != NULL) {
+        g_object_set(app, "guest-name", guest_name, NULL);
+    }
 
     virt_viewer_app_show_status(app, _("Checking guest domain status"));
     if (virDomainGetInfo(dom, &info) < 0) {
-- 
2.12.0