Repository navigation
Show the website name on the search item of the history menu - #387
Merged
Merged
Conversation
The search row of the main window takes the website name set in the preferences, but the history context menus kept "Search on YouTube" while searching on the configured website. Relabel their search item at startup and when the name changes.
Owner
|
Thank you, if you submit AI-issued PRs please think to check that all tests are relevant and that the comments and function names are clear. |
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.
The website name set in the preferences ("Search on YouTube" by default) is shown on the search row of the main window, but the history and favorites context menus always said "Search on YouTube", even though that item opens the configured website. With a custom search engine, the menu promised YouTube and opened another site.
This change:
set_search_item_label(menu, label)incontext_menu.rs. It finds the item with thehistory-menu.search-on-youtubeaction in the sections of a menu, and replaces it with a copy that has the new label, at the same position, with the same action and icon (aGMenuitem can't be relabeled in place);show_website_search_labelinmain_window.rs, which sets the main window's search row title, as before, and relabels the search item of both history context menus. It's called at startup and when the website name changes in the preferences.The stored preference and the action are unchanged.
Testing:
history_context_model: the search item takes the new label and keeps its action, icon and position, the other items are untouched, and a second rename relabels the same item. It fails if the action name doesn't match.website_search_text = "Search on Bandcamp"inpreferences.toml: bothhistory_context_modelandhistory_context_model_favedhad the item relabeled, with its action and icon (checked with a temporary log, not committed). I didn't open the menu by hand.cargo testandcargo test --no-default-features -F ffmpeg: passing on macOS.cargo fmt --check: clean. No new warnings.