diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2019-01-04 17:40:59 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-01-07 16:58:11 +0100 |
commit | 63b03c6b36c7b9ae9c7b6cf8063445146b4f8210 (patch) | |
tree | f3db55a5fde36c95c72e2102ffe0b61fa2c841f7 /src/custom.c | |
parent | b9f23e134a905b13aaa86935929a510ff75f75ef (diff) | |
download | calcurse-63b03c6b36c7b9ae9c7b6cf8063445146b4f8210.tar.gz calcurse-63b03c6b36c7b9ae9c7b6cf8063445146b4f8210.zip |
Explicit calendar and todo view configuration
The configuration settings for calendar view (monthly/weekly) and todo
view (hide/show completed) used to be saved automatically on calcurse
exit, with values taken from the current interactive settings. They
could not be set explicitly in the configuration menues. Configuration
settings are no longer saved on program exit, but on exit from the
configuration menu. This means that the saved values are those that were
current when the configuration menu was entered. To change a saved
value, you must set the view as desired and then enter/exit the
configuration menu.
The preferred calendar and todo views are no longer automatically taken
from the interactive settings, but are explicitly set in the general
options menu. Default values are monthly view and hide completed view.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/custom.c')
-rw-r--r-- | src/custom.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/custom.c b/src/custom.c index df5c174..7771349 100644 --- a/src/custom.c +++ b/src/custom.c @@ -526,6 +526,8 @@ void custom_color_config(void) enum { COMPACT_PANELS, DEFAULT_PANEL, + CAL_VIEW, + TODO_VIEW, AUTO_SAVE, AUTO_GC, PERIODIC_SAVE, @@ -548,6 +550,8 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d char *opt[NB_OPTIONS] = { "appearance.compactpanels = ", "appearance.defaultpanel = ", + "appearance.calendarview = ", + "appearance.todoview = ", "general.autosave = ", "general.autogc = ", "general.periodicsave = ", @@ -588,6 +592,22 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d mvwaddstr(win, y + 1, XPOS, _("(specifies the panel that is selected by default)")); break; + case CAL_VIEW: + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[CAL_VIEW]), + conf.cal_view == CAL_MONTH_VIEW ? + _("monthly") : _("weekly")); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, _("(preferred calendar display)")); + break; + case TODO_VIEW: + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[TODO_VIEW]), + conf.todo_view == TODO_SHOW_COMPLETED_VIEW ? + _("show completed") : _("hide completed")); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, _("(preferred todo display)")); + break; case AUTO_SAVE: print_bool_option_incolor(win, conf.auto_save, y, XPOS + strlen(opt[AUTO_SAVE])); @@ -727,6 +747,21 @@ static void general_option_edit(int i) else conf.default_panel++; break; + case CAL_VIEW: + if (conf.cal_view == CAL_WEEK_VIEW) + conf.cal_view = CAL_MONTH_VIEW; + else + conf.cal_view++; + ui_calendar_set_view(conf.cal_view); + break; + case TODO_VIEW: + if (conf.todo_view == TODO_HIDE_COMPLETED_VIEW) + conf.todo_view = TODO_SHOW_COMPLETED_VIEW; + else + conf.todo_view++; + ui_todo_set_view(conf.todo_view); + ui_todo_load_items(); + break; case HEADING_POS: if (conf.heading_pos == RIGHT) conf.heading_pos = LEFT; |