Game Load: cleaned up saves dir dropdown setup

This commit is contained in:
Charles Dang 2019-11-04 18:09:52 +11:00
parent 8309e4e150
commit a01f8ba01c

View File

@ -144,8 +144,6 @@ void game_load::pre_show(window& window)
std::bind(&game_load::browse_button_callback, this)); std::bind(&game_load::browse_button_callback, this));
menu_button& dir_list = find_widget<menu_button>(&window, "dirList", false); menu_button& dir_list = find_widget<menu_button>(&window, "dirList", false);
dir_list.set_use_markup(true);
dir_list.set_active(true);
set_save_dir_list(dir_list); set_save_dir_list(dir_list);
@ -163,26 +161,21 @@ void game_load::set_save_dir_list(menu_button& dir_list)
} }
std::vector<config> options; std::vector<config> options;
// The first option in the list is the current version's save dir // The first option in the list is the current version's save dir
{ options.emplace_back("label", _("Normal saves directory"), "path", "");
config option;
option["label"] = _("Normal saves directory");
option["path"] = "";
options.push_back(std::move(option));
}
for(const auto& known_dir : filesystem::find_other_version_saves_dirs()) { for(const auto& known_dir : other_dirs) {
if(!known_dir.path.empty()) { if(!known_dir.path.empty()) {
config option; options.emplace_back(
option["label"] = known_dir.version; "label", known_dir.version,
option["path"] = known_dir.path; "path", known_dir.path,
option["details"] = formatter() << "<span color='#777777'>(" << known_dir.path << ")</span>"; "details", formatter() << "<span color='#777777'>(" << known_dir.path << ")</span>"
options.push_back(std::move(option)); );
} }
} }
dir_list.set_values(options, 0); dir_list.set_values(options);
dir_list.set_visible(widget::visibility::visible);
} }
void game_load::populate_game_list(window& window) void game_load::populate_game_list(window& window)