Add a refresh button to the serverlist (#6957)
authorTre <ThomasMonroe@protonmail.com>
Mon, 19 Feb 2018 07:25:57 +0000 (01:25 -0600)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 19 Feb 2018 07:25:57 +0000 (08:25 +0100)
* add refresh button

* Make search and refresh buttons smaller

* Change to image button

LICENSE.txt
builtin/mainmenu/tab_online.lua
textures/base/pack/refresh.png [new file with mode: 0644]

index c87e74e2122161a194c5ce7567509ea1359114cd..92954e7ebfc7aa1994275d14ffb2b257e3925430 100644 (file)
@@ -8,6 +8,9 @@ distribution.
 Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
 http://creativecommons.org/licenses/by-sa/3.0/
 
+textures/base/pack/refresh.png is under the Apache 2 license
+https://www.apache.org/licenses/LICENSE-2.0.html
+
 Authors of media files
 -----------------------
 Everything not listed in here:
index e3c583614b7f09ac1e85a81e23078efa15806b39..8e88a7743eb7ed72dd50fa5c8528bb5b1a327bcb 100644 (file)
@@ -33,8 +33,10 @@ local function get_formspec(tabview, name, tabdata)
 
        local retval =
                -- Search
-               "field[0.15,0.075;6.05,1;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
-               "button[5.8,-0.25;2,1;btn_mp_search;" .. fgettext("Search") .. "]" ..
+               "field[0.15,0.075;5.91,1;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
+               "button[5.62,-0.25;1.5,1;btn_mp_search;" .. fgettext("Search") .. "]" ..
+               "image_button[6.97,-.165;.83,.83;" .. core.formspec_escape(defaulttexturedir .. "refresh.png")
+                       .. ";btn_mp_refresh;" .. fgettext("") .. "]" ..
 
                -- Address / Port
                "label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
@@ -300,6 +302,11 @@ local function main_button_handler(tabview, fields, name, tabdata)
                return true
        end
 
+       if fields.btn_mp_refresh then
+               asyncOnlineFavourites()
+               return true
+       end
+
        if (fields.btn_mp_connect or fields.key_enter)
                        and fields.te_address ~= "" and fields.te_port then
                gamedata.playername = fields.te_name
diff --git a/textures/base/pack/refresh.png b/textures/base/pack/refresh.png
new file mode 100644 (file)
index 0000000..7193677
Binary files /dev/null and b/textures/base/pack/refresh.png differ