mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 20:06:21 +00:00
Added time format perferences per window type
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user