Added time format perferences per window type

This commit is contained in:
James Booth
2015-09-30 22:34:27 +01:00
parent d2b991de1d
commit b9948a4c01
8 changed files with 279 additions and 61 deletions

View File

@@ -129,11 +129,17 @@ status_bar_resize(void)
if (message) {
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
gchar *date_fmt = g_date_time_format(last_time, time_pref);
gchar *date_fmt = NULL;
if (g_strcmp0(time_pref, "off") == 0) {
date_fmt = g_strdup("");
} else {
date_fmt = g_date_time_format(last_time, time_pref);
}
assert(date_fmt != NULL);
size_t len = strlen(date_fmt);
g_free(date_fmt);
if (g_strcmp0(time_pref, "") != 0) {
if (g_strcmp0(time_pref, "off") != 0) {
/* 01234567890123456
* [HH:MM] message */
mvwprintw(status_bar, 0, 5 + len, message);
@@ -308,11 +314,17 @@ status_bar_print_message(const char * const msg)
message = strdup(msg);
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
gchar *date_fmt = g_date_time_format(last_time, time_pref);
gchar *date_fmt = NULL;
if (g_strcmp0(time_pref, "off") == 0) {
date_fmt = g_strdup("");
} else {
date_fmt = g_date_time_format(last_time, time_pref);
}
assert(date_fmt != NULL);
size_t len = strlen(date_fmt);
g_free(date_fmt);
if (g_strcmp0(time_pref, "") != 0) {
if (g_strcmp0(time_pref, "off") != 0) {
mvwprintw(status_bar, 0, 5 + len, message);
} else {
mvwprintw(status_bar, 0, 1, message);
@@ -444,7 +456,7 @@ _status_bar_draw(void)
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(time_pref, "") != 0) {
if (g_strcmp0(time_pref, "off") != 0) {
gchar *date_fmt = g_date_time_format(last_time, time_pref);
assert(date_fmt != NULL);
size_t len = strlen(date_fmt);