diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2019-09-17 22:40:49 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-11-03 10:56:47 -0500 |
commit | d8d7dce2b8efe64b16e6a5acbcc183cf1be92c59 (patch) | |
tree | 7e6e9ef0a398ce818e11f72e7a4153d45b6446e0 /src | |
parent | f49ec4ad6e2035d056583340a13edb46d17ba8d1 (diff) | |
download | calcurse-d8d7dce2b8efe64b16e6a5acbcc183cf1be92c59.tar.gz calcurse-d8d7dce2b8efe64b16e6a5acbcc183cf1be92c59.zip |
Make the text for empty days configurable
The default is "--"; a single space makes the text invisible.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/calcurse.h | 3 | ||||
-rw-r--r-- | src/config.c | 1 | ||||
-rw-r--r-- | src/custom.c | 21 | ||||
-rw-r--r-- | src/day.c | 2 | ||||
-rw-r--r-- | src/vars.c | 1 |
5 files changed, 27 insertions, 1 deletions
diff --git a/src/calcurse.h b/src/calcurse.h index 98b1f71..39f46b7 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -287,6 +287,7 @@ struct conf { unsigned event_separator; unsigned day_separator; unsigned empty_appt_line; + char empty_day[BUFSIZ]; const char *editor; const char *pager; const char *mergetool; @@ -296,6 +297,8 @@ struct conf { char day_heading[BUFSIZ]; /* format for displaying heading in appts panel */ }; +#define EMPTY_DAY_DEFAULT "--" + /* Daemon-related configuration. */ struct dmon_conf { unsigned enable; /* launch daemon automatically when exiting */ diff --git a/src/config.c b/src/config.c index 511ea80..c6914f5 100644 --- a/src/config.c +++ b/src/config.c @@ -98,6 +98,7 @@ static const struct confvar confmap[] = { {"appearance.eventseparator", CONFIG_HANDLER_BOOL(conf.event_separator)}, {"appearance.dayseparator", CONFIG_HANDLER_BOOL(conf.day_separator)}, {"appearance.emptyline", CONFIG_HANDLER_BOOL(conf.empty_appt_line)}, + {"appearance.emptyday", CONFIG_HANDLER_STR(conf.empty_day)}, {"appearance.notifybar", CONFIG_HANDLER_BOOL(nbar.show)}, {"appearance.sidebarwidth", config_parse_sidebar_width, config_serialize_sidebar_width, NULL}, {"appearance.theme", config_parse_color_theme, config_serialize_color_theme, NULL}, diff --git a/src/custom.c b/src/custom.c index 3fc3a2a..dafb801 100644 --- a/src/custom.c +++ b/src/custom.c @@ -533,6 +533,7 @@ enum { EVENT_SEPARATOR, DAY_SEPARATOR, EMPTY_APPT_LINE, + EMPTY_DAY, AUTO_SAVE, AUTO_GC, PERIODIC_SAVE, @@ -562,6 +563,7 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d "appearance.eventseparator = ", "appearance.dayseparator = ", "appearance.emptyline = ", + "appearance.emptyday = ", "general.autosave = ", "general.autogc = ", "general.periodicsave = ", @@ -642,6 +644,14 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d mvwaddstr(win, y + 1, XPOS, _("(insert an empty line after each appointment)")); break; + case EMPTY_DAY: + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[EMPTY_DAY]), + conf.empty_day); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, + _("(text for a day without events and appointments)")); + break; case MULTIPLE_DAYS: print_bool_option_incolor(win, conf.multiple_days, y, XPOS + strlen(opt[MULTIPLE_DAYS])); @@ -766,6 +776,8 @@ static int general_option_height(int i, void *cb_data) static void general_option_edit(int i) { + const char *empty_day_str = + _("Enter a text string (an empty string for the default text)"); const char *output_datefmt_str = _("Enter the date format (see 'man 3 strftime' for possible formats) "); const char *input_datefmt_prefix = _("Enter the date format: "); @@ -818,6 +830,15 @@ static void general_option_edit(int i) case EMPTY_APPT_LINE: conf.empty_appt_line = !conf.empty_appt_line; break; + case EMPTY_DAY: + status_mesg(empty_day_str, ""); + strcpy(buf, conf.empty_day); + val = getstring(win[STA].p, buf, 80, 0, 1); + if (val == GETSTRING_VALID) + strcpy(conf.empty_day, buf); + else if (val == GETSTRING_RET) + strcpy(conf.empty_day, EMPTY_DAY_DEFAULT); + break; case HEADING_POS: if (conf.heading_pos == RIGHT) conf.heading_pos = LEFT; @@ -471,7 +471,7 @@ day_store_items(time_t date, int include_captions, int n) if (include_captions && events == 0 && apts == 0) { /* Insert dummy event. */ d.ev = &dummy; - dummy.mesg = _("(none)"); + dummy.mesg = conf.empty_day; day_add_item(EVNT, DUMMY, date, d); day_items_nb++; } @@ -127,6 +127,7 @@ void vars_init(void) conf.event_separator = 1; conf.day_separator = 1; conf.empty_appt_line = 1; + strcpy(conf.empty_day, EMPTY_DAY_DEFAULT); conf.confirm_quit = 1; conf.confirm_delete = 1; conf.auto_save = 1; |