mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-25 13:25:39 +02:00
module/battery: use module common constructor and default destructor
This commit is contained in:
parent
72624af1fa
commit
76995ddcd5
1 changed files with 2 additions and 6 deletions
|
@ -45,7 +45,7 @@ destroy(struct module *mod)
|
||||||
m->label->destroy(m->label);
|
m->label->destroy(m->label);
|
||||||
|
|
||||||
free(m);
|
free(m);
|
||||||
free(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct exposable *
|
static struct exposable *
|
||||||
|
@ -266,14 +266,10 @@ module_battery(const char *battery, struct particle *label,
|
||||||
m->manufacturer = NULL;
|
m->manufacturer = NULL;
|
||||||
m->model = NULL;
|
m->model = NULL;
|
||||||
|
|
||||||
struct module *mod = malloc(sizeof(*mod));
|
struct module *mod = module_common_new();
|
||||||
mod->bar = NULL;
|
|
||||||
mod->private = m;
|
mod->private = m;
|
||||||
mod->run = &run;
|
mod->run = &run;
|
||||||
mod->destroy = &destroy;
|
mod->destroy = &destroy;
|
||||||
mod->content = &content;
|
mod->content = &content;
|
||||||
mod->begin_expose = &module_default_begin_expose;
|
|
||||||
mod->expose = &module_default_expose;
|
|
||||||
mod->end_expose = &module_default_end_expose;
|
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue