GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 31, 2014 8:46 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: clean a menu
PostPosted: Thu Aug 27, 2009 10:06 am 
Offline
Familiar Face

Joined: Wed Aug 05, 2009 7:24 pm
Posts: 19
Hi!
How can I remove all menu's items without delete items from memory?
I want rebuild menu, but i need the old items.
g_free(menu) is ok? Because if menu is empty, g_free report me an error :'(

Thank you! :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 27, 2009 1:28 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

Do you need to recreate menu or just reorder items? Reodering is easier to do since you don't have to worry about yout items getting destroyed (see gtk_menu_reorder_child for more info on reodering).

If you wish to reconstruct your menu from scratch, you should call g_object_ref on each menu item before destroying old menu. After your items are safely packed inside new menu, you should call g_object_unref on each menu item.

Tadej


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group