Skip to content

Disable Upgrade All Boxes when there are no boxes - #217

Open
kacperpaczos wants to merge 2 commits into
Dvlv:masterfrom
kacperpaczos:feat/gate-upgrade-all
Open

Disable Upgrade All Boxes when there are no boxes#217
kacperpaczos wants to merge 2 commits into
Dvlv:masterfrom
kacperpaczos:feat/gate-upgrade-all

Conversation

@kacperpaczos

@kacperpaczos kacperpaczos commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant