From 23bce343bb6eef10e0ba7ebaf45f280dcc354340 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 22 Mar 2022 20:38:23 +0100 Subject: [PATCH] ButtonProgressWidget: Make hold_callback optional (#8940) We don't need one in FrontLightWidget ;). Fix https://github.com/koreader/koreader/issues/8913#issuecomment-1074915143 --- frontend/ui/widget/buttonprogresswidget.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/frontend/ui/widget/buttonprogresswidget.lua b/frontend/ui/widget/buttonprogresswidget.lua index fa9ee86cf..0bc98c1b4 100644 --- a/frontend/ui/widget/buttonprogresswidget.lua +++ b/frontend/ui/widget/buttonprogresswidget.lua @@ -98,9 +98,7 @@ function ButtonProgressWidget:update() self.callback("-") self:update() end, - hold_callback = function() - self.hold_callback("-") - end, + hold_callback = self.hold_callback and function() self.hold_callback("-") end, } if self.thin_grey_style then button.frame.color = Blitbuffer.COLOR_DARK_GRAY @@ -147,9 +145,7 @@ function ButtonProgressWidget:update() self:update() end, no_focus = highlighted, - hold_callback = function() - self.hold_callback(i) - end, + hold_callback = self.hold_callback and function() self.hold_callback(i) end, } if self.thin_grey_style then if is_default then @@ -204,9 +200,7 @@ function ButtonProgressWidget:update() self.callback("+") self:update() end, - hold_callback = function() - self.hold_callback("+") - end, + hold_callback = self.hold_callback and function() self.hold_callback("+") end, } if self.thin_grey_style then @@ -241,9 +235,7 @@ function ButtonProgressWidget:update() self.callback("⋮") self:update() end, - hold_callback = function() - self.hold_callback("⋮") - end, + hold_callback = self.hold_callback and function() self.hold_callback("⋮") end, } if self.thin_grey_style then button.frame.color = Blitbuffer.COLOR_DARK_GRAY