add(w.w.template) template can't be a callback

Containers and layouts don't allow to build a widget from a callback, so
there is no reason to have this feature here.
This commit is contained in:
Aire-One 2021-11-26 19:32:42 +01:00 committed by Emmanuel Lepage Vallee
parent 2dab6c336c
commit a7932b127f
1 changed files with 3 additions and 5 deletions

View File

@ -134,15 +134,13 @@ function template:update(args)
end end
--- Change the widget template. --- Change the widget template.
-- @tparam table|widget|function widget_template The new widget to use as a -- @tparam table|widget widget_template The new widget to use as a
-- template. -- template.
-- @method set_template -- @method set_template
-- @emits widget::redraw_needed -- @emits widget::redraw_needed
-- @hidden -- @hidden
function template:set_template(widget_template) function template:set_template(widget_template)
local widget = type(widget_template) == "function" and widget_template() local widget = widget_template or wbase.empty_widget()
or widget_template
or wbase.empty_widget()
local widget_instance = wbase.make_widget_from_value(widget) local widget_instance = wbase.make_widget_from_value(widget)
@ -204,7 +202,7 @@ end
--- Create a new `wibox.widget.template` instance. --- Create a new `wibox.widget.template` instance.
-- @tparam[opt] table args -- @tparam[opt] table args
-- @tparam[opt] table|widget|function args.template The widget template to use. -- @tparam[opt] table|widget args.template The widget template to use.
-- @tparam[opt] function args.update_callback The callback function to update -- @tparam[opt] function args.update_callback The callback function to update
-- the widget. -- the widget.
-- @tparam[opt] boolean args.update_now Update the widget after its -- @tparam[opt] boolean args.update_now Update the widget after its