taglist: Auto-call set_tag on each widgets of the template.
This reduced the boilerplate code.
This commit is contained in:
parent
e452ec8e27
commit
aa6ab69ffc
|
@ -386,6 +386,11 @@ function taglist.taglist_label(t, args)
|
||||||
return text, bg_color, bg_image, not taglist_disable_icon and icon or nil, other_args
|
return text, bg_color, bg_image, not taglist_disable_icon and icon or nil, other_args
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Remove some callback boilerplate from the user provided templates.
|
||||||
|
local function create_callback(w, t)
|
||||||
|
common._set_common_property(w, "tag", t)
|
||||||
|
end
|
||||||
|
|
||||||
local function taglist_update(s, w, buttons, filter, data, style, update_function, args)
|
local function taglist_update(s, w, buttons, filter, data, style, update_function, args)
|
||||||
local tags = {}
|
local tags = {}
|
||||||
|
|
||||||
|
@ -402,6 +407,7 @@ local function taglist_update(s, w, buttons, filter, data, style, update_functio
|
||||||
|
|
||||||
update_function(w, buttons, label, data, tags, {
|
update_function(w, buttons, label, data, tags, {
|
||||||
widget_template = args.widget_template,
|
widget_template = args.widget_template,
|
||||||
|
create_callback = create_callback,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue