Files
gimp/menus/channels-menu.ui
Jehan 9c7469fb22 app, menus: handle the case where a menu is used both as popup and submenu.
Several menus can be triggered either as popups on their own when right-clicking
the dockable or on items, or as a submenu in the docks main menu.
In the former case, we want the menu items to be at the root level, whereas in
the latter case, we want them inside a properly named submenu.

To handle this, I wrap these in a properly labelled <submenu> in the .ui files,
and I add a boolean flag to gimp_menu_shell_fill() which will drop the top
submenu if and only if this is the only top item. I use this flag only when
using these menus as popup menu on their own.

Also fixing a few memory leaks around these pieces of code.
2023-04-12 22:07:08 +02:00

38 lines
2.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<interface>
<menu id="/channels-popup">
<submenu>
<attribute name="label" translatable="yes" context="channels-action">Channels Menu</attribute>
<attribute name="icon">gimp-channels</attribute>
<item><attribute name="action">app.channels-edit-attributes</attribute></item>
<submenu>
<attribute name="label">Color Tags</attribute>
<item><attribute name="action">app.channels-color-tag-none</attribute></item>
<item><attribute name="action">app.channels-color-tag-blue</attribute></item>
<item><attribute name="action">app.channels-color-tag-green</attribute></item>
<item><attribute name="action">app.channels-color-tag-yellow</attribute></item>
<item><attribute name="action">app.channels-color-tag-orange</attribute></item>
<item><attribute name="action">app.channels-color-tag-brown</attribute></item>
<item><attribute name="action">app.channels-color-tag-red</attribute></item>
<item><attribute name="action">app.channels-color-tag-violet</attribute></item>
<item><attribute name="action">app.channels-color-tag-gray</attribute></item>
</submenu>
<section>
<item><attribute name="action">app.channels-new</attribute></item>
<item><attribute name="action">app.channels-raise</attribute></item>
<item><attribute name="action">app.channels-lower</attribute></item>
<item><attribute name="action">app.channels-duplicate</attribute></item>
<item><attribute name="action">app.channels-delete</attribute></item>
</section>
<section>
<item><attribute name="action">app.channels-selection-replace</attribute></item>
<item><attribute name="action">app.channels-selection-add</attribute></item>
<item><attribute name="action">app.channels-selection-subtract</attribute></item>
<item><attribute name="action">app.channels-selection-intersect</attribute></item>
</section>
</submenu>
</menu>
</interface>