Rename color_strings to colors

This is an antipattern and makes linelength increase for nothing
This commit is contained in:
Benedikt Heine 2017-10-29 16:50:59 +01:00
parent d190af6db1
commit eae071f330
7 changed files with 32 additions and 32 deletions

View File

@ -284,10 +284,10 @@ static void on_notify(GDBusConnection *connection,
n->actions = actions;
for (int i = 0; i < ColLast; i++) {
n->color_strings[i] = NULL;
n->colors[i] = NULL;
}
n->color_strings[ColFG] = fgcolor;
n->color_strings[ColBG] = bgcolor;
n->colors[ColFG] = fgcolor;
n->colors[ColBG] = bgcolor;
notification_init(n);
int id = queues_notification_insert(n, replaces_id);

View File

@ -17,7 +17,7 @@
#define ColBG 0
extern GSList *rules;
extern const char *color_strings[3][3];
extern const char *colors[3][3];
/* return id of notification */
gboolean run(void *data);

View File

@ -40,9 +40,9 @@ void notification_print(notification *n)
printf("\turgency: %s\n", notification_urgency_to_string(n->urgency));
printf("\ttransient: %d\n", n->transient);
printf("\tformatted: '%s'\n", n->msg);
printf("\tfg: %s\n", n->color_strings[ColFG]);
printf("\tbg: %s\n", n->color_strings[ColBG]);
printf("\tframe: %s\n", n->color_strings[ColFrame]);
printf("\tfg: %s\n", n->colors[ColFG]);
printf("\tbg: %s\n", n->colors[ColBG]);
printf("\tframe: %s\n", n->colors[ColFrame]);
printf("\tid: %d\n", n->id);
if (n->urls) {
printf("\turls:\n");
@ -447,16 +447,16 @@ void notification_init(notification *n)
if (n->urgency > URG_MAX)
n->urgency = URG_CRIT;
if (!n->color_strings[ColFG]) {
n->color_strings[ColFG] = xctx.color_strings[ColFG][n->urgency];
if (!n->colors[ColFG]) {
n->colors[ColFG] = xctx.colors[ColFG][n->urgency];
}
if (!n->color_strings[ColBG]) {
n->color_strings[ColBG] = xctx.color_strings[ColBG][n->urgency];
if (!n->colors[ColBG]) {
n->colors[ColBG] = xctx.colors[ColBG][n->urgency];
}
if (!n->color_strings[ColFrame]) {
n->color_strings[ColFrame] = xctx.color_strings[ColFrame][n->urgency];
if (!n->colors[ColFrame]) {
n->colors[ColFrame] = xctx.colors[ColFrame][n->urgency];
}
n->timeout =

View File

@ -55,7 +55,7 @@ typedef struct _notification {
enum markup_mode markup;
const char *format;
const char *color_strings[3];
const char *colors[3];
const char *script;
/* Hints */

View File

@ -29,9 +29,9 @@ void rule_apply(rule_t *r, notification *n)
n->raw_icon = NULL;
}
if (r->fg)
n->color_strings[ColFG] = r->fg;
n->colors[ColFG] = r->fg;
if (r->bg)
n->color_strings[ColBG] = r->bg;
n->colors[ColBG] = r->bg;
if (r->format)
n->format = r->format;
if (r->script)

View File

@ -468,9 +468,9 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
cl->icon = NULL;
}
cl->fg = x_string_to_color_t(n->color_strings[ColFG]);
cl->bg = x_string_to_color_t(n->color_strings[ColBG]);
cl->frame = x_string_to_color_t(n->color_strings[ColFrame]);
cl->fg = x_string_to_color_t(n->colors[ColFG]);
cl->bg = x_string_to_color_t(n->colors[ColBG]);
cl->frame = x_string_to_color_t(n->colors[ColFrame]);
cl->n = n;
@ -985,26 +985,26 @@ void x_setup(void)
x_shortcut_grab(&settings.context_ks);
x_shortcut_ungrab(&settings.context_ks);
xctx.color_strings[ColFG][URG_LOW] = settings.lowfgcolor;
xctx.color_strings[ColFG][URG_NORM] = settings.normfgcolor;
xctx.color_strings[ColFG][URG_CRIT] = settings.critfgcolor;
xctx.colors[ColFG][URG_LOW] = settings.lowfgcolor;
xctx.colors[ColFG][URG_NORM] = settings.normfgcolor;
xctx.colors[ColFG][URG_CRIT] = settings.critfgcolor;
xctx.color_strings[ColBG][URG_LOW] = settings.lowbgcolor;
xctx.color_strings[ColBG][URG_NORM] = settings.normbgcolor;
xctx.color_strings[ColBG][URG_CRIT] = settings.critbgcolor;
xctx.colors[ColBG][URG_LOW] = settings.lowbgcolor;
xctx.colors[ColBG][URG_NORM] = settings.normbgcolor;
xctx.colors[ColBG][URG_CRIT] = settings.critbgcolor;
if (settings.lowframecolor)
xctx.color_strings[ColFrame][URG_LOW] = settings.lowframecolor;
xctx.colors[ColFrame][URG_LOW] = settings.lowframecolor;
else
xctx.color_strings[ColFrame][URG_LOW] = settings.frame_color;
xctx.colors[ColFrame][URG_LOW] = settings.frame_color;
if (settings.normframecolor)
xctx.color_strings[ColFrame][URG_NORM] = settings.normframecolor;
xctx.colors[ColFrame][URG_NORM] = settings.normframecolor;
else
xctx.color_strings[ColFrame][URG_NORM] = settings.frame_color;
xctx.colors[ColFrame][URG_NORM] = settings.frame_color;
if (settings.critframecolor)
xctx.color_strings[ColFrame][URG_CRIT] = settings.critframecolor;
xctx.colors[ColFrame][URG_CRIT] = settings.critframecolor;
else
xctx.color_strings[ColFrame][URG_CRIT] = settings.frame_color;
xctx.colors[ColFrame][URG_CRIT] = settings.frame_color;
/* parse and set xctx.geometry and monitor position */
if (settings.geom[0] == '-') {

View File

@ -28,7 +28,7 @@ typedef struct _xctx {
Window win;
bool visible;
dimension_t geometry;
const char *color_strings[3][3];
const char *colors[3][3];
XScreenSaverInfo *screensaver_info;
dimension_t window_dim;
unsigned long sep_custom_col;