diff options
author | Morgan Seltzer <MorganSeltzer000@gmail.com> | 2021-06-07 17:13:23 -0400 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2021-08-07 13:42:10 -0400 |
commit | e3fc73e0c76addc0893ad3ceeba7ef8442133a51 (patch) | |
tree | 16f5fe4e89f5ace43471754c170c936bc9103f4c /src/utils.c | |
parent | 61ed5f835cae29ce6405ec34a7e310d5ea90327b (diff) | |
download | calcurse-e3fc73e0c76addc0893ad3ceeba7ef8442133a51.tar.gz calcurse-e3fc73e0c76addc0893ad3ceeba7ef8442133a51.zip |
Backend changes for first day of week
Previously only Sunday and Monday were allowed for the first day of the
week, and was internally treated as a binary variable.
This patch changes the backend so all days are accepted, a future patch
will allow users to actually select other days.
Addresses GitHub feature request #321.
Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 1a480df..f631c8c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -626,6 +626,42 @@ long min2sec(unsigned minutes) return minutes * MININSEC; } +int modify_wday(int wday, int shift) +{ + return (WEEKINDAYS + wday + shift) % WEEKINDAYS; +} + +/* returns char* representing a wday, used for internal functions */ +char *get_wday_default_string(int wday) +{ + switch(wday) { + case MONDAY: + return "Monday"; + break; + case TUESDAY: + return "Tuesday"; + break; + case WEDNESDAY: + return "Wednesday"; + break; + case THURSDAY: + return "Thursday"; + break; + case FRIDAY: + return "Friday"; + break; + case SATURDAY: + return "Saturday"; + break; + case SUNDAY: + return "Sunday"; + break; + default: + return "Sunday"; + break; + } +} + /* * Display a scroll bar when there are so many items that they * can not be displayed inside the corresponding panel. |