Created attachment 2739 Patch file I've written a patch that will allow thunar extensions to create submenus. It required creating a new function that would be called recursively in order to add new submenu levels. I'd appreciate it if you could look specifically at the memory management in the new _add_custom_actions function, as I'm still pretty new to gobject memory management. I tried to match the style and conventions used in the rest of the code, but please correct me if anything isn't up to par. Thanks. Adam
Created attachment 2740 Modified thunar-wallpaper plugin file to demonstrate submenus I've added twp-provider.c to demonstrate how one would add a submenu and items. This replaces /thunar/plugins/thunar-wallpaper/twp-provider.c.
It's already possible to attach submenus to folder actions. Just subclass GtkAction and implement create_menu_item() as appropriate. Thunar itself does this in various places. This way you don't need to create GtkAction's for the submenu items, but you can fill it on demand with GtkMenuItem's. See the template action for an example.
I noticed that thunar-vcs-plugin subclasses GtkAction as well. However, do you need a separate subclass for each GtkAction that has a submenu, or can you just have a MyGtkAction subclass that you can use to create arbitrary submenus to an arbitrary level?
Well, a single class would do, depending on what you put into the create_menu_item() method.
(In reply to comment #4) > Well, a single class would do, depending on what you put into the > create_menu_item() method. While it may be possible to do this with a GtkAction subclass, I think it would be quite a bit simpler to just use a GtkAction and be able to create submenus and sub-submenus in an intuitive and relatively straightforward fashion. My patch is fairly small and doesn't add much complexity.