GUI2/Addon Manager: fixed delete buttons not functioning correctly for published addons

Fixed the following:

* The large delete button was always being grayed out for publishable addons.
* The small delete button was only being displayed for publishable addons where the local version equaled
  the remote version.

New behavior:
* Both delete buttons are grayed out for non-published addons and displayed always otherwise.
This commit is contained in:
Charles Dang 2017-08-09 23:13:57 +11:00
parent bdb9b4a513
commit 5e650d3bc1
2 changed files with 7 additions and 6 deletions

View file

@ -573,7 +573,7 @@ boost::dynamic_bitset<> addon_manager::get_type_filter_visibility(const window&
void addon_manager::apply_filters(window& window)
{
boost::dynamic_bitset<> res =
boost::dynamic_bitset<> res =
get_status_filter_visibility(window)
& get_type_filter_visibility(window)
& get_name_filter_visibility(window);
@ -850,9 +850,9 @@ void addon_manager::on_addon_select(window& window)
} else {
action_stack.select_layer(1);
// TODO: are these the right flags to check?
find_widget<button>(parent, "publish", false).set_active(installed);
find_widget<button>(parent, "delete", false).set_active(!installed);
// Always enable the publish button, but disable the delete button if not yet published.
find_widget<button>(parent, "publish", false).set_active(true);
find_widget<button>(parent, "delete", false).set_active(!info->local_only);
}
}

View file

@ -229,6 +229,7 @@ void addon_list::set_addons(const addons_list& addons)
find_widget<label>(row_grid, "installation_status", false).set_visible(install_status_visibility_);
} else {
const bool is_updatable = tracking_info.state == ADDON_INSTALLED_OUTDATED;
const bool can_delete = !addon.local_only;
button& install_button = find_widget<button>(control_grid, "single_install", false);
button& update_button = find_widget<button>(control_grid, "single_update", false);
@ -236,7 +237,7 @@ void addon_list::set_addons(const addons_list& addons)
install_button.set_active(true);
update_button.set_active(true);
uninstall_button.set_active(tracking_info.state == ADDON_INSTALLED);
uninstall_button.set_active(can_delete);
if(true) {
gui2::event::connect_signal_mouse_left_click(
@ -264,7 +265,7 @@ void addon_list::set_addons(const addons_list& addons)
update_button.set_tooltip(_("Send new version to server"));
}
if(tracking_info.state == ADDON_INSTALLED) {
if(can_delete) {
gui2::event::connect_signal_mouse_left_click(
uninstall_button,
[this, addon](gui2::event::dispatcher&, const gui2::event::ui_event, bool& handled, bool& halt)