aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-08-20 14:44:51 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-08-20 14:44:51 +0200
commit7a7ffc74974ec4c4b2afef762365dfdb4cf59cc2 (patch)
treed5783f88d8fac109e986c6f0ad7a8d05ea768394
parente9b7cd8485539db84d3b37fce828d8c051a0d8a4 (diff)
downloadvconsole-7a7ffc74974ec4c4b2afef762365dfdb4cf59cc2.tar.gz
log option: gui windup
-rw-r--r--domain.c14
-rw-r--r--vconsole.c20
-rw-r--r--vconsole.h2
3 files changed, 36 insertions, 0 deletions
diff --git a/domain.c b/domain.c
index 8215057..b88c00c 100644
--- a/domain.c
+++ b/domain.c
@@ -30,6 +30,9 @@ static void domain_foreach(struct vconsole_window *win,
struct vconsole_domain *dom;
int rc;
+ if (model == NULL)
+ return;
+
rc = gtk_tree_model_get_iter_first(model, &host);
while (rc) {
rc = gtk_tree_model_iter_nth_child(model, &guest, &host, 0);
@@ -65,11 +68,21 @@ static void domain_configure_vte(struct vconsole_domain *dom)
vte_terminal_set_color_background(vte, &bg);
}
+static void domain_configure_logging(struct vconsole_domain *dom)
+{
+ /* TODO */
+}
+
void domain_configure_all_vtes(struct vconsole_window *win)
{
domain_foreach(win, domain_configure_vte);
}
+void domain_configure_all_logging(struct vconsole_window *win)
+{
+ domain_foreach(win, domain_configure_logging);
+}
+
static void domain_update_status(struct vconsole_domain *dom)
{
char line[128];
@@ -378,6 +391,7 @@ void domain_activate(struct vconsole_domain *dom)
gtk_widget_show_all(dom->vbox);
gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), page);
domain_configure_vte(dom);
+ domain_configure_logging(dom);
domain_update_status(dom);
}
diff --git a/vconsole.c b/vconsole.c
index 4451a21..a88e166 100644
--- a/vconsole.c
+++ b/vconsole.c
@@ -302,6 +302,16 @@ static void menu_cb_blink_cursor(GtkToggleAction *action, gpointer userdata)
config_write();
}
+static void menu_cb_vm_logging(GtkToggleAction *action, gpointer userdata)
+{
+ struct vconsole_window *win = userdata;
+
+ win->vm_logging = gtk_toggle_action_get_active(action);
+ domain_configure_all_logging(win);
+ g_key_file_set_boolean(config, "vm", "logging", win->vm_logging);
+ config_write();
+}
+
/* ------------------------------------------------------------------ */
static const GtkActionEntry entries[] = {
@@ -408,6 +418,10 @@ static const GtkToggleActionEntry tentries[] = {
.label = "_Fullscreen",
.accelerator = "F11",
.callback = G_CALLBACK(menu_cb_fullscreen),
+ },{
+ .name = "GuestLogging",
+ .label = "Log to file",
+ .callback = G_CALLBACK(menu_cb_vm_logging),
}
};
@@ -431,6 +445,8 @@ static char ui_xml[] =
" <menuitem action='FullScreen'/>\n"
" </menu>\n"
" <menu action='GuestMenu'>\n"
+" <menuitem action='GuestLogging'/>\n"
+" <separator/>\n"
" <menuitem action='GuestRun'/>\n"
" <menuitem action='GuestPause'/>\n"
" <menuitem action='GuestReboot'/>\n"
@@ -598,6 +614,8 @@ static struct vconsole_window *vconsole_toplevel_create(void)
win->tty_bg = g_key_file_get_string(config, "tty", "background", &err);
err = NULL;
win->tty_blink = g_key_file_get_boolean(config, "tty", "blink", &err);
+ err = NULL;
+ win->vm_logging = g_key_file_get_boolean(config, "vm", "logging", &err);
/* config defaults */
if (!win->tty_font)
@@ -610,6 +628,8 @@ static struct vconsole_window *vconsole_toplevel_create(void)
/* apply config */
item = gtk_ui_manager_get_widget(win->ui, "/MainMenu/ViewMenu/TerminalBlink");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), win->tty_blink);
+ item = gtk_ui_manager_get_widget(win->ui, "/MainMenu/GuestMenu/GuestLogging");
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), win->vm_logging);
return win;
}
diff --git a/vconsole.h b/vconsole.h
index cfa19bd..143aa66 100644
--- a/vconsole.h
+++ b/vconsole.h
@@ -48,6 +48,7 @@ struct vconsole_window {
char *tty_font;
char *tty_fg;
char *tty_bg;
+ gboolean vm_logging;
};
extern int debug;
@@ -85,5 +86,6 @@ void domain_update(struct vconsole_connect *conn,
virDomainPtr d, virDomainEventType event);
void domain_activate(struct vconsole_domain *dom);
void domain_configure_all_vtes(struct vconsole_window *win);
+void domain_configure_all_logging(struct vconsole_window *win);
struct vconsole_domain *domain_find_current_tab(struct vconsole_window *win);
void domain_close_current_tab(struct vconsole_window *win);