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>
This commit is contained in:
parent
f49ec4ad6e
commit
d8d7dce2b8
@ -287,6 +287,7 @@ struct conf {
|
|||||||
unsigned event_separator;
|
unsigned event_separator;
|
||||||
unsigned day_separator;
|
unsigned day_separator;
|
||||||
unsigned empty_appt_line;
|
unsigned empty_appt_line;
|
||||||
|
char empty_day[BUFSIZ];
|
||||||
const char *editor;
|
const char *editor;
|
||||||
const char *pager;
|
const char *pager;
|
||||||
const char *mergetool;
|
const char *mergetool;
|
||||||
@ -296,6 +297,8 @@ struct conf {
|
|||||||
char day_heading[BUFSIZ]; /* format for displaying heading in appts panel */
|
char day_heading[BUFSIZ]; /* format for displaying heading in appts panel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define EMPTY_DAY_DEFAULT "--"
|
||||||
|
|
||||||
/* Daemon-related configuration. */
|
/* Daemon-related configuration. */
|
||||||
struct dmon_conf {
|
struct dmon_conf {
|
||||||
unsigned enable; /* launch daemon automatically when exiting */
|
unsigned enable; /* launch daemon automatically when exiting */
|
||||||
|
@ -98,6 +98,7 @@ static const struct confvar confmap[] = {
|
|||||||
{"appearance.eventseparator", CONFIG_HANDLER_BOOL(conf.event_separator)},
|
{"appearance.eventseparator", CONFIG_HANDLER_BOOL(conf.event_separator)},
|
||||||
{"appearance.dayseparator", CONFIG_HANDLER_BOOL(conf.day_separator)},
|
{"appearance.dayseparator", CONFIG_HANDLER_BOOL(conf.day_separator)},
|
||||||
{"appearance.emptyline", CONFIG_HANDLER_BOOL(conf.empty_appt_line)},
|
{"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.notifybar", CONFIG_HANDLER_BOOL(nbar.show)},
|
||||||
{"appearance.sidebarwidth", config_parse_sidebar_width, config_serialize_sidebar_width, NULL},
|
{"appearance.sidebarwidth", config_parse_sidebar_width, config_serialize_sidebar_width, NULL},
|
||||||
{"appearance.theme", config_parse_color_theme, config_serialize_color_theme, NULL},
|
{"appearance.theme", config_parse_color_theme, config_serialize_color_theme, NULL},
|
||||||
|
21
src/custom.c
21
src/custom.c
@ -533,6 +533,7 @@ enum {
|
|||||||
EVENT_SEPARATOR,
|
EVENT_SEPARATOR,
|
||||||
DAY_SEPARATOR,
|
DAY_SEPARATOR,
|
||||||
EMPTY_APPT_LINE,
|
EMPTY_APPT_LINE,
|
||||||
|
EMPTY_DAY,
|
||||||
AUTO_SAVE,
|
AUTO_SAVE,
|
||||||
AUTO_GC,
|
AUTO_GC,
|
||||||
PERIODIC_SAVE,
|
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.eventseparator = ",
|
||||||
"appearance.dayseparator = ",
|
"appearance.dayseparator = ",
|
||||||
"appearance.emptyline = ",
|
"appearance.emptyline = ",
|
||||||
|
"appearance.emptyday = ",
|
||||||
"general.autosave = ",
|
"general.autosave = ",
|
||||||
"general.autogc = ",
|
"general.autogc = ",
|
||||||
"general.periodicsave = ",
|
"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,
|
mvwaddstr(win, y + 1, XPOS,
|
||||||
_("(insert an empty line after each appointment)"));
|
_("(insert an empty line after each appointment)"));
|
||||||
break;
|
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:
|
case MULTIPLE_DAYS:
|
||||||
print_bool_option_incolor(win, conf.multiple_days, y,
|
print_bool_option_incolor(win, conf.multiple_days, y,
|
||||||
XPOS + strlen(opt[MULTIPLE_DAYS]));
|
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)
|
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 =
|
const char *output_datefmt_str =
|
||||||
_("Enter the date format (see 'man 3 strftime' for possible formats) ");
|
_("Enter the date format (see 'man 3 strftime' for possible formats) ");
|
||||||
const char *input_datefmt_prefix = _("Enter the date format: ");
|
const char *input_datefmt_prefix = _("Enter the date format: ");
|
||||||
@ -818,6 +830,15 @@ static void general_option_edit(int i)
|
|||||||
case EMPTY_APPT_LINE:
|
case EMPTY_APPT_LINE:
|
||||||
conf.empty_appt_line = !conf.empty_appt_line;
|
conf.empty_appt_line = !conf.empty_appt_line;
|
||||||
break;
|
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:
|
case HEADING_POS:
|
||||||
if (conf.heading_pos == RIGHT)
|
if (conf.heading_pos == RIGHT)
|
||||||
conf.heading_pos = LEFT;
|
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) {
|
if (include_captions && events == 0 && apts == 0) {
|
||||||
/* Insert dummy event. */
|
/* Insert dummy event. */
|
||||||
d.ev = &dummy;
|
d.ev = &dummy;
|
||||||
dummy.mesg = _("(none)");
|
dummy.mesg = conf.empty_day;
|
||||||
day_add_item(EVNT, DUMMY, date, d);
|
day_add_item(EVNT, DUMMY, date, d);
|
||||||
day_items_nb++;
|
day_items_nb++;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ void vars_init(void)
|
|||||||
conf.event_separator = 1;
|
conf.event_separator = 1;
|
||||||
conf.day_separator = 1;
|
conf.day_separator = 1;
|
||||||
conf.empty_appt_line = 1;
|
conf.empty_appt_line = 1;
|
||||||
|
strcpy(conf.empty_day, EMPTY_DAY_DEFAULT);
|
||||||
conf.confirm_quit = 1;
|
conf.confirm_quit = 1;
|
||||||
conf.confirm_delete = 1;
|
conf.confirm_delete = 1;
|
||||||
conf.auto_save = 1;
|
conf.auto_save = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user