aboutsummaryrefslogtreecommitdiff
path: root/ui/console.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2015-02-17 10:41:08 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-04-22 13:21:16 +0200
commit779ce88fbd3f977112bc77ccb028b0ace762105e (patch)
tree3d913e151e1c41be977928b6dfc4de603cd99986 /ui/console.c
parentf8c223f69ac58488ea830597281b7ddd33037c4c (diff)
console/gtk: add qemu_console_get_label
Add a new function to get a nice label for a given QemuConsole. Drop the labeling code in gtk.c and use the new function instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/console.c')
-rw-r--r--ui/console.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/console.c b/ui/console.c
index b15ca87f0f..29275136c7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1788,6 +1788,21 @@ bool qemu_console_is_fixedsize(QemuConsole *con)
return con && (con->console_type != TEXT_CONSOLE);
}
+char *qemu_console_get_label(QemuConsole *con)
+{
+ if (con->console_type == GRAPHIC_CONSOLE) {
+ if (con->device) {
+ return g_strdup(object_get_typename(con->device));
+ }
+ return g_strdup("VGA");
+ } else {
+ if (con->chr && con->chr->label) {
+ return g_strdup(con->chr->label);
+ }
+ return g_strdup_printf("vc%d", con->index);
+ }
+}
+
int qemu_console_get_index(QemuConsole *con)
{
if (con == NULL) {