module/label: export module info through the new module_info struct type

This commit is contained in:
Daniel Eklöf 2019-01-12 12:48:42 +01:00
parent f3721d9d80
commit fb9f07dcad
4 changed files with 26 additions and 20 deletions

View file

@ -5,6 +5,8 @@
#include <poll.h>
#include "../../config.h"
struct private {
struct particle *label;
};
@ -32,8 +34,8 @@ run(struct module_run_context *ctx)
return 0;
}
struct module *
module_label(struct particle *label)
static struct module *
label_new(struct particle *label)
{
struct private *m = malloc(sizeof(*m));
m->label = label;
@ -45,3 +47,20 @@ module_label(struct particle *label)
mod->content = &content;
return mod;
}
static struct module *
from_conf(const struct yml_node *node, const struct font *parent_font)
{
const struct yml_node *c = yml_get_value(node, "content");
return label_new(conf_to_particle(c, parent_font));
}
const struct module_info module_label = {
.from_conf = &from_conf,
.attr_count = 2,
.attrs = {
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
{NULL, false, NULL},
},
};