aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukasz Marcinowski <lukasz.marcinowski@nokia.com>2017-02-15 14:34:57 +0100
committerLukasz Marcinowski <lukasz.marcinowski@gmail.com>2017-03-22 19:56:00 +0100
commit91bc302acfebea5aec70513401fec2b5d0f57a87 (patch)
tree146286502166ce8d4c30bed162f6251148544f6c /src
parentf1a5d12950301d762c3a2465c768676730229eab (diff)
downloadprofani-tty-91bc302acfebea5aec70513401fec2b5d0f57a87.tar.gz
Add theme option for time in a status bar
Diffstat (limited to 'src')
-rw-r--r--src/config/theme.c3
-rw-r--r--src/config/theme.h1
-rw-r--r--src/ui/console.c1
-rw-r--r--src/ui/statusbar.c3
4 files changed, 8 insertions, 0 deletions
diff --git a/src/config/theme.c b/src/config/theme.c
index 2d418f73..5a44e370 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -104,6 +104,7 @@ theme_init(const char *const theme_name)
g_hash_table_insert(defaults, strdup("statusbar.brackets"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("statusbar.active"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("statusbar.new"), strdup("white"));
+ g_hash_table_insert(defaults, strdup("statusbar.time"), strdup("white"));
g_hash_table_insert(defaults, strdup("me"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("them"), strdup("green"));
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
@@ -755,6 +756,7 @@ theme_attrs(theme_item_t attrs)
case THEME_STATUS_BRACKET: _theme_prep_fgnd("statusbar.brackets", lookup_str, &bold); break;
case THEME_STATUS_ACTIVE: _theme_prep_fgnd("statusbar.active", lookup_str, &bold); break;
case THEME_STATUS_NEW: _theme_prep_fgnd("statusbar.new", lookup_str, &bold); break;
+ case THEME_STATUS_TIME: _theme_prep_fgnd("statusbar.time", lookup_str, &bold); break;
case THEME_ME: _theme_prep_fgnd("me", lookup_str, &bold); break;
case THEME_THEM: _theme_prep_fgnd("them", lookup_str, &bold); break;
case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", lookup_str, &bold); break;
@@ -843,6 +845,7 @@ theme_attrs(theme_item_t attrs)
case THEME_STATUS_BRACKET:
case THEME_STATUS_ACTIVE:
case THEME_STATUS_NEW:
+ case THEME_STATUS_TIME:
_theme_prep_bgnd("statusbar", "blue", lookup_str);
break;
default:
diff --git a/src/config/theme.h b/src/config/theme.h
index 6e9d13eb..747eace1 100644
--- a/src/config/theme.h
+++ b/src/config/theme.h
@@ -69,6 +69,7 @@ typedef enum {
THEME_STATUS_BRACKET,
THEME_STATUS_ACTIVE,
THEME_STATUS_NEW,
+ THEME_STATUS_TIME,
THEME_ME,
THEME_THEM,
THEME_ROOMINFO,
diff --git a/src/ui/console.c b/src/ui/console.c
index 64f44c52..4c24b450 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -2224,6 +2224,7 @@ cons_theme_properties(void)
_cons_theme_bar_prop(THEME_STATUS_BRACKET, "statusbar.brackets");
_cons_theme_bar_prop(THEME_STATUS_ACTIVE, "statusbar.active");
_cons_theme_bar_prop(THEME_STATUS_NEW, "statusbar.new");
+ _cons_theme_bar_prop(THEME_STATUS_TIME, "statusbar.time");
_cons_theme_prop(THEME_TIME, "main.time");
_cons_theme_prop(THEME_TEXT, "main.text");
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index d19b5618..7998d7b4 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -459,6 +459,7 @@ _status_bar_draw(void)
last_time = g_date_time_new_now(tz);
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
+ int time_attrs = theme_attrs(THEME_STATUS_TIME);
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(time_pref, "off") != 0) {
@@ -468,7 +469,9 @@ _status_bar_draw(void)
wattron(status_bar, bracket_attrs);
mvwaddch(status_bar, 0, 1, '[');
wattroff(status_bar, bracket_attrs);
+ wattron(status_bar, time_attrs);
mvwprintw(status_bar, 0, 2, date_fmt);
+ wattroff(status_bar, time_attrs);
wattron(status_bar, bracket_attrs);
mvwaddch(status_bar, 0, 2 + len, ']');
wattroff(status_bar, bracket_attrs);