filemanager: align UI plugin registration with reader

With the addition of the language support module, ReaderDictionary
tries to use modules registered with the UI instance, but the
FileManager doesn't provide key-based registration of its UI modules.

In order to allow the same code to be used by both FileManager and
Reader seamlessly, copy the :registerPlugin() method from Reader and use
it with FileManager. This will ensure any other hidden assumptions about
UI module registration are handled properly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2021-10-25 17:41:20 +11:00
committed by poire-z
parent f301ca59b7
commit cdbedcbcce
2 changed files with 33 additions and 19 deletions

View File

@@ -83,8 +83,10 @@ local ReaderUI = InputContainer:new{
}
function ReaderUI:registerModule(name, ui_module, always_active)
if name then self[name] = ui_module end
ui_module.name = "reader" .. name
if name then
self[name] = ui_module
ui_module.name = "reader" .. name
end
table.insert(self, ui_module)
if always_active then
-- to get events even when hidden