Reader style tweaks: register in Dispatcher manually (#9816)

Style tweaks can be applied with a gesture or added to a profile.
This commit is contained in:
hius07
2022-11-22 14:46:44 +02:00
committed by GitHub
parent 486d7071c7
commit 5b889a0145
4 changed files with 111 additions and 52 deletions

View File

@@ -59,7 +59,7 @@ local function dispatcherRegisterProfile(name)
{category="none", event="ProfileExecute", arg=name, title=T(_("Profile %1"), name), general=true})
end
local function dispatcherRemoveProfile(name)
local function dispatcherUnregisterProfile(name)
Dispatcher:removeAction("profile_exec_"..name)
end
@@ -143,7 +143,7 @@ function Profiles:getSubMenuItems()
end,
callback = function(touchmenu_instance)
if v.settings.registered then
dispatcherRemoveProfile(k)
dispatcherUnregisterProfile(k)
self.data[k].settings.registered = nil
else
dispatcherRegisterProfile(k)
@@ -166,7 +166,7 @@ function Profiles:getSubMenuItems()
callback = function(touchmenu_instance)
local function editCallback(new_name)
if v.settings.registered then
dispatcherRemoveProfile(k)
dispatcherUnregisterProfile(k)
dispatcherRegisterProfile(new_name)
end
self:renameAutostart(k, new_name)
@@ -205,7 +205,7 @@ function Profiles:getSubMenuItems()
ok_text = _("Delete"),
ok_callback = function()
if v.settings.registered then
dispatcherRemoveProfile(k)
dispatcherUnregisterProfile(k)
end
self:renameAutostart(k)
self.data[k] = nil