Skip to content

Commit 657a3d1

Browse files
ClobberXDparamat
authored andcommittedNov 13, 2018
dlg_contentstore.lua: Various fixes and improvements (#7612)
Add missing 'core.formspec_escape' to 'get_screenshot'. Add warning label when no packages fetched. Internal name of the "Update" button was the same as "Install". Rename to 'update_'.
1 parent 85b01ea commit 657a3d1

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed
 

Diff for: ‎builtin/mainmenu/dlg_contentstore.lua

+25-17
Original file line numberDiff line numberDiff line change
@@ -356,21 +356,29 @@ function store.get_formspec()
356356
cur_page = 1
357357
end
358358

359-
local formspec = {
360-
"size[12,7;true]",
361-
"position[0.5,0.55]",
362-
"field[0.2,0.1;7.8,1;search_string;;", core.formspec_escape(search_string), "]",
363-
"field_close_on_enter[search_string;false]",
364-
"button[7.7,-0.2;2,1;search;", fgettext("Search"), "]",
365-
"dropdown[9.7,-0.1;2.4;type;",
366-
table.concat(filter_types_titles, ","),
367-
";",
368-
filter_type,
369-
"]",
370-
-- "textlist[0,1;2.4,5.6;a;",
371-
-- table.concat(taglist, ","),
372-
-- "]"
373-
}
359+
local formspec
360+
if #store.packages ~= 0 then
361+
formspec = {
362+
"size[12,7;true]",
363+
"position[0.5,0.55]",
364+
"field[0.2,0.1;7.8,1;search_string;;",
365+
core.formspec_escape(search_string), "]",
366+
"field_close_on_enter[search_string;false]",
367+
"button[7.7,-0.2;2,1;search;",
368+
fgettext("Search"), "]",
369+
"dropdown[9.7,-0.1;2.4;type;",
370+
table.concat(filter_types_titles, ","),
371+
";", filter_type, "]",
372+
-- "textlist[0,1;2.4,5.6;a;",
373+
-- table.concat(taglist, ","), "]",
374+
}
375+
else
376+
formspec = {
377+
"size[12,7;true]",
378+
"position[0.5,0.55]",
379+
"label[4,3;No packages could be retrieved]",
380+
}
381+
end
374382

375383
local start_idx = (cur_page - 1) * num_per_page + 1
376384
for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do
@@ -381,7 +389,7 @@ function store.get_formspec()
381389

382390
-- image
383391
formspec[#formspec + 1] = "image[-0.4,0;1.5,1;"
384-
formspec[#formspec + 1] = get_screenshot(package)
392+
formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package))
385393
formspec[#formspec + 1] = "]"
386394

387395
-- title
@@ -404,7 +412,7 @@ function store.get_formspec()
404412
formspec[#formspec + 1] = fgettext("Install")
405413
formspec[#formspec + 1] = "]"
406414
elseif package.installed_release < package.release then
407-
formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_"
415+
formspec[#formspec + 1] = "button[8.4,0;1.5,1;update_"
408416
formspec[#formspec + 1] = tostring(i)
409417
formspec[#formspec + 1] = ";"
410418
formspec[#formspec + 1] = fgettext("Update")

0 commit comments

Comments
 (0)
Please sign in to comment.