CoverBrowser: fix files_per_page setting type (#5556)

Avoid saving/getting "12.0" (as the lua-ljsqlite3 driver does),
and save/get "12" instead by properly converting it to a string
and back, as the config.value table column is of type TEXT.
pull/5559/head
poire-z 5 years ago committed by GitHub
parent eb8795e4e0
commit 16c021a76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -793,14 +793,14 @@ function ListMenu:_recalculateDimen()
-- defined in the Menu class (14) because of inheritance.)
local files_per_page = BookInfoManager:getSetting("files_per_page")
if files_per_page then
self.perpage = files_per_page
self.perpage = tonumber(files_per_page)
else
-- perpage used to be static and computed from a base of 64px per ListMenuItem,
-- which gave 10 items both in filemanager and history on kobo glo hd.
-- Now that we can change the nb of items, let's start with a similar default
-- and save it so it's known as the initial value by the menu selection widget.
self.perpage = math.floor(available_height / scale_by_size / 64)
BookInfoManager:saveSetting("files_per_page", self.perpage)
BookInfoManager:saveSetting("files_per_page", tostring(self.perpage))
end
self.cover_sizetag = "s" .. self.perpage
if Screen:getWidth() > Screen:getHeight() then -- landscape mode

Loading…
Cancel
Save