aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-09-05 09:29:17 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-09-08 21:08:53 +0200
commitd20f9a5d2e5b9903f7412cdec9e1bf28a94d02da (patch)
treee57836c1d8f3847baaa90538f758475950914709 /src/config.c
parent172efd71798a00469658b0f0e6fc730bac6fa5fe (diff)
downloadcalcurse-d20f9a5d2e5b9903f7412cdec9e1bf28a94d02da.tar.gz
calcurse-d20f9a5d2e5b9903f7412cdec9e1bf28a94d02da.zip
Make the day heading position configurable
The date at the top of the appointments list may be positioned either to the left, in the middle or to the right. Default is to the right. Can be configured from the general options menu. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 896b192..c46d718 100644
--- a/src/config.c
+++ b/src/config.c
@@ -77,6 +77,8 @@ static int config_parse_input_datefmt(void *, const char *);
static int config_serialize_input_datefmt(char **, void *);
static int config_parse_notifyall(void *, const char *);
static int config_serialize_notifyall(char **, void *);
+static int config_parse_heading_pos(void *, const char *);
+static int config_serialize_heading_pos(char **, void *);
#define CONFIG_HANDLER_BOOL(var) (config_fn_parse_t) config_parse_bool, \
(config_fn_serialize_t) config_serialize_bool, &(var)
@@ -96,6 +98,7 @@ static const struct confvar confmap[] = {
{"appearance.sidebarwidth", config_parse_sidebar_width, config_serialize_sidebar_width, NULL},
{"appearance.theme", config_parse_color_theme, config_serialize_color_theme, NULL},
{"appearance.todoview", config_parse_todo_view, config_serialize_todo_view, NULL},
+ {"appearance.headingpos", config_parse_heading_pos, config_serialize_heading_pos, NULL},
{"daemon.enable", CONFIG_HANDLER_BOOL(dmon.enable)},
{"daemon.log", CONFIG_HANDLER_BOOL(dmon.log)},
{"format.inputdate", config_parse_input_datefmt, config_serialize_input_datefmt, NULL},
@@ -307,6 +310,19 @@ static int config_parse_notifyall(void *dummy, const char *val)
return 1;
}
+static int config_parse_heading_pos(void *dummy, const char *val)
+{
+ if (!strcmp(val, "left-justified"))
+ conf.heading_pos = LEFT;
+ else if (!strcmp(val, "centered"))
+ conf.heading_pos = CENTER;
+ else if (!strcmp(val, "right-justified"))
+ conf.heading_pos = RIGHT;
+ else
+ return 0;
+ return 1;
+}
+
/* Set a configuration variable. */
static int config_set_conf(const char *key, const char *value)
{
@@ -482,6 +498,17 @@ static int config_serialize_notifyall(char **buf, void *dummy)
return 1;
}
+static int config_serialize_heading_pos(char **buf, void *dummy)
+{
+ if (conf.heading_pos == LEFT)
+ *buf = mem_strdup("left-justified");
+ else if (conf.heading_pos == CENTER)
+ *buf = mem_strdup("centered");
+ else
+ *buf = mem_strdup("right-justified");
+ return 1;
+}
+
/* Serialize the value of a configuration variable. */
static int
config_serialize_conf(char **buf, const char *key,