From eae071f3300937b7444a44e662dd3ccd7da09915 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sun, 29 Oct 2017 16:50:59 +0100 Subject: [PATCH] Rename color_strings to colors This is an antipattern and makes linelength increase for nothing --- src/dbus.c | 6 +++--- src/dunst.h | 2 +- src/notification.c | 18 +++++++++--------- src/notification.h | 2 +- src/rules.c | 4 ++-- src/x11/x.c | 30 +++++++++++++++--------------- src/x11/x.h | 2 +- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/dbus.c b/src/dbus.c index bf9a815..d9b238c 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -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); diff --git a/src/dunst.h b/src/dunst.h index 657cfdd..8667f44 100644 --- a/src/dunst.h +++ b/src/dunst.h @@ -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); diff --git a/src/notification.c b/src/notification.c index 4459c58..ac77052 100644 --- a/src/notification.c +++ b/src/notification.c @@ -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 = diff --git a/src/notification.h b/src/notification.h index 3318016..bffeec1 100644 --- a/src/notification.h +++ b/src/notification.h @@ -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 */ diff --git a/src/rules.c b/src/rules.c index 086c627..da64f9b 100644 --- a/src/rules.c +++ b/src/rules.c @@ -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) diff --git a/src/x11/x.c b/src/x11/x.c index 9a6c23a..ec9e8de 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -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] == '-') { diff --git a/src/x11/x.h b/src/x11/x.h index 1ccd9a3..3b08ca4 100644 --- a/src/x11/x.h +++ b/src/x11/x.h @@ -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;