tag: all tag constructors must now be passed a module 'owner'

This commit is contained in:
Daniel Eklöf 2018-12-28 12:40:41 +01:00
parent 8d94202057
commit 904f9ff8e1
9 changed files with 58 additions and 42 deletions

View file

@ -44,8 +44,9 @@ content(struct module *mod)
mtx_lock(&mod->lock);
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_int_range("brightness", m->current_brightness, 0, m->max_brightness),
tag_new_int("max_brightness", m->max_brightness),
tag_new_int_range(mod, "brightness", m->current_brightness,
0, m->max_brightness),
tag_new_int(mod, "max_brightness", m->max_brightness),
},
.count = 2,
};

View file

@ -79,16 +79,16 @@ content(struct module *mod)
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_string("name", m->battery),
tag_new_string("manufacturer", m->manufacturer),
tag_new_string("model", m->model),
tag_new_string("state",
tag_new_string(mod, "name", m->battery),
tag_new_string(mod, "manufacturer", m->manufacturer),
tag_new_string(mod, "model", m->model),
tag_new_string(mod, "state",
m->state == STATE_FULL ? "full" :
m->state == STATE_CHARGING ? "charging" :
m->state == STATE_DISCHARGING ? "discharging" :
"unknown"),
tag_new_int_range("capacity", m->capacity, 0, 100),
tag_new_string("estimate", estimate),
tag_new_int_range(mod, "capacity", m->capacity, 0, 100),
tag_new_string(mod, "estimate", estimate),
},
.count = 6,
};

View file

@ -34,8 +34,8 @@ content(struct module *mod)
strftime(date_str, sizeof(date_str), "%e %b", tm);
struct tag_set tags = {
.tags = (struct tag *[]){tag_new_string("time", time_str),
tag_new_string("date", date_str)},
.tags = (struct tag *[]){tag_new_string(mod, "time", time_str),
tag_new_string(mod, "date", date_str)},
.count = 2,
};

View file

@ -559,11 +559,11 @@ content(struct module *mod)
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_string("name", ws->name),
tag_new_bool("visible", ws->visible),
tag_new_bool("focused", ws->focused),
tag_new_bool("urgent", ws->urgent),
tag_new_string("state", state),
tag_new_string(mod, "name", ws->name),
tag_new_bool(mod, "visible", ws->visible),
tag_new_bool(mod, "focused", ws->focused),
tag_new_bool(mod, "urgent", ws->urgent),
tag_new_string(mod, "state", state),
},
.count = 5,
};

View file

@ -88,13 +88,13 @@ content(struct module *mod)
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_string("state", state_str),
tag_new_string("album", m->album),
tag_new_string("artist", m->artist),
tag_new_string("title", m->title),
tag_new_string("pos", pos),
tag_new_string("end", end),
tag_new_int("duration", m->duration),
tag_new_string(mod, "state", state_str),
tag_new_string(mod, "album", m->album),
tag_new_string(mod, "artist", m->artist),
tag_new_string(mod, "title", m->title),
tag_new_string(mod, "pos", pos),
tag_new_string(mod, "end", end),
tag_new_int(mod, "duration", m->duration),
tag_new_int_realtime(
"elapsed", m->elapsed, 0, m->duration,
m->state == STATE_PLAY ? TAG_REALTIME_SECONDS : TAG_REALTIME_NONE),

View file

@ -58,8 +58,8 @@ content(struct module *mod)
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_string("name", m->layouts.layouts[m->current].name),
tag_new_string("symbol", m->layouts.layouts[m->current].symbol)},
tag_new_string(mod, "name", m->layouts.layouts[m->current].name),
tag_new_string(mod, "symbol", m->layouts.layouts[m->current].symbol)},
.count = 2,
};

View file

@ -272,8 +272,9 @@ content(struct module *mod)
mtx_lock(&mod->lock);
struct tag_set tags = {
.tags = (struct tag *[]){
tag_new_string("application", m->application ? m->application : ""),
tag_new_string("title", m->title ? m->title : "")},
tag_new_string(mod, "application", m->application),
tag_new_string(mod, "title", m->title),
},
.count = 2,
};
mtx_unlock(&mod->lock);