aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2012-05-29 09:55:01 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-31 20:45:42 +0200
commit2c5235cca70bf1c5b5e92dd5b6b178ab13b695f2 (patch)
tree9185e8079a8ecd0c80c2970e1261e821d1af9952 /src/config.c
parentf7a88a5515e9f088a60623e162b89065ddcce757 (diff)
downloadcalcurse-2c5235cca70bf1c5b5e92dd5b6b178ab13b695f2.tar.gz
calcurse-2c5235cca70bf1c5b5e92dd5b6b178ab13b695f2.zip
Make appearance.calendarview more explicit in config file
Instead of using 0 or 1 as a value for `appearance.calendarview`, introduce the more explicit "monthly" and "weekly". Also update `scripts/calcurse-upgrade.sh` to reflect the change. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index 17ac848..a25cae1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -196,7 +196,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)
{
- calendar_set_view(atoi(val));
+ if (!strcmp(val, "monthly"))
+ calendar_set_view(CAL_MONTH_VIEW);
+ else if (!strcmp(val, "weekly"))
+ calendar_set_view(CAL_WEEK_VIEW);
+ else
+ return 0;
+
return 1;
}
@@ -350,8 +356,12 @@ static void config_color_theme_name(char *theme_name)
static int config_serialize_calendar_view(char *buf, void *dummy)
{
- int tmp = calendar_get_view();
- return config_serialize_int(buf, &tmp);
+ if (calendar_get_view() == CAL_WEEK_VIEW)
+ strcpy(buf, "weekly");
+ else
+ strcpy(buf, "monthly");
+
+ return 1;
}
static int config_serialize_first_day_of_week(char *buf, void *dummy)