diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-24 23:36:51 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-25 18:13:37 +0100 |
commit | 660eef88e4a0add913e8a147d97b9549162a921e (patch) | |
tree | 32bbcb608739f902f9d2d6a6044b77ff33027da7 /src/config.c | |
parent | 69b5293c871af3500f7b80379a5d9d3f5e41d8ad (diff) | |
download | calcurse-660eef88e4a0add913e8a147d97b9549162a921e.zip |
Add configuration option to set a default panel
This allows for customizing the panel that is selected by default when
calcurse is started.
Note that this patch doesn't add any documentation. Also, this
configuration option currently cannot be configured using the
configuration menu.
Implements FR#19.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 06a8124..c601336 100644 --- a/src/config.c +++ b/src/config.c @@ -59,6 +59,8 @@ static int config_parse_str(char *, const char *); static int config_serialize_str(char *, const char *); static int config_parse_calendar_view(void *, const char *); static int config_serialize_calendar_view(char *, void *); +static int config_parse_default_panel(void *, const char *); +static int config_serialize_default_panel(char *, void *); static int config_parse_first_day_of_week(void *, const char *); static int config_serialize_first_day_of_week(char *, void *); static int config_parse_color_theme(void *, const char *); @@ -84,6 +86,8 @@ static int config_serialize_input_datefmt(char *, void *); static const struct confvar confmap[] = { {"appearance.calendarview", config_parse_calendar_view, config_serialize_calendar_view, NULL}, + {"appearance.defaultpanel", config_parse_default_panel, + config_serialize_default_panel, NULL}, {"appearance.layout", config_parse_layout, config_serialize_layout, NULL}, {"appearance.notifybar", CONFIG_HANDLER_BOOL(nbar.show)}, {"appearance.sidebarwidth", config_parse_sidebar_width, @@ -206,6 +210,20 @@ static int config_parse_calendar_view(void *dummy, const char *val) return 1; } +static int config_parse_default_panel(void *dummy, const char *val) +{ + if (!strcmp(val, "calendar")) + conf.default_panel = CAL; + else if (!strcmp(val, "appointments")) + conf.default_panel = APP; + else if (!strcmp(val, "todo")) + conf.default_panel = TOD; + else + return 0; + + return 1; +} + static int config_parse_first_day_of_week(void *dummy, const char *val) { if (!strcmp(val, "monday")) @@ -368,6 +386,18 @@ static int config_serialize_calendar_view(char *buf, void *dummy) return 1; } +static int config_serialize_default_panel(char *buf, void *dummy) +{ + if (conf.default_panel == CAL) + strcpy(buf, "calendar"); + else if (conf.default_panel == APP) + strcpy(buf, "appointments"); + else + strcpy(buf, "todo"); + + return 1; +} + static int config_serialize_first_day_of_week(char *buf, void *dummy) { if (calendar_week_begins_on_monday()) |