From 63b03c6b36c7b9ae9c7b6cf8063445146b4f8210 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Fri, 4 Jan 2019 17:40:59 +0100 Subject: 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 Signed-off-by: Lukas Fleischer --- src/config.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index ca81c67..a728c83 100644 --- a/src/config.c +++ b/src/config.c @@ -213,11 +213,13 @@ static int config_parse_color_pair(int *dest1, int *dest2, const char *val) static int config_parse_calendar_view(void *dummy, const char *val) { - if (!strcmp(val, "monthly")) + if (!strcmp(val, "monthly")) { ui_calendar_set_view(CAL_MONTH_VIEW); - else if (!strcmp(val, "weekly")) + conf.cal_view = CAL_MONTH_VIEW; + } else if (!strcmp(val, "weekly")) { ui_calendar_set_view(CAL_WEEK_VIEW); - else + conf.cal_view = CAL_WEEK_VIEW; + } else return 0; return 1; @@ -225,11 +227,13 @@ static int config_parse_calendar_view(void *dummy, const char *val) static int config_parse_todo_view(void *dummy, const char *val) { - if (!strcmp(val, "show-completed")) + if (!strcmp(val, "show-completed")) { ui_todo_set_view(TODO_SHOW_COMPLETED_VIEW); - else if (!strcmp(val, "hide-completed")) + conf.todo_view = TODO_SHOW_COMPLETED_VIEW; + } else if (!strcmp(val, "hide-completed")) { ui_todo_set_view(TODO_HIDE_COMPLETED_VIEW); - else + conf.todo_view = TODO_HIDE_COMPLETED_VIEW; + } else return 0; return 1; @@ -426,7 +430,7 @@ static char *config_color_theme_name(void) static int config_serialize_calendar_view(char **buf, void *dummy) { - if (ui_calendar_get_view() == CAL_WEEK_VIEW) + if (conf.cal_view == CAL_WEEK_VIEW) *buf = mem_strdup("weekly"); else *buf = mem_strdup("monthly"); @@ -436,7 +440,7 @@ static int config_serialize_calendar_view(char **buf, void *dummy) static int config_serialize_todo_view(char **buf, void *dummy) { - if (ui_todo_get_view() == TODO_SHOW_COMPLETED_VIEW) + if (conf.todo_view == TODO_SHOW_COMPLETED_VIEW) *buf = mem_strdup("show-completed"); else *buf = mem_strdup("hide-completed"); -- cgit v1.2.3-54-g00ecf