Disable Upgrade All Boxes when there are no boxes - #217
Open
kacperpaczos wants to merge 2 commits into
Open
Conversation
The Upgrade All button in the header stayed clickable even with no boxes, where it can only run distrobox upgrade over an empty list and do nothing. Gate it on the box count as well as the dependency check, and re-evaluate it whenever the list is (re)loaded so it follows create and delete.
The header button now binds to a "win.upgrade-all" action and its sensitivity follows the action's enabled state, which load_boxes sets from the box count. That drops the named-widget lookup, the tree walk and the one-line predicate with its tests; the behaviour is the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed the Upgrade All Boxes button in the header stays clickable even when there are no boxes at all. Clicking it there just runs the upgrade over an empty list, so it looks like it should do something but can't.
This makes Upgrade All a window action (
win.upgrade-all) and binds the header button to it, so the button's sensitivity simply follows the action's enabled state. Loading the box list enables the action when there is at least one box and disables it otherwise, so the button follows along as you create your first box or delete your last one — and because the list only loads once distrobox and a container engine are present, the existing dependency gating falls out of the same switch.Verified on a virtual display with a stub
distrobox list: zero boxes → the button is greyed out, one box → it is live.