From 8776506e3cabba93083438fef1587de915af8113 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 5 Sep 2012 08:49:28 +0200 Subject: add option to kick off virt-viewer --- vconsole.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/vconsole.c b/vconsole.c index 64a96d7..a4f6cad 100644 --- a/vconsole.c +++ b/vconsole.c @@ -231,6 +231,28 @@ static struct vconsole_domain *find_guest(struct vconsole_window *win) return dom; } +static void menu_cb_vm_gfx(GtkAction *action, void *data) +{ + struct vconsole_window *win = data; + struct vconsole_domain *dom = find_guest(win); + char *uri; + + if (!dom) + return; + uri = virConnectGetURI(dom->conn->ptr); + + if (fork() <= 0) { + /* parent */ + free(uri); + return; + } else { + /* child */ + execlp("virt-viewer", "virt-viewer", "-w", "-c", uri, dom->uuid, NULL); + perror("execlp"); + exit(1); + } +} + static void menu_cb_vm_run(GtkAction *action, void *data) { struct vconsole_window *win = data; @@ -294,10 +316,15 @@ static void menu_cb_about(GtkAction *action, gpointer userdata) static void menu_cb_manual(GtkAction *action, gpointer userdata) { - if (fork() <= 0) + if (fork() <= 0) { + /* parent */ return; - /* child */ - execlp("xdg-open", "xdg-open", "man:vconsole(1)", NULL); + } else { + /* child */ + execlp("xdg-open", "xdg-open", "man:vconsole(1)", NULL); + perror("execlp"); + exit(1); + } } /* ------------------------------------------------------------------ */ @@ -381,6 +408,10 @@ static const GtkActionEntry entries[] = { },{ /* --- guest menu --- */ + .name = "GuestGfx", + .label = "Show graphic console", + .callback = G_CALLBACK(menu_cb_vm_gfx), + },{ .name = "GuestRun", .stock_id = GTK_STOCK_MEDIA_PLAY, .label = "Run", @@ -461,6 +492,8 @@ static char ui_xml[] = " \n" " \n" " \n" +" \n" +" \n" " \n" " \n" " \n" -- cgit