diff options
author | James Booth <boothj5@gmail.com> | 2014-11-16 01:28:41 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-16 01:28:41 +0000 |
commit | cd855d3740c9fa0574bf15616754b359e4c9e1b1 (patch) | |
tree | 64c00ffd1cee1c4f589d493fc33de59317e7fef8 /src/ui | |
parent | 8c027a56f94f019ff787d85899f35bce7180cb05 (diff) | |
download | profani-tty-cd855d3740c9fa0574bf15616754b359e4c9e1b1.tar.gz |
Added /time off
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 20 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 8d4e041e..5e77a9aa 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -906,6 +906,8 @@ _cons_time_setting(void) char *pref_time = prefs_get_string(PREF_TIME); if (g_strcmp0(pref_time, "minutes") == 0) cons_show("Time (/time) : minutes"); + else if (g_strcmp0(pref_time, "off") == 0) + cons_show("Time (/time) : OFF"); else cons_show("Time (/time) : seconds"); diff --git a/src/ui/window.c b/src/ui/window.c index 6ac0cedb..41590e44 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -580,21 +580,23 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time, int colour = COLOUR_ME; if ((flags & NO_DATE) == 0) { - gchar *date_fmt; + gchar *date_fmt = NULL; char *time_pref = prefs_get_string(PREF_TIME); if (g_strcmp0(time_pref, "minutes") == 0) { date_fmt = g_date_time_format(time, "%H:%M"); - } else { + } else if (g_strcmp0(time_pref, "seconds") == 0) { date_fmt = g_date_time_format(time, "%H:%M:%S"); } free(time_pref); - if ((flags & NO_COLOUR_DATE) == 0) { - wattron(window->win, COLOUR_TIME); - } - wprintw(window->win, "%s %c ", date_fmt, show_char); - if ((flags & NO_COLOUR_DATE) == 0) { - wattroff(window->win, COLOUR_TIME); + if (date_fmt) { + if ((flags & NO_COLOUR_DATE) == 0) { + wattron(window->win, COLOUR_TIME); + } + wprintw(window->win, "%s %c ", date_fmt, show_char); + if ((flags & NO_COLOUR_DATE) == 0) { + wattroff(window->win, COLOUR_TIME); + } } g_free(date_fmt); } @@ -650,7 +652,7 @@ _win_print_wrapped(WINDOW *win, const char * const message) int wrap_space = 0; if (g_strcmp0(time_pref, "minutes") == 0) { wrap_space = 8; - } else { + } else if (g_strcmp0(time_pref, "seconds") == 0) { wrap_space = 11; } free(time_pref); |