[API Request] Implement the tools_menu context type
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(thunderbird_esr78 wontfix)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | wontfix |
People
(Reporter: TbSync, Assigned: TbSync)
References
Details
(Whiteboard: webextension-api-request)
Attachments
(1 file, 6 obsolete files)
16.55 KB,
patch
|
TbSync
:
review+
|
Details | Diff | Splinter Review |
Firefox has a tools_menu context type, which allows add-on authors to add menu entries to the tools menu.
I think it is a good thing for Thunderbird as well.
Maybe we can also have file_menu to add entries to the file menu?
Comment 1•5 years ago
|
||
I agree with tools_menu, but I'm not too much of a fan for file menu itself. We should expose menus where there are other complementary APIs involved. For example, the Message menu might make sense, because there are items related to the selected message. There aren't any APIs I'm aware of that relate to file menu operations.
When defining the names for the context type we also need to keep in mind Thunderbird has more than one window type where extensions make sense. so we might want to use e.g. main_tools_menu
(with tools_menu
being an alias), and main_message_menu
, or something like that.
Assignee | ||
Comment 2•5 years ago
|
||
The "restart" Addon (currently using experiments) mentioned in one of the topicbox threads is a good candidate for the file menu, to place "restart" close to "exit".
Philipp, restart is a good candidate to go into file menu, I am just converting an restart addon to webext or experiment.
I read that you are hesitant about file menu, but how many 'bad' menu entries have addons put into file menu in the last years? Are all these restrictions worth the efford? Wouldn't a bad addon author rather start deleting messages than flood the file menu with unwanted menuitems?
Maybe have a separator that shows where TB menuitems end and where addon menuitems start? The user always has the option to deinstall the addon.
I would more see a problem if an addon could make addon deinstallation impossible or difficult by moving those menu entries out of the visible area.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Going for the tools_menu. File menu needs to go in different bug.
Did not implement an alias for tools_menu as suggested by Fallen, as the API did not seem to support something like that. This is the same tools menu as used in Firefox, so we should be ok.
Other tool menus (address book, composer) will have to have a (thunderbird-only) prefix.
I added a test and I added an extra wait for the menus being created, as I run into issues where the tools menu was clicked before the API added its menu. I updated all other tests to wait for that as well.
Is this ok?
Any objections to adding the tools menu for composer and addressbook as well?
Comment 5•4 years ago
|
||
Assignee | ||
Comment 6•4 years ago
|
||
Fixed all review comments and added the other two menu entries.
Comment 7•4 years ago
|
||
(In reply to John Bieling (:TbSync) from comment #4)
Any objections to adding the tools menu for composer and addressbook as well?
Sorry, I never really responded to this, or realised quite what your intention was.
I can see that there's a potential use case for an address book tool or a compose tool that would want to only appear on the tools menu of the appropriate window(s). That it can be done by adding a single property at creation time seems good. But it's inflexible. What works now may not in the future. For example, it's planned to move the address book to a tab in the main window, which makes the addressbook_tools_menu
context obsolete. Also what happens if (when) we decide to include other menus, do we just keep adding contexts for every menu in every window?
Here's how I think we should approach it: for the tools_menu
context, add the menu item to the tools menu in all of the windows that have one (including messageWindow.xhtml which you seem to have forgotten about) and let the extension choose whether it is relevant. This can be done with an onShown
listener using the tab
argument provided:
browser.menus.onShown.addListener(
(info, tab) => browser.menus.update(info.menuIds[0], { visible: tab.mailTab })
);
To facilitate this, as I think we've discussed before, I think we should add tab type information to all tabs returned by API functions¹, then you could set the visibility based on tab.type == "addressbook"
or something like that. (In this way it wouldn't matter if the address book was in a window or a tab. Also we can add othe types such as "calendar" for more flexibility.) Perhaps we could even set the visibility based on tab type inside the menus API.
¹ I'm happy to implement this myself unless you want to. I may have even filed a bug somewhere already.
Assignee | ||
Comment 8•4 years ago
•
|
||
bad patch
Assignee | ||
Comment 10•4 years ago
|
||
Oh yes, I like that tab type approach. For this bug I reverted to a single "tools_menu" context and added the missing messagewindow test (now with a subtest_tools_menu to reduce redundancy).
The type on the tab is independent of this bug and we can move this forward without waiting for the tab type, right? I will have a look and if I see how to do that, I assign myself, if not I will NI you.
Assignee | ||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Assignee | ||
Comment 12•4 years ago
|
||
I fixed all reported issues. Seems I missed you on matrix, so I do ask for another review to be on the save side.
Comment 13•4 years ago
|
||
Assignee | ||
Comment 14•4 years ago
|
||
Fixed the reported issues.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Comment 15•4 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/4e67bbcddb96
Implement the tools_menu context type. r=darktrojan
Updated•4 years ago
|
Comment 16•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 17•4 years ago
|
||
Comment on attachment 9204555 [details] [diff] [review]
bug1598078_implement_tools_menu_v7.patch
[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky):
I am evaluating.
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Description
•