mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
Apply suggestions from code review
This commit is contained in:
parent
792dca6265
commit
6f2ef8c024
1 changed files with 35 additions and 32 deletions
|
@ -47,10 +47,7 @@ local tabs = {
|
||||||
}
|
}
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_event_handler(tabview, event)
|
local function show_exit_dialog(tabview, show_dialog)
|
||||||
if event == "MenuQuit" then
|
|
||||||
local show_dialog = core.settings:get_bool("enable_esc_dialog")
|
|
||||||
if not ui.childlist["mainmenu_quit_confirm"] and show_dialog then
|
|
||||||
tabview:hide()
|
tabview:hide()
|
||||||
local dlg = dialog_create(
|
local dlg = dialog_create(
|
||||||
"mainmenu_quit_confirm",
|
"mainmenu_quit_confirm",
|
||||||
|
@ -64,8 +61,7 @@ local function main_event_handler(tabview, event)
|
||||||
end,
|
end,
|
||||||
function(this, fields)
|
function(this, fields)
|
||||||
if fields.cb_show_dialog ~= nil then
|
if fields.cb_show_dialog ~= nil then
|
||||||
local value = (fields.cb_show_dialog == "true") and "true" or "false"
|
core.settings:set_bool("enable_esc_dialog", core.is_yes(fields.cb_show_dialog))
|
||||||
core.settings:set("enable_esc_dialog", value)
|
|
||||||
return false
|
return false
|
||||||
elseif fields.btn_quit_confirm_yes then
|
elseif fields.btn_quit_confirm_yes then
|
||||||
this:delete()
|
this:delete()
|
||||||
|
@ -83,6 +79,13 @@ local function main_event_handler(tabview, event)
|
||||||
)
|
)
|
||||||
dlg:set_parent(tabview)
|
dlg:set_parent(tabview)
|
||||||
dlg:show()
|
dlg:show()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function main_event_handler(tabview, event)
|
||||||
|
if event == "MenuQuit" then
|
||||||
|
local show_dialog = core.settings:get_bool("enable_esc_dialog")
|
||||||
|
if not ui.childlist["mainmenu_quit_confirm"] and show_dialog then
|
||||||
|
show_exit_dialog(tabview, show_dialog)
|
||||||
else
|
else
|
||||||
core.close()
|
core.close()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue