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

This commit is contained in:
Daniel Eklöf 2019-01-12 13:01:24 +01:00
parent 87640339e1
commit 905f289659
4 changed files with 25 additions and 20 deletions

View file

@ -13,6 +13,7 @@
#define LOG_MODULE "xkb"
#include "../../log.h"
#include "../../bar.h"
#include "../../config.h"
#include "../../xcb.h"
struct layout {
@ -436,8 +437,8 @@ run(struct module_run_context *ctx)
return ret;
}
struct module *
module_xkb(struct particle *label)
static struct module *
xkb_new(struct particle *label)
{
struct private *m = malloc(sizeof(*m));
m->label = label;
@ -452,3 +453,20 @@ module_xkb(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 xkb_new(conf_to_particle(c, parent_font));
}
const struct module_info module_xkb = {
.from_conf = &from_conf,
.attr_count = 2,
.attrs = {
{"content", true, &conf_verify_particle},
{"anchors", false, NULL},
{NULL, false, NULL},
},
};