mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
particles: get rid of struct particle_info
Since this struct only contained function pointers, make all particles export those functions directly. The plugin manager now defines a particle interface struct, and fills it it by dlsym:ing the functions that used to be in particle_info.
This commit is contained in:
parent
d35695e98a
commit
07b1615a41
11 changed files with 63 additions and 80 deletions
|
@ -38,13 +38,13 @@ empty_new(struct particle *common)
|
|||
return common;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
return empty_new(common);
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -53,8 +53,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
|
@ -162,7 +162,7 @@ particle_list_new(struct particle *common,
|
|||
return common;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *items = yml_get_value(node, "items");
|
||||
|
@ -190,7 +190,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
return particle_list_new(common, parts, count, left_spacing, right_spacing);
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -203,8 +203,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
|
@ -195,7 +195,7 @@ verify_map_values(keychain_t *chain, const struct yml_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
|
@ -226,7 +226,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
default_particle);
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -238,8 +238,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
|
@ -227,7 +227,7 @@ progress_bar_new(struct particle *common, const char *tag, int width,
|
|||
return common;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
|
@ -254,7 +254,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
conf_to_particle(indicator, inherited));
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -271,8 +271,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
|
@ -152,7 +152,7 @@ ramp_new(struct particle *common, const char *tag,
|
|||
return common;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
|
@ -173,7 +173,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
return ramp_new(common, yml_value_as_string(tag), parts, count);
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -184,8 +184,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
|
@ -133,7 +133,7 @@ string_new(struct particle *common, const char *text, size_t max_len)
|
|||
return common;
|
||||
}
|
||||
|
||||
static struct particle *
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *text = yml_get_value(node, "text");
|
||||
|
@ -145,7 +145,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
max != NULL ? yml_value_as_int(max) : 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
|
@ -156,8 +156,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_info plugin_info = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue