tasklist: Add a sync way to force an update

It simplifies the tests
This commit is contained in:
Emmanuel Lepage Vallee 2017-08-09 00:19:03 -04:00
parent b59495e1e7
commit 2e7cd2b2ef
1 changed files with 10 additions and 6 deletions

View File

@ -460,15 +460,19 @@ function tasklist.new(args, filter, buttons, style, update_function, base_widget
end end
local queued_update = false local queued_update = false
-- For the tests
function w._do_tasklist_update_now()
queued_update = false
if screen.valid then
tasklist_update(screen, w, args.buttons, args.filter, data, args.style, uf)
end
end
function w._do_tasklist_update() function w._do_tasklist_update()
-- Add a delayed callback for the first update. -- Add a delayed callback for the first update.
if not queued_update then if not queued_update then
timer.delayed_call(function() timer.delayed_call(w._do_tasklist_update_now)
queued_update = false
if screen.valid then
tasklist_update(screen, w, args.buttons, args.filter, data, args.style, uf)
end
end)
queued_update = true queued_update = true
end end
end end