diff options
Diffstat (limited to 'builtin/mainmenu/tab_content.lua')
| -rw-r--r-- | builtin/mainmenu/tab_content.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua index a76fee864..1bffeeb22 100644 --- a/builtin/mainmenu/tab_content.lua +++ b/builtin/mainmenu/tab_content.lua @@ -206,15 +206,27 @@ local function get_formspec(tabview, name, tabdata) end -------------------------------------------------------------------------------- +local function handle_doubleclick(pkg, pkg_name) + 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 + elseif pkg.is_clientside then + pkgmgr.enable_mod({data = {list = packages, selected_mod = pkg_name}}) + 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 - local mod = packages:get_list()[tabdata.selected_pkg] - - if event.type == "DCL" and mod.is_clientside then - pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}) - packages = nil + if event.type == "DCL" then + handle_doubleclick(packages:get_list()[tabdata.selected_pkg], tabdata.selected_pkg) end return true end |
