mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
plugins: export a const function pointer interface struct
This commit is contained in:
parent
37266ae419
commit
452c4b6015
22 changed files with 255 additions and 230 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
int size;
|
||||
|
@ -42,16 +43,16 @@ underline_new(int size, struct rgba color)
|
|||
return deco;
|
||||
}
|
||||
|
||||
struct deco *
|
||||
underline_from_conf(const struct yml_node *node)
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
const struct yml_node *size = yml_get_value(node, "size");
|
||||
const struct yml_node *color = yml_get_value(node, "color");
|
||||
return underline_new(yml_value_as_int(size), conf_to_color(color));
|
||||
}
|
||||
|
||||
bool
|
||||
underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"size", true, &conf_verify_int},
|
||||
|
@ -62,11 +63,11 @@ underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct deco_iface deco_underline_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("underline_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("underline_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_underline_iface")));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue