diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 18 | ||||
-rw-r--r-- | src/custom.c | 4 | ||||
-rw-r--r-- | src/ui-calendar.c | 4 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/config.c b/src/config.c index 2df2559..3627cb8 100644 --- a/src/config.c +++ b/src/config.c @@ -36,6 +36,8 @@ #include <ctype.h> #include <unistd.h> +#include <string.h> +#include <strings.h> #include "calcurse.h" @@ -261,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) diff --git a/src/custom.c b/src/custom.c index 5f66194..744f9f9 100644 --- a/src/custom.c +++ b/src/custom.c @@ -38,6 +38,7 @@ #include <stdlib.h> #include <math.h> #include <ctype.h> +#include <langinfo.h> #include "calcurse.h" @@ -702,8 +703,7 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d case FIRST_DAY_OF_WEEK: custom_apply_attr(win, ATTR_HIGHEST); mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]), - ui_calendar_get_wday_start()? _("Monday") : - _("Sunday")); + nl_langinfo(DAY_1 + ui_calendar_get_wday_start())); custom_remove_attr(win, ATTR_HIGHEST); mvwaddstr(win, y + 1, XPOS, _("(specifies the first day of week in the calendar view)")); diff --git a/src/ui-calendar.c b/src/ui-calendar.c index e4d5289..f69ea4c 100644 --- a/src/ui-calendar.c +++ b/src/ui-calendar.c @@ -159,7 +159,9 @@ void ui_calendar_set_first_day_of_week(enum wday first_day) /* Swap first day of week in calendar. */ void ui_calendar_change_first_day_of_week(void) { - wday_start = !wday_start; + wday_start++; + if(wday_start >= WEEKINDAYS) + wday_start = 0; } /* Return 1 if week begins on monday, 0 otherwise. */ |