diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/config.c b/src/config.c index f621320..4e0f7db 100644 --- a/src/config.c +++ b/src/config.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,8 @@ #include <ctype.h> #include <unistd.h> +#include <string.h> +#include <strings.h> #include "calcurse.h" @@ -109,6 +111,7 @@ static const struct confvar confmap[] = { {"format.inputdate", config_parse_input_datefmt, config_serialize_input_datefmt, NULL}, {"format.notifydate", CONFIG_HANDLER_STR(nbar.datefmt)}, {"format.notifytime", CONFIG_HANDLER_STR(nbar.timefmt)}, + {"format.appointmenttime", CONFIG_HANDLER_STR(conf.timefmt)}, {"format.outputdate", config_parse_output_datefmt, config_serialize_output_datefmt, NULL}, {"format.dayheading", CONFIG_HANDLER_STR(conf.day_heading)}, {"general.autogc", CONFIG_HANDLER_BOOL(conf.auto_gc)}, @@ -260,14 +263,16 @@ static int config_parse_default_panel(void *dummy, const char *val) static int config_parse_first_day_of_week(void *dummy, const char *val) { - if (!strcmp(val, "monday")) - ui_calendar_set_first_day_of_week(MONDAY); - else if (!strcmp(val, "sunday")) - ui_calendar_set_first_day_of_week(SUNDAY); - else - return 0; + int i; - return 1; + for (i = 0; i < WEEKINDAYS; i++) { + if(!strcasecmp(val, get_wday_default_string(i))) { + ui_calendar_set_first_day_of_week(i); + return 1; + } + } + + return 0; } static int config_parse_color_theme(void *dummy, const char *val) @@ -467,10 +472,9 @@ static int config_serialize_default_panel(char **buf, void *dummy) static int config_serialize_first_day_of_week(char **buf, void *dummy) { - if (ui_calendar_week_begins_on_monday()) - *buf = mem_strdup("monday"); - else - *buf = mem_strdup("sunday"); + *buf = mem_strdup(get_wday_default_string(ui_calendar_get_wday_start())); + /* now stores string with uppercase first letter, changing to lower */ + **buf = tolower(**buf); return 1; } |