From: Daniel Carl Date: Sat, 5 Jan 2013 14:19:23 +0000 (+0100) Subject: Use pointer to char for the hint colors too. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=003b7009b2d6fb260b7f08bfd813170735e65589;p=vimb.git Use pointer to char for the hint colors too. --- diff --git a/src/main.h b/src/main.h index 2ce3bee..54bf697 100644 --- a/src/main.h +++ b/src/main.h @@ -74,8 +74,6 @@ #define VP_WIDGET_OVERRIDE_FONT gtk_widget_modify_font #endif -#define HEX_COLOR_LEN 8 - /* enums */ typedef enum _vp_mode { VP_MODE_NORMAL = 1<<0, @@ -242,9 +240,9 @@ typedef struct { VpColor comp_bg[VP_COMP_LAST]; PangoFontDescription* comp_font[VP_COMP_LAST]; /* hint style */ - gchar hint_bg[HEX_COLOR_LEN]; - gchar hint_bg_focus[HEX_COLOR_LEN]; - gchar hint_fg[HEX_COLOR_LEN]; + gchar* hint_bg; + gchar* hint_bg_focus; + gchar* hint_fg; gchar* hint_style; /* status bar */ VpColor status_bg[VP_STATUS_LAST]; diff --git a/src/setting.c b/src/setting.c index 65f2329..36621e6 100644 --- a/src/setting.c +++ b/src/setting.c @@ -85,7 +85,6 @@ static Setting default_settings[] = { {NULL, "cookie-timeout", TYPE_INTEGER, setting_cookie_timeout, {.i = 4800}}, {NULL, "scrollstep", TYPE_INTEGER, setting_scrollstep, {.i = 40}}, - /* TODO set type to color */ {NULL, "status-color-bg", TYPE_CHAR, setting_status_color_bg, {.s = "#000"}}, {NULL, "status-color-fg", TYPE_CHAR, setting_status_color_fg, {.s = "#fff"}}, {NULL, "status-font", TYPE_FONT, setting_status_font, {.s = "monospace bold 8"}}, @@ -491,24 +490,21 @@ static gboolean setting_hint_style(const Setting* s, const gboolean get) if (get) { setting_print_value(s, style->hint_bg); } else { - strncpy(style->hint_bg, s->arg.s, HEX_COLOR_LEN - 1); - style->hint_bg[HEX_COLOR_LEN - 1] = '\0'; + OVERWRITE_STRING(style->hint_bg, s->arg.s) } } else if (!g_strcmp0(s->name, "hint-bg-focus")) { if (get) { setting_print_value(s, style->hint_bg_focus); } else { - strncpy(style->hint_bg_focus, s->arg.s, HEX_COLOR_LEN - 1); - style->hint_bg_focus[HEX_COLOR_LEN - 1] = '\0'; + OVERWRITE_STRING(style->hint_bg_focus, s->arg.s) } } else if (!g_strcmp0(s->name, "hint-fg")) { if (get) { - setting_print_value(s, style->hint_bg_focus); + setting_print_value(s, style->hint_fg); } else { - strncpy(style->hint_fg, s->arg.s, HEX_COLOR_LEN - 1); - style->hint_fg[HEX_COLOR_LEN - 1] = '\0'; + OVERWRITE_STRING(style->hint_fg, s->arg.s) } - } else if (!g_strcmp0(s->name, "hint-style")) { + } else { if (get) { setting_print_value(s, style->hint_style); } else {