[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

how to create a Menu with GtkItemFactory



Hi,
     Is this correct code to create a Menu with an ItemFactory? Can 
someone point me to an error in there?

    GtkItemFactory *item_factory;
    GtkAccelGroup *accel_group;
       
    GtkItemFactoryEntry menu_items[] = {
           { "/Windows",         NULL,         NULL,           0, 
"<Branch>" },
           { "/Windows/Navigator", NULL,         NULL,           0, 
"<Item>" },
    };
       
     gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
       
     GtkWidget* menuitem;
       
     accel_group = gtk_accel_group_new ();
       
     item_factory = gtk_item_factory_new (GTK_TYPE_MENU, 
"<WEBPAGEVIEW>", accel_group);
       
     gtk_item_factory_create_items (item_factory, nmenu_items, 
menu_items, NULL);

     menuitem = gtk_item_factory_get_item(item_factory, "/Windows");

Is menuitem now a menuitem that can be added to a menu with
gtk_menu_shell_append
?

How would I do that otherwise?

Thanks,

-- 
Philippe Laporte





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]