In mousepad what is the "shared" concept with menus?
Gaël Bonithon
trash.paradise at protonmail.com
Mon Jun 29 20:07:34 CEST 2026
Yes, as explained in the comments in [https://gitlab.xfce.org/apps/mousepad/-/blob/master/mousepad/resources/gtk/menus-common.ui](https://gitlab.xfce.org/apps/mousepad/-/blob/master/mousepad/resources/gtk/menus-common.ui?ref_type=heads) , unfortunately there is no syntax for sharing GMenu elements/sections in GtkBuilder, so I cobbled one together using what I had available: the ability to specify arbitrary attributes. Then there’s still a bit of work to do in C to set all of this up (and update it as needed): GMenu is a fairly low-level API.
Sharing doesn’t just happen between the menu bar and the toolbar; there’s also the tab menu and the text view’s context menu.
Cheers,
Gaël
On Thursday, June 25th, 2026 at 8:20 PM, Robert <user6402088 at gmail.com> wrote:
> Good day,
>
> in mousepad there are various "shared menu" lines of code. Can you confirm that this concept is because some menu items are also toolbar items. Also the code in mousepad-application.c -> mousepad_application_set_shared_menu_parts is used to wire-up the shared menus?
>
> e.g. File -> New is also on the toolbar "Create a new document"?
>
> [image.png]
>
> Or in case that is wrong what are shared menu parts?
>
> Here links to some of the code that I am refering to
>
> mousepad_application_set_shared_menu_parts
> https://gitlab.xfce.org/apps/mousepad/-/blob/master/mousepad/mousepad-application.c?ref_type=heads#L1420
> [image.png]
>
> menus.ui
> https://gitlab.xfce.org/apps/mousepad/-/blob/master/mousepad/resources/gtk/menus.ui?ref_type=heads#L23
> [image.png]
>
> Kind regards and thanks in advance for helping
> Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20260629/fcb2a085/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 101361 bytes
Desc: not available
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20260629/fcb2a085/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 26012 bytes
Desc: not available
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20260629/fcb2a085/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 38832 bytes
Desc: not available
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20260629/fcb2a085/attachment-0005.png>
More information about the Xfce4-dev
mailing list