aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-05-17 21:59:49 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-17 22:08:00 +0200
commit6c11b8985cbd8fbb5525a4c4d2338603b81729c5 (patch)
tree197335b82e9039ba98b2438e48c3d477aa198bc5 /src/config.c
parentdec97c7c81add925511153a06639922974147018 (diff)
downloadcalcurse-6c11b8985cbd8fbb5525a4c4d2338603b81729c5.tar.gz
calcurse-6c11b8985cbd8fbb5525a4c4d2338603b81729c5.zip
Fix data type of "general.firstdayofweek"
This option wasn't converted to a proper data type when it was renamed from "week_begins_on_monday" to "general.firstdayofweek". Convert the boolean option into an enumeration type that can take the values "monday" and "sunday". Also, update the documentation, add a conversion rule to the upgrade script and convert the configuration file used in the test suite. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/config.c b/src/config.c
index 88d5acc..98e622a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -204,16 +204,14 @@ config_parse_calendar_view (void *dummy, const char *val)
static int
config_parse_first_day_of_week (void *dummy, const char *val)
{
- unsigned tmp;
- if (config_parse_bool (&tmp, val)) {
- if (tmp)
- calendar_set_first_day_of_week (MONDAY);
- else
- calendar_set_first_day_of_week (SUNDAY);
- return 1;
- }
+ if (!strcmp (val, "monday"))
+ calendar_set_first_day_of_week (MONDAY);
+ else if (!strcmp (val, "sunday"))
+ calendar_set_first_day_of_week (SUNDAY);
else
return 0;
+
+ return 1;
}
static int
@@ -381,8 +379,12 @@ config_serialize_calendar_view (char *buf, void *dummy)
static int
config_serialize_first_day_of_week (char *buf, void *dummy)
{
- unsigned tmp = calendar_week_begins_on_monday ();
- return config_serialize_bool (buf, &tmp);
+ if (calendar_week_begins_on_monday ())
+ strcpy(buf, "monday");
+ else
+ strcpy(buf, "sunday");
+
+ return 1;
}
static int