[Thunar-dev] Creating a submenu in a thunar extension

Adam Plumb adamplumb at gmail.com
Mon Dec 14 16:07:49 CET 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/thunar-dev/attachments/20091214/85b84516/attachment.html>


More information about the Thunar-dev mailing list