End of document action menu: radiomark (#8812)

reviewable/pr8823/r1
hius07 2 years ago committed by GitHub
parent 8026370d5c
commit e167388e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -350,12 +350,13 @@ local back_to_exit_str = {
always = {_("Always"), _("always")}, always = {_("Always"), _("always")},
disable ={_("Disable"), _("disable")}, disable ={_("Disable"), _("disable")},
} }
local function genGenericMenuEntry(title, setting, value, default) local function genGenericMenuEntry(title, setting, value, default, radiomark)
return { return {
text = title, text = title,
checked_func = function() checked_func = function()
return G_reader_settings:readSetting(setting, default) == value return G_reader_settings:readSetting(setting, default) == value
end, end,
radio = radiomark,
callback = function() callback = function()
G_reader_settings:saveSetting(setting, value) G_reader_settings:saveSetting(setting, value)
end, end,
@ -555,10 +556,10 @@ common_settings.document_end_action = {
end, end,
separator = true, separator = true,
}, },
genGenericMenuEntry(_("Ask with popup dialog"), "end_document_action", "pop-up", "pop-up"), genGenericMenuEntry(_("Ask with popup dialog"), "end_document_action", "pop-up", "pop-up", true),
genGenericMenuEntry(_("Do nothing"), "end_document_action", "nothing"), genGenericMenuEntry(_("Do nothing"), "end_document_action", "nothing", nil, true),
genGenericMenuEntry(_("Book status"), "end_document_action", "book_status"), genGenericMenuEntry(_("Book status"), "end_document_action", "book_status", nil, true),
genGenericMenuEntry(_("Delete file"), "end_document_action", "delete_file"), genGenericMenuEntry(_("Delete file"), "end_document_action", "delete_file", nil, true),
{ {
text = _("Open next file"), text = _("Open next file"),
enabled_func = function() enabled_func = function()
@ -567,14 +568,15 @@ common_settings.document_end_action = {
checked_func = function() checked_func = function()
return G_reader_settings:readSetting("end_document_action") == "next_file" return G_reader_settings:readSetting("end_document_action") == "next_file"
end, end,
radio = true,
callback = function() callback = function()
G_reader_settings:saveSetting("end_document_action", "next_file") G_reader_settings:saveSetting("end_document_action", "next_file")
end, end,
}, },
genGenericMenuEntry(_("Go to beginning"), "end_document_action", "goto_beginning"), genGenericMenuEntry(_("Go to beginning"), "end_document_action", "goto_beginning", nil, true),
genGenericMenuEntry(_("Return to file browser"), "end_document_action", "file_browser"), genGenericMenuEntry(_("Return to file browser"), "end_document_action", "file_browser", nil, true),
genGenericMenuEntry(_("Mark book as read"), "end_document_action", "mark_read"), genGenericMenuEntry(_("Mark book as read"), "end_document_action", "mark_read", nil, true),
genGenericMenuEntry(_("Book status and return to file browser"), "end_document_action", "book_status_file_browser"), genGenericMenuEntry(_("Book status and return to file browser"), "end_document_action", "book_status_file_browser", nil, true),
} }
} }

Loading…
Cancel
Save