From: Daniel Carl Date: Fri, 19 Sep 2014 20:02:33 +0000 (+0200) Subject: Allow to hide the statusbar. X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=3d2a66cff8f4e24a2f4c8d6a58cbe0f167f61742;p=vimb.git Allow to hide the statusbar. --- diff --git a/doc/vimb.1 b/doc/vimb.1 index e771289..c65abf9 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -1088,6 +1088,9 @@ Indicates if the environment variable `http_proxy' is evaluated. .B scrollstep (int) Number of pixel vimb scrolls if 'j' or 'k' is used. .TP +.B statusbar (bool) +Indicates if the statusbar should be shown. +.TP .B status-color-bg (color) Background color of the statusbar. .TP diff --git a/src/main.c b/src/main.c index d19dde9..27eb08b 100644 --- a/src/main.c +++ b/src/main.c @@ -290,8 +290,13 @@ static void wget_bar(int len, int progress, char *string) void vb_update_statusbar() { int max, val, num; - GString *status = g_string_new(""); + GString *status; + if (!gtk_widget_get_visible(GTK_WIDGET(vb.gui.statusbar.box))) { + return; + } + + status = g_string_new(""); /* show the active downloads */ if (vb.state.downloads) { num = g_list_length(vb.state.downloads); diff --git a/src/setting.c b/src/setting.c index 9cc1f9c..be0efcb 100644 --- a/src/setting.c +++ b/src/setting.c @@ -64,6 +64,7 @@ static int pagecache(const char *name, int type, void *value, void *data); static int soup(const char *name, int type, void *value, void *data); static int internal(const char *name, int type, void *value, void *data); static int input_color(const char *name, int type, void *value, void *data); +static int statusbar(const char *name, int type, void *value, void *data); static int status_color(const char *name, int type, void *value, void *data); static int input_font(const char *name, int type, void *value, void *data); static int status_font(const char *name, int type, void *value, void *data); @@ -165,6 +166,7 @@ void setting_init() setting_add("strict-focus", TYPE_BOOLEAN, &off, internal, 0, &vb.config.strict_focus); i = 40; setting_add("scrollstep", TYPE_INTEGER, &i, internal, 0, &vb.config.scrollstep); + setting_add("statusbar", TYPE_BOOLEAN, &on, statusbar, 0, NULL); setting_add("status-color-bg", TYPE_COLOR, &"#000000", status_color, 0, &vb.style.status_bg[VB_STATUS_NORMAL]); setting_add("status-color-fg", TYPE_COLOR, &"#ffffff", status_color, 0, &vb.style.status_fg[VB_STATUS_NORMAL]); setting_add("status-font", TYPE_FONT, &SETTING_GUI_FONT_EMPH, status_font, 0, &vb.style.status_font[VB_STATUS_NORMAL]); @@ -598,6 +600,13 @@ static int input_color(const char *name, int type, void *value, void *data) return SETTING_OK; } +static int statusbar(const char *name, int type, void *value, void *data) +{ + gtk_widget_set_visible(GTK_WIDGET(vb.gui.statusbar.box), *(gboolean*)value); + + return SETTING_OK; +} + static int status_color(const char *name, int type, void *value, void *data) { VB_COLOR_PARSE((VbColor*)data, (char*)value);