mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-18 16:55:40 +02:00
module/network: export module info through the new module_info struct type
This commit is contained in:
parent
a16e2f5a53
commit
697e613b2e
4 changed files with 30 additions and 26 deletions
|
@ -17,8 +17,9 @@
|
|||
#define LOG_MODULE "network"
|
||||
#define LOG_ENABLE_DBG 0
|
||||
#include "../../log.h"
|
||||
#include "../../module.h"
|
||||
#include "../../bar.h"
|
||||
#include "../../config.h"
|
||||
#include "../../module.h"
|
||||
#include "../../tllist.h"
|
||||
|
||||
struct af_addr {
|
||||
|
@ -511,8 +512,8 @@ run(struct module_run_context *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct module *
|
||||
module_network(const char *iface, struct particle *label)
|
||||
static struct module *
|
||||
network_new(const char *iface, struct particle *label)
|
||||
{
|
||||
struct private *priv = malloc(sizeof(*priv));
|
||||
priv->iface = strdup(iface);
|
||||
|
@ -533,3 +534,24 @@ module_network(const char *iface, 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 *name = yml_get_value(node, "name");
|
||||
const struct yml_node *content = yml_get_value(node, "content");
|
||||
|
||||
return network_new(
|
||||
yml_value_as_string(name), conf_to_particle(content, parent_font));
|
||||
}
|
||||
|
||||
const struct module_info module_network = {
|
||||
.from_conf = &from_conf,
|
||||
.attr_count = 3,
|
||||
.attrs = {
|
||||
{"name", true, &conf_verify_string},
|
||||
{"content", true, &conf_verify_particle},
|
||||
{"anchors", false, NULL},
|
||||
{NULL, false, NULL},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue