After digging in a bit more, the reason why thunar-vcs-plugin is able to create submenus is because they register a new menu provider for each submenu. While this works to a degree, I'd like to have more flexibility as well as allow more than one level of submenus to be possible.
In order to get "real" submenus working for thunar extensions, the thunar_standard_view_merge_custom_actions() function needs to be modified and a new *_add_custom_actions function needs to be created to recursively add submenus and submenu actions. Nautilus does something similar to this, actually. I've got a working patch for thunar that I will be submitting shortly. Adam On Mon, Dec 14, 2009 at 10:07 AM, Adam Plumb <adampl...@gmail.com> wrote: > I'm trying to create a simple submenu for a thunar extension, and I just > can't get it to show up. The parent item shows up fine, but the submenu > does not. Here is the get_file_actions code I'm using... > > static GList* > twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider, > GtkWidget *window, > GList *files) > { > GtkWidget *action = NULL; > GList *actions = NULL; > GtkWidget *item = NULL; > GtkWidget *menu = NULL; > GtkAction *subaction = NULL; > GtkWidget *subitem = NULL; > > action = gtk_action_new("Txp::menuitem", > NULL, > "Menu Parent", > NULL); > > item = gtk_action_create_menu_item(GTK_ACTION(action)); > > menu = gtk_menu_new(); > gtk_menu_item_set_submenu(GTK_MENU_ITEM (item), menu); > > subaction = gtk_action_new("Txp::submenuitem", > NULL, > "Submenu Item", > NULL); > subitem = gtk_action_create_menu_item(GTK_ACTION(subaction)); > gtk_menu_shell_append(GTK_MENU_SHELL(menu), subitem); > gtk_widget_show(subitem); > > actions = g_list_append (actions, action); > > return actions; > } > > Can anyone tell me what I'm doing wrong? > > Thanks, > Adam >
_______________________________________________ Thunar-dev mailing list Thunar-dev@xfce.org http://foo-projects.org/mailman/listinfo/thunar-dev