diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-05 08:49:28 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-05 08:49:28 +0200 |
commit | 8776506e3cabba93083438fef1587de915af8113 (patch) | |
tree | c8dc4f7a65ba27d706055bb0fa1544fe5c7b8fc6 | |
parent | e52524bd0ed1467d64728417244033316fa21fdb (diff) | |
download | vconsole-8776506e3cabba93083438fef1587de915af8113.tar.gz |
add option to kick off virt-viewer
-rw-r--r-- | vconsole.c | 39 |
1 files changed, 36 insertions, 3 deletions
@@ -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[] = " <menu action='GuestMenu'>\n" " <menuitem action='GuestLogging'/>\n" " <separator/>\n" +" <menuitem action='GuestGfx'/>\n" +" <separator/>\n" " <menuitem action='GuestRun'/>\n" " <menuitem action='GuestPause'/>\n" " <menuitem action='GuestReboot'/>\n" |