gboolean command_close(const Arg* arg)
{
- vp_clean_up();
gtk_main_quit();
+ vp_clean_up();
return TRUE;
}
#define START_PAGE "http://sourceforge.net/apps/trac/vimprobable"
-#define STATUS_BG_COLOR "#000000" /* background color for status bar */
-#define STATUS_FG_COLOR "#ffffff" /* foreground color for status bar */
-#define STATUS_BAR_FONT "monospace bold 8"
-
/* normal error */
const char *inputbox_font[2] = { "monospace normal 8", "monospace bold 8"};
const char *inputbox_fg[2] = { "#000000", "#000000" };
{
gchar* markup;
- markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", STATUS_BAR_FONT, uri);
+ markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", vp.config.status_font, uri);
gtk_label_set_markup(GTK_LABEL(vp.gui.statusbar.left), markup);
g_free(markup);
}
g_string_append_printf(status, " %d%%", val);
}
- markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", STATUS_BAR_FONT, status->str);
+ markup = g_markup_printf_escaped("<span font=\"%s\">%s</span>", vp.config.status_font, status->str);
gtk_label_set_markup(GTK_LABEL(vp.gui.statusbar.right), markup);
g_free(markup);
}
static void vp_init_gui(void)
{
Gui* gui = &vp.gui;
- GdkColor bg, fg;
gui->sb_h = GTK_SCROLLBAR(gtk_hscrollbar_new(NULL));
gui->sb_v = GTK_SCROLLBAR(gtk_vscrollbar_new(NULL));
/* Prepare the event box */
gui->eventbox = gtk_event_box_new();
- gdk_color_parse(STATUS_BG_COLOR, &bg);
- gdk_color_parse(STATUS_FG_COLOR, &fg);
- gtk_widget_modify_bg(gui->eventbox, GTK_STATE_NORMAL, &bg);
- gtk_widget_modify_fg(gui->eventbox, GTK_STATE_NORMAL, &fg);
vp_setup_signals();
gtk_misc_set_alignment(GTK_MISC(gui->statusbar.right), 1.0, 0.0);
gtk_box_pack_start(gui->statusbar.box, gui->statusbar.left, TRUE, TRUE, 2);
gtk_box_pack_start(gui->statusbar.box, gui->statusbar.right, FALSE, FALSE, 2);
- gtk_widget_modify_bg(GTK_WIDGET(gui->statusbar.left), GTK_STATE_NORMAL, &bg);
- gtk_widget_modify_fg(GTK_WIDGET(gui->statusbar.left), GTK_STATE_NORMAL, &fg);
- gtk_widget_modify_bg(GTK_WIDGET(gui->statusbar.right), GTK_STATE_NORMAL, &bg);
- gtk_widget_modify_fg(GTK_WIDGET(gui->statusbar.right), GTK_STATE_NORMAL, &fg);
gtk_box_pack_start(gui->box, gui->viewport, TRUE, TRUE, 0);
gtk_box_pack_start(gui->box, gui->eventbox, FALSE, FALSE, 0);
typedef struct {
time_t cookie_timeout;
gint scrollstep;
+ gchar* status_color_bg;
+ gchar* status_color_fg;
+ gchar* status_font;
} Config;
/* core struct */
static gboolean setting_webkit(const Setting* s);
static gboolean setting_cookie_timeout(const Setting* s);
static gboolean setting_scrollstep(const Setting* s);
+static gboolean setting_status_color_bg(const Setting* s);
+static gboolean setting_status_color_fg(const Setting* s);
+static gboolean setting_status_font(const Setting* s);
static Setting default_settings[] = {
/* webkit settings */
/* internal variables */
{"cookie-timeout", TYPE_INTEGER, setting_cookie_timeout, {.i = 4800}},
{"scrollstep", TYPE_INTEGER, setting_scrollstep, {.i = 40}},
+ {"status-color-bg", TYPE_CHAR, setting_status_color_bg, {.s = "#000"}},
+ {"status-color-fg", TYPE_CHAR, setting_status_color_fg, {.s = "#fff"}},
+ {"status-font", TYPE_CHAR, setting_status_font, {.s = "monospace bold 8"}},
};
static GHashTable* settings = NULL;
static gboolean setting_scrollstep(const Setting* s)
{
- PRINT_DEBUG("Set scrollstep to %d", s->arg.i);
vp.config.scrollstep = s->arg.i;
return TRUE;
}
+
+static gboolean setting_status_color_bg(const Setting* s)
+{
+ GdkColor color;
+
+ gdk_color_parse(s->arg.s, &color);
+ gtk_widget_modify_bg(vp.gui.eventbox, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_bg(GTK_WIDGET(vp.gui.statusbar.left), GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_bg(GTK_WIDGET(vp.gui.statusbar.right), GTK_STATE_NORMAL, &color);
+
+ return TRUE;
+}
+
+static gboolean setting_status_color_fg(const Setting* s)
+{
+ GdkColor color;
+
+ gdk_color_parse(s->arg.s, &color);
+ gtk_widget_modify_fg(vp.gui.eventbox, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_fg(GTK_WIDGET(vp.gui.statusbar.left), GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_fg(GTK_WIDGET(vp.gui.statusbar.right), GTK_STATE_NORMAL, &color);
+
+ return TRUE;
+}
+
+static gboolean setting_status_font(const Setting* s)
+{
+ if (vp.config.status_font) {
+ g_free(vp.config.status_font);
+ }
+ vp.config.status_font = g_strdup(s->arg.s);
+
+ /* update status bar to apply changed settings */
+ vp_update_statusbar();
+ vp_update_urlbar();
+
+ return TRUE;
+}