gimp menu - procedure positions
Hi,
On Thu, 2007-12-20 at 22:26 +0100, gg@catking.net wrote:
It would seem easy enough to add an extra arguement to indicate the
required position in the menu list. A value of minus one could indicate a
default placement, be that alphabetical or add-to-the-end.
I don't see how that could possibly work. At the time the plug-in
registers the menu entry the length of the menu isn't known. It might be
the first plug-in to register or others might have registered there
before. The order in which the procedures are registered can not be
relied on. Also the plug-in doesn't know anything about the other
plug-ins the user might have installed.
The current behavior (sorting alphabetically) is perhaps not ideal but
at least it creates a stable and predictable menu order.
What would perhaps help is if we allowed plug-ins to create menu groups.
These work like submenus as that anything registered into such a group
would be sorted alphabetically within that group. But that group would
appear as a group in the menu, perhaps even separated using menu
separators.
We already use such a mechanism, called placeholders in GTKUIManager
terminology. Look for example at the Print plug-in. It registers into
"/File/Send". "Send" is not a submenu of the File menu, but a
menu group. This way "Print" appears grouped with "Mail Image". What is
missing is an API for plug-ins to create such a group. Perhaps
gimp_plugin_menu_group_register() would do the trick. It would work like
gimp_plugin_menu_branch_register() but install a placeholder instead of
a submenu.
This would not solve all the needs raised by Lionel, but it would
probably help a lot already.
Sven