modules: move 'content' and 'anchors' to MODULE_COMMON_ATTRS

All modules implement these. The only one that differs is the i3
module. It still implements them, but 'content' uses an internal
verifier function.
This commit is contained in:
Daniel Eklöf 2020-01-24 21:08:39 +01:00
parent 36e5dc0df8
commit 86522d653d
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
13 changed files with 3 additions and 23 deletions

View file

@ -34,6 +34,8 @@ struct exposable *module_begin_expose(struct module *mod);
/* List of attributes *all* modules implement */
#define MODULE_COMMON_ATTRS \
{"content", true, &conf_verify_particle}, \
{"anchors", false, NULL}, \
{"font", false, &conf_verify_font}, \
{"foreground", false, &conf_verify_color}, \
{NULL, false, NULL}

View file

@ -302,8 +302,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
static const struct attr_info attrs[] = {
{"card", true, &conf_verify_string},
{"mixer", true, &conf_verify_string},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -233,8 +233,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"name", true, &conf_verify_string},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -360,8 +360,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
static const struct attr_info attrs[] = {
{"name", true, &conf_verify_string},
{"poll-interval", false, &conf_verify_int},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -114,8 +114,6 @@ 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},
MODULE_COMMON_ATTRS,
};

View file

@ -651,7 +651,7 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
{"right-spacing", false, &conf_verify_int},
{"content", true, &verify_content},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
{NULL, false, NULL},
};
return conf_verify_dict(chain, node, attrs);

View file

@ -59,8 +59,6 @@ static bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -610,8 +610,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
static const struct attr_info attrs[] = {
{"host", true, &conf_verify_string},
{"port", false, &conf_verify_int},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -544,8 +544,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"name", true, &conf_verify_string},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -582,8 +582,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
{"spacing", false, &conf_verify_int},
{"left-spacing", false, &conf_verify_int},
{"right-spacing", false, &conf_verify_int},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -350,8 +350,6 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
{"left-spacing", false, &conf_verify_int},
{"right-spacing", false, &conf_verify_int},
{"identifiers", true, &verify_identifiers},
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -664,8 +664,6 @@ static bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};

View file

@ -346,8 +346,6 @@ static bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
MODULE_COMMON_ATTRS,
};