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>
This commit is contained in:
parent
f7a88a5515
commit
2c5235cca7
@ -86,6 +86,8 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
|
||||
$1 == "general.systemdialogs" || $1 == "general.progressbar" \
|
||||
{ $2 = ($2 == "yes") ? "no" : "yes" }
|
||||
$1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" }
|
||||
$1 == "appearance.calendarview" { $2 = ($2 == 0) ? "monthly" :
|
||||
($2 == 1) ? "weekly" : $2 }
|
||||
{ print }
|
||||
' < "$CONFFILE" > "$tmpfile"
|
||||
mv "$tmpfile" "$CONFFILE"
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
16
src/config.c
16
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user