Skip to content

Fix linux menu for settings & doctor#138

Open
aritchie wants to merge 2 commits intomainfrom
dev/aritchie/linux-menu-fixes
Open

Fix linux menu for settings & doctor#138
aritchie wants to merge 2 commits intomainfrom
dev/aritchie/linux-menu-fixes

Conversation

@aritchie
Copy link
Copy Markdown
Collaborator

This pull request adds the ability for native UI elements to trigger navigation to Blazor routes, and introduces a new "Doctor" button to the Linux GTK toolbar that uses this feature to navigate to a diagnostic page. The changes include updates to the toolbar service interface and implementation, the GTK toolbar manager, and the main layout component to support and handle navigation requests from native UI.

Native-to-Blazor Navigation Integration:

  • Added a new event NavigationRequested and method RequestNavigation to the IToolbarService interface and implemented them in ToolbarService, allowing native UI to request navigation to a specific Blazor route. [1] [2]
  • Subscribed to and handled the NavigationRequested event in MainLayout.razor to perform navigation using NavManager, and ensured proper event unsubscription during component disposal. [1] [2] [3]

GTK Toolbar Enhancements:

  • Added a new "Doctor" button to the Linux GTK toolbar, which uses a context-sensitive icon and, when clicked, triggers navigation to the /doctor route via the new toolbar service method. Also repositioned the settings button to be beside the Copilot button for improved UI consistency.

Part of this effort will be in conflict with #136 - but merge is simple

Copilot AI review requested due to automatic review settings March 31, 2026 14:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables native UI (Linux GTK toolbar) to request Blazor route navigation via IToolbarService, and uses that mechanism to add a dedicated “Doctor” button on Linux for navigating to the diagnostic page.

Changes:

  • Extended IToolbarService / ToolbarService with a NavigationRequested event plus RequestNavigation(route) to bridge native UI → Blazor routing.
  • Wired MainLayout.razor to listen for navigation requests and navigate via NavigationManager.
  • Updated the Linux GTK header bar to reposition Settings and add a Doctor button that triggers navigation to /doctor.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/MauiSherpa/Components/MainLayout.razor Subscribes to toolbar navigation requests and performs Blazor navigation.
src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs Adds/repositions persistent GTK header buttons (Settings + new Doctor) and triggers native→Blazor navigation.
src/MauiSherpa.Core/Services/ToolbarService.cs Implements the new navigation request event + method on the toolbar service.
src/MauiSherpa.Core/Interfaces.cs Extends IToolbarService contract to expose navigation requests from native UI.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants