diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.def.h | 34 | ||||
-rw-r--r-- | src/main.c | 19 |
2 files changed, 32 insertions, 21 deletions
diff --git a/src/config.def.h b/src/config.def.h index fd70a51..772282c 100644 --- a/src/config.def.h +++ b/src/config.def.h @@ -91,13 +91,27 @@ #define SETTING_HINT_KEYS "0123456789" -/* These are the three settings displayed when "status-bar-show-settings" is enabled - * With booleans, please use GET_BOOL and append ( ? "on" : "off" ) - * With integers, you could just print the value and use GET_INT - * Strings do not need any additional modifications, use GET_CHAR */ -#define STATUS_NAME1 "js" -#define STATUS_TYPE1 GET_BOOL(c, "scripts") ? "on" : "off" -#define STATUS_NAME2 "cookies" -#define STATUS_TYPE2 GET_CHAR(c, "cookie-accept") -#define STATUS_NAME3 "storage" -#define STATUS_TYPE3 GET_BOOL(c, "html5-local-storage") ? "on" : "off" +/* This status indicator is only shown if "status-bar-show-settings" is + * enabled. + * The CHAR_MAP(value, internalValue, outputValue, valueIfNotMapped) is a + * little workaround to translate internal used string value like for + * GET_CHAR(c, "cookie-accept") which is one of "always", "origin" or "never" + * to those values that should be shown on statusbar. + * The STATUS_VARAIBLE_SHOW is used as argument for a printf like function. So + * the first argument is the output pattern. */ +/* +#define STATUS_VARAIBLE_SHOW "js: %s, cookies: %s, hint-timeout: %d", \ + GET_BOOL(c, "scripts") ? "on" : "off", \ + GET_CHAR(c, "cookie-accept"), \ + GET_INT(c, "hint-timeout") +*/ +#define COOKIE GET_CHAR(c, "cookie-accept") +#define STATUS_VARAIBLE_SHOW "%c%c%c%c%c%c%c%c", \ + CHAR_MAP(COOKIE, "always", 'A', CHAR_MAP(COOKIE, "origin", '@', 'a')), \ + GET_BOOL(c, "dark-mode") ? 'D' : 'd', \ + vb.incognito ? 'E' : 'e', \ + GET_BOOL(c, "images") ? 'I' : 'i', \ + GET_BOOL(c, "html5-local-storage") ? 'L' : 'l', \ + GET_BOOL(c, "stylesheet") ? 'M' : 'm', \ + GET_BOOL(c, "scripts") ? 'S' : 's', \ + GET_BOOL(c, "strict-ssl") ? 'T' : 't' @@ -631,21 +631,18 @@ void vb_statusbar_update(Client *c) statusbar_update_downloads(c, status); - /** - * These architectures have different kinds of issues with scroll - * percentage, this is a somewhat clean fix that doesn't affect others. - */ + /* These architectures have different kinds of issues with scroll + * percentage, this is a somewhat clean fix that doesn't affect others. */ #if defined(_ARCH_PPC64) || defined(_ARCH_PPC) | defined(_ARCH_ARM) - /* force the scroll percent to be 16-bit */ - c->state.scroll_percent = * (guint16*) ( &c->state.scroll_percent ); + /* force the scroll percent to be 16-bit */ + c->state.scroll_percent = *(guint16*)(&c->state.scroll_percent); #endif - if ( c->config.statusbar_show_settings ) { - /* show 3 user defined variables on statusbar. can add more by using same template */ - g_string_append_printf(status, " %s: %s |", STATUS_NAME1, STATUS_TYPE1 ); - g_string_append_printf(status, " %s: %s |", STATUS_NAME2, STATUS_TYPE2 ); - g_string_append_printf(status, " %s: %s |", STATUS_NAME3, STATUS_TYPE3 ); +#ifdef STATUS_VARAIBLE_SHOW + if (c->config.statusbar_show_settings) { + g_string_append_printf(status, STATUS_VARAIBLE_SHOW); } +#endif /* show the scroll status */ if (c->state.scroll_max == 0) { |