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 authored and poire-z committed 2021-10-26 07:41:17 +02:00
1 parent f301ca59b7
commit cdbedcbcce
2 files changed
+33 -19

No files matched your search

+4 -2
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