forked from external/yambar
modules: use the same name for the module_info in all modules
This commit is contained in:
parent
45eb2b85f0
commit
7f2501334d
12 changed files with 12 additions and 16 deletions
|
@ -282,7 +282,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
conf_to_particle(content, parent_font));
|
conf_to_particle(content, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_alsa = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 4,
|
.attr_count = 4,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -226,7 +226,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
yml_value_as_string(name), conf_to_particle(c, parent_font));
|
yml_value_as_string(name), conf_to_particle(c, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_backlight = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 3,
|
.attr_count = 3,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -358,7 +358,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
poll_interval != NULL ? yml_value_as_int(poll_interval) : 60);
|
poll_interval != NULL ? yml_value_as_int(poll_interval) : 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_battery = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 4,
|
.attr_count = 4,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -108,7 +108,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
|
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_clock = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 4,
|
.attr_count = 4,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -703,7 +703,7 @@ verify_content(keychain_t *chain, const struct yml_node *node)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_i3 = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 5,
|
.attr_count = 5,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -55,7 +55,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
return label_new(conf_to_particle(c, parent_font));
|
return label_new(conf_to_particle(c, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_label = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 2,
|
.attr_count = 2,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -493,7 +493,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
conf_to_particle(c, parent_font));
|
conf_to_particle(c, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_mpd = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 4,
|
.attr_count = 4,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -545,7 +545,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
yml_value_as_string(name), conf_to_particle(content, parent_font));
|
yml_value_as_string(name), conf_to_particle(content, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_network = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 3,
|
.attr_count = 3,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -579,7 +579,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
conf_to_particle(content, parent_font), left, right);
|
conf_to_particle(content, parent_font), left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_removables = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 5,
|
.attr_count = 5,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -461,7 +461,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
return xkb_new(conf_to_particle(c, parent_font));
|
return xkb_new(conf_to_particle(c, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_xkb = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 2,
|
.attr_count = 2,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
|
@ -323,7 +323,7 @@ from_conf(const struct yml_node *node, const struct font *parent_font)
|
||||||
return xwindow_new(conf_to_particle(c, parent_font));
|
return xwindow_new(conf_to_particle(c, parent_font));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct module_info module_xwindow = {
|
const struct module_info module_info = {
|
||||||
.from_conf = &from_conf,
|
.from_conf = &from_conf,
|
||||||
.attr_count = 2,
|
.attr_count = 2,
|
||||||
.attrs = {
|
.attrs = {
|
||||||
|
|
6
plugin.c
6
plugin.c
|
@ -61,12 +61,8 @@ plugin_load_module(const char *name)
|
||||||
tll_push_back(libs, ((struct plugin){strdup(name), lib}));
|
tll_push_back(libs, ((struct plugin){strdup(name), lib}));
|
||||||
struct plugin *plug = &tll_back(libs);
|
struct plugin *plug = &tll_back(libs);
|
||||||
|
|
||||||
/* TODO: use same name in all modules */
|
|
||||||
char sym[128];
|
|
||||||
snprintf(sym, sizeof(sym), "module_%s", name);
|
|
||||||
|
|
||||||
dlerror(); /* Clear previous error */
|
dlerror(); /* Clear previous error */
|
||||||
plug->sym = dlsym(lib, sym);
|
plug->sym = dlsym(lib, "module_info");
|
||||||
|
|
||||||
const char *dlsym_error = dlerror();
|
const char *dlsym_error = dlerror();
|
||||||
if (dlsym_error != NULL) {
|
if (dlsym_error != NULL) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue