Update gamebar on tab enter (#8192)
authorPaul Ouellette <oue.paul18@gmail.com>
Mon, 18 Feb 2019 21:04:43 +0000 (16:04 -0500)
committerParamat <paramat@users.noreply.github.com>
Mon, 18 Feb 2019 21:04:43 +0000 (21:04 +0000)
builtin/mainmenu/init.lua
builtin/mainmenu/tab_local.lua

index 8b8f3cd39ff9f409fc6dace6a11cf9d6edbddb72..130c3e73cf61a518ab86486e3ee43f638487ddcd 100644 (file)
@@ -144,7 +144,10 @@ local function init_globals()
        tv_main:set_fixed_size(false)
 
        if menustyle ~= "simple" then
-               tv_main:set_tab(core.settings:get("maintab_LAST"))
+               local last_tab = core.settings:get("maintab_LAST")
+               if last_tab and tv_main.current_tab ~= last_tab then
+                       tv_main:set_tab(last_tab)
+               end
        end
        ui.set_default("maintab")
        tv_main:show()
index 915258b484e68f5c7f95543a0f9b132f6fa6c5f6..15ef96dc855ff18aa5ac3da2957cc1e8719154f5 100644 (file)
@@ -294,13 +294,6 @@ end
 local on_change
 if enable_gamebar then
        function on_change(type, old_tab, new_tab)
-               local buttonbar = ui.find_by_name("game_button_bar")
-
-               if ( buttonbar == nil ) then
-                       singleplayer_refresh_gamebar()
-                       buttonbar = ui.find_by_name("game_button_bar")
-               end
-
                if (type == "ENTER") then
                        local game = current_game()
 
@@ -309,10 +302,15 @@ if enable_gamebar then
                                core.set_topleft_text(game.name)
                                mm_texture.update("singleplayer",game)
                        end
-                       buttonbar:show()
+
+                       singleplayer_refresh_gamebar()
+                       ui.find_by_name("game_button_bar"):show()
                else
                        menudata.worldlist:set_filtercriteria(nil)
-                       buttonbar:hide()
+                       local gamebar = ui.find_by_name("game_button_bar")
+                       if gamebar then
+                               gamebar:hide()
+                       end
                        core.set_topleft_text("")
                        mm_texture.update(new_tab,nil)
                end