From d51d0d77c4e88dec8f9670942e19595cbb3a0234 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Wed, 24 Feb 2021 05:50:19 -0500 Subject: Allow toggling of texture pack by double clicking --- builtin/mainmenu/tab_content.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'builtin/mainmenu') diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua index 336730bf4..fb7f121f8 100644 --- a/builtin/mainmenu/tab_content.lua +++ b/builtin/mainmenu/tab_content.lua @@ -145,11 +145,26 @@ local function get_formspec(tabview, name, tabdata) return retval end +-------------------------------------------------------------------------------- +local function handle_doubleclick(pkg) + if pkg.type == "txp" then + if core.settings:get("texture_path") == pkg.path then + core.settings:set("texture_path", "") + else + core.settings:set("texture_path", pkg.path) + end + packages = nil + end +end + -------------------------------------------------------------------------------- local function handle_buttons(tabview, fields, tabname, tabdata) if fields["pkglist"] ~= nil then local event = core.explode_table_event(fields["pkglist"]) tabdata.selected_pkg = event.row + if event.type == "DCL" then + handle_doubleclick(packages:get_list()[tabdata.selected_pkg]) + end return true end -- cgit v1.2.3