Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a refresh button to the serverlist (#6957)
* add refresh button

* Make search and refresh buttons smaller

* Change to image button
  • Loading branch information
ThomasMonroe314 authored and nerzhul committed Feb 19, 2018
1 parent 4bb41a1 commit 5ef9056
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions LICENSE.txt
Expand Up @@ -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:
Expand Down
11 changes: 9 additions & 2 deletions builtin/mainmenu/tab_online.lua
Expand Up @@ -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") .. "]" ..
Expand Down Expand Up @@ -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
Expand Down
Binary file added textures/base/pack/refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

2 comments on commit 5ef9056

@Fixer-007
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Wuzzy2
Copy link
Contributor

@Wuzzy2 Wuzzy2 commented on 5ef9056 Feb 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.