Skip to content

Disable toolbar buttons that would do nothing - #5614

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
disable-idle-toolbar-buttons
Oct 27, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
disable-idle-toolbar-buttons

Conversation

@GabrielDuf

@GabrielDuf Gabriel Dufresne (GabrielDuf) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Several buttons in the package pages' toolbar were always enabled, even when clicking them could do nothing. For example, Package details with no package selected, or with several checked. They are now disabled until they have something to act on.

Needs exactly one package (the focused row, or else the only checked package — the same rule the buttons already used when clicked):

  • Package details
  • Install / Uninstall / Update options
  • Manual install / uninstall / update
  • Pin version (Catalog Editor)

Needs at least one checked package:

  • The main Install / Uninstall / Update selection button and its dropdown
  • Ignore selected packages
  • Add selection to bundle
  • Remove selection from bundle
  • Remove selection from catalog (a focused row also counts)

The Catalog Editor buttons also still require an editable, selected catalog.

Left unchanged: Reload, Export to CSV (it reports "nothing to export" itself), Manage ignored updates, and the bundle file actions.

Implementation

  • AbstractPackagesPage gains EnableWhen(control, predicate). The predicates are rechecked on FilteredPackages.SelectionStateChanged and PackageList.SelectionChanged.
  • Rechecks are posted to the dispatcher and coalesced, so select-all (which checks rows one by one) refreshes the toolbar once instead of once per row. Posting also keeps subclass predicates from running before the subclass constructor finishes, since GenerateToolBar is called from the base constructor.
  • The overflow menu already copies each button's IsEnabled, so overflowed items follow along.

Known gap: on the Bundles page, the main Install button is enabled whenever something is checked, even if every checked package is already installed and would be skipped.

Testing

  • Tried manually on macOS: Discover, Installed, Updates, Bundles and the Catalog Editor.
  • New headless test ToolbarSelectionStateTests drives the Catalog Editor toolbar through zero, one and two checked packages. UniGetUI.Tests targets Windows, so locally it ran from a temporary net10.0 project that compiles the same file; CI is the first real run of the test project.
  • dotnet format whitespace and dotnet format style checks pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the selection-aware package toolbar changes.

No open issues 🎉

What changed in this PR

This PR makes UniGetUI’s package-page toolbars reflect the current selection, disabling actions when they have no package to act on.

Changes:

  • Adds shared selection predicates with coalesced dispatcher refreshes.
  • Applies selection requirements across Discover, Installed, Updates, Bundles, and Catalog Editor, preserving catalog editability checks.
  • Adds a headless Catalog Editor test covering zero, one, and two checked packages.
File Description
src/​UniGetUI.Tests/​ToolbarSelectionStateTests.cs Tests toolbar enabled states as checked selections change.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​SoftwareUpdatesPage.cs Gates update, options, manual update, details, and ignore actions.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​PackageBundlesPage.cs Gates installation, removal, and package details actions.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​InstalledPackagesPage.cs Gates uninstall, single-package, ignore, and bundle-export actions.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​DiscoverSoftwarePage.cs Gates installation, single-package, and bundle-export actions.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​CatalogEditorPage.cs Combines selection requirements with catalog editability checks.
src/​UniGetUI.Avalonia/​Views/​SoftwarePages/​AbstractPackagesPage.axaml.cs Adds reusable selection gates and coalesced toolbar refreshes.

Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "4a780cf0-d234-11f1-9782-6371075ae569",
	"headSha": "96aecde20ac361078021658b4328a71922f838b6",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 8ef5ef1 into main Oct 27, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the disable-idle-toolbar-buttons branch October 27, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants