aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/calcurse.h7
-rw-r--r--src/calendar.c6
-rw-r--r--src/config.c16
3 files changed, 20 insertions, 9 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index 98e6a76..be16a98 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -360,6 +360,13 @@ struct recur_event {
char *note; /* note attached to event */
};
+/* Available view for the calendar panel. */
+enum {
+ CAL_MONTH_VIEW,
+ CAL_WEEK_VIEW,
+ CAL_VIEWS
+};
+
struct notify_app {
long time;
int got_app;
diff --git a/src/calendar.c b/src/calendar.c
index 772c177..f369d8f 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -57,12 +57,6 @@
#define ISLEAP(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
-enum {
- CAL_MONTH_VIEW,
- CAL_WEEK_VIEW,
- CAL_VIEWS
-};
-
enum pom {
NO_POM,
FIRST_QUARTER,
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)