Skip to content

Commit 5ef9056

Browse files
ThomasMonroe314nerzhul
authored andcommittedFeb 19, 2018
Add a refresh button to the serverlist (#6957)
* add refresh button * Make search and refresh buttons smaller * Change to image button
1 parent 4bb41a1 commit 5ef9056

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
 

‎LICENSE.txt

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ distribution.
88
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
99
http://creativecommons.org/licenses/by-sa/3.0/
1010

11+
textures/base/pack/refresh.png is under the Apache 2 license
12+
https://www.apache.org/licenses/LICENSE-2.0.html
13+
1114
Authors of media files
1215
-----------------------
1316
Everything not listed in here:

‎builtin/mainmenu/tab_online.lua

+9-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ local function get_formspec(tabview, name, tabdata)
3333

3434
local retval =
3535
-- Search
36-
"field[0.15,0.075;6.05,1;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
37-
"button[5.8,-0.25;2,1;btn_mp_search;" .. fgettext("Search") .. "]" ..
36+
"field[0.15,0.075;5.91,1;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
37+
"button[5.62,-0.25;1.5,1;btn_mp_search;" .. fgettext("Search") .. "]" ..
38+
"image_button[6.97,-.165;.83,.83;" .. core.formspec_escape(defaulttexturedir .. "refresh.png")
39+
.. ";btn_mp_refresh;" .. fgettext("") .. "]" ..
3840

3941
-- Address / Port
4042
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
@@ -300,6 +302,11 @@ local function main_button_handler(tabview, fields, name, tabdata)
300302
return true
301303
end
302304

305+
if fields.btn_mp_refresh then
306+
asyncOnlineFavourites()
307+
return true
308+
end
309+
303310
if (fields.btn_mp_connect or fields.key_enter)
304311
and fields.te_address ~= "" and fields.te_port then
305312
gamedata.playername = fields.te_name

‎textures/base/pack/refresh.png

3.57 KB
Loading

2 commit comments

Comments
 (2)

Fixer-007 commented on Feb 21, 2018

@Fixer-007
Contributor

Seems like I have a regression, aka text over the button:
default

Wuzzy2 commented on Feb 9, 2019

@Wuzzy2
Contributor

One does not simply call fgettext with an empty string! The empty string has a special meaning in Gettext / the PO file format, look it up.
Unsurprisingly, this commit caused updatepo.sh to break!
Also, this is the reason why @Fixer-007's regression happened!

Please be more careful next time, @ThomasMonroe314 and @nerzhul!

Please sign in to comment.