aboutsummaryrefslogtreecommitdiffstats
path: root/vconsole.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-08-15 23:45:18 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-08-15 23:45:18 +0200
commit3ab79ed743f5574c3f9120c2892d377128e2d7bc (patch)
tree056095b2de19a76dd6c1566f18db9821530e6245 /vconsole.c
parent98f99f5f4b7760010922041d92bf1d17cefd151d (diff)
downloadvconsole-3ab79ed743f5574c3f9120c2892d377128e2d7bc.tar.gz
start guest menu/toolbar item
Diffstat (limited to 'vconsole.c')
-rw-r--r--vconsole.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/vconsole.c b/vconsole.c
index 8fcd3de..4a30ffe 100644
--- a/vconsole.c
+++ b/vconsole.c
@@ -198,6 +198,28 @@ static void menu_cb_config_bg(GtkAction *action, void *data)
domain_configure_all_vtes(win);
}
+static struct vconsole_domain *find_guest(struct vconsole_window *win)
+{
+ struct vconsole_domain *dom;
+
+ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)) == 0) {
+ fprintf(stderr, "%s: [ TODO ] figure list selected guest\n", __func__);
+ dom = NULL;
+ } else {
+ dom = domain_find_current_tab(win);
+ }
+ return dom;
+}
+
+static void menu_cb_vm_run(GtkAction *action, void *data)
+{
+ struct vconsole_window *win = data;
+ struct vconsole_domain *dom = find_guest(win);
+
+ if (dom)
+ domain_start(dom);
+}
+
static void menu_cb_about(GtkAction *action, gpointer userdata)
{
static char *comments = "virtual machine console";
@@ -237,6 +259,9 @@ static const GtkActionEntry entries[] = {
.name = "ViewMenu",
.label = "_View",
},{
+ .name = "GuestMenu",
+ .label = "_Guest",
+ },{
.name = "HelpMenu",
.label = "_Help",
},{
@@ -280,6 +305,13 @@ static const GtkActionEntry entries[] = {
.callback = G_CALLBACK(menu_cb_config_bg),
},{
+ /* --- guest menu --- */
+ .name = "GuestRun",
+ .stock_id = GTK_STOCK_MEDIA_PLAY,
+ .label = "Start",
+ .callback = G_CALLBACK(menu_cb_vm_run),
+
+ },{
/* --- help menu --- */
.name = "About",
.stock_id = GTK_STOCK_ABOUT,
@@ -313,10 +345,16 @@ static char ui_xml[] =
" <menuitem action='TerminalBackground'/>\n"
" <menuitem action='TerminalBlink'/>\n"
" </menu>\n"
+" <menu action='GuestMenu'>\n"
+" <menuitem action='GuestRun'/>\n"
+" </menu>\n"
" <menu action='HelpMenu'>\n"
" <menuitem action='About'/>\n"
" </menu>\n"
" </menubar>\n"
+" <toolbar action='ToolBar'>"
+" <toolitem action='GuestRun'/>\n"
+" </toolbar>\n"
"</ui>\n";
static char recent_xml[] =