Check for alignment values in configuration file
This commit is contained in:
parent
532709ec3e
commit
f01a2ad47d
|
@ -411,7 +411,7 @@ config_validate_position(cfg_t *cfg, cfg_opt_t *opt)
|
||||||
char *value = cfg_opt_getnstr(opt, cfg_opt_size(opt) - 1);
|
char *value = cfg_opt_getnstr(opt, cfg_opt_size(opt) - 1);
|
||||||
|
|
||||||
if(position_get_from_str(value) == Off
|
if(position_get_from_str(value) == Off
|
||||||
&& !a_strncmp(value, "off", 3))
|
&& a_strcmp(value, "off"))
|
||||||
{
|
{
|
||||||
cfg_error(cfg,
|
cfg_error(cfg,
|
||||||
"position option '%s' must be top, bottom, right, left, auto or off in section '%s'",
|
"position option '%s' must be top, bottom, right, left, auto or off in section '%s'",
|
||||||
|
@ -421,6 +421,22 @@ config_validate_position(cfg_t *cfg, cfg_opt_t *opt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
config_validate_alignment(cfg_t *cfg, cfg_opt_t *opt)
|
||||||
|
{
|
||||||
|
char *value = cfg_opt_getnstr(opt, cfg_opt_size(opt) - 1);
|
||||||
|
|
||||||
|
if(draw_get_align(value) == Auto
|
||||||
|
&& a_strcmp(value, "auto"))
|
||||||
|
{
|
||||||
|
cfg_error(cfg,
|
||||||
|
"alignment option '%s' must be left, center, right, flex or auto in section '%s'",
|
||||||
|
opt->name, cfg->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
cfg_t *
|
cfg_t *
|
||||||
cfg_new(void)
|
cfg_new(void)
|
||||||
{
|
{
|
||||||
|
@ -445,8 +461,13 @@ cfg_new(void)
|
||||||
|
|
||||||
/* Check position values */
|
/* Check position values */
|
||||||
cfg_set_validate_func(cfg, "screen|titlebar|position", config_validate_position);
|
cfg_set_validate_func(cfg, "screen|titlebar|position", config_validate_position);
|
||||||
|
cfg_set_validate_func(cfg, "rules|rule|titlebar|position", config_validate_position);
|
||||||
cfg_set_validate_func(cfg, "screen|statusbar|position", config_validate_position);
|
cfg_set_validate_func(cfg, "screen|statusbar|position", config_validate_position);
|
||||||
|
|
||||||
|
/* Check alignment values */
|
||||||
|
cfg_set_validate_func(cfg, "screen|titlebar|text_align", config_validate_alignment);
|
||||||
|
cfg_set_validate_func(cfg, "rules|rule|titlebar|text_align", config_validate_alignment);
|
||||||
|
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue