Re: [gtk-list] Freeing a linked list of Widgets



On Tue, 6 Apr 1999, Ted Milker wrote:

> Hey all, I'm trying to figure out the best way to free a linked list of
> widgets.  Could someone give me a small snippet of code to do this?  I don't
> even know which *free() function to use. :(
> 
> Thanks,
> Ted

Try this (assiming you have a GList of those widgets):
/****/
void free_widget_list(GList *list) {
	GList *l;
	for(l = list; l != NULL; l = l->next)
		gtk_widget_destroy(l->data);
	g_list_free(list);
}
/****/

  Gert
-------------------------------------------------------------------------------
   ~     Gert, Gs2, The Blue Mage - whatever you prefer
  'v'    E-Mail   : Gs2@dds.nl
 // \\   Computer : nowmoo.demon.nl
/(   )\  Project  : gMOO, a MOO (and MUD) client for the unises
 ^`~'^   HomePage : http://www.nowmoo.demon.nl





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