daisy
daisy

Reputation: 23561

How to remove a menu from gtk_menu?

Googled a lot, and tried devhelp , there's only one function available gtk_menu_item_set_submenu () , but it doesn't solve my problem.

Main Menu->
       Item A-> Sub
       Item B-> Sub
       ...
       Item N-> Sub
       -------------
       Item X
       Item Y

I needed to remove "Item A-N" and rebuild them , what i tried so far , is to use g_free (main_menu) , causing the whole application to crash.

N is clearly known to me , is there any function to remove first N submenu ?

Upvotes: 1

Views: 990

Answers (1)

ptomato
ptomato

Reputation: 57920

Note that GtkMenu inherits from GtkContainer, so any of the GtkContainer methods also work on the menu. Use gtk_container_remove(menu, submenu)

Upvotes: 2

Related Questions