modules: don't assume module content is a dictionary

This is done by having each module implement a top-level verifier
function.
This commit is contained in:
Daniel Eklöf 2019-01-13 11:54:03 +01:00
parent e471c2357d
commit 9944a8f972
13 changed files with 146 additions and 56 deletions

View file

@ -107,13 +107,21 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
}
const struct module_info plugin_info = {
.from_conf = &from_conf,
.attrs = {
static bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"date-format", false, &conf_verify_string},
{"time-format", false, &conf_verify_string},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
{NULL, false, NULL},
},
{NULL, false, NULL}
};
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};