Set window title to VM name

The attached patch address an issue with virt-view not setting the
titlebar text to be the title of the VM (previously discussed on:
https://www.redhat.com/archives/virt-tools-list/2018-September/msg00064.html).
This commit is contained in:
Ben Mathews 2018-11-19 03:29:45 +00:00 committed by Christophe Fergeau
parent 49e219335b
commit 564b03e3d6

View File

@ -875,6 +875,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
VirtViewerPrivate *priv = self->priv;
char uuid_string[VIR_UUID_STRING_BUFLEN];
const char *guest_name;
char *title;
GError *err = NULL;
g_debug("initial connect");
@ -915,6 +916,12 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
g_object_set(app, "guest-name", guest_name, NULL);
}
title = virDomainGetMetadata(dom, VIR_DOMAIN_METADATA_TITLE, NULL, 0);
if (title != NULL) {
g_object_set(app, "title", title, NULL);
free(title);
}
virt_viewer_app_show_status(app, _("Checking guest domain status"));
if (virDomainGetInfo(dom, &info) < 0) {
g_set_error_literal(&err, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,