Re: canvas group question...



On Mon, 15 Nov 1999, Erik Andersen wrote:

> Will doing a 
> 
>     gtk_object_destroy( GTK_OBJECT (someGnomeCanvasGroup));
> 
> walk through and destroy all the items contained in a 
> canvas group, or do I need to do something like:
> 
>   listItem = g_list_first( myGroup->item_list);
>   while(listItem) {
>       g_list_remove_link(myGroup->item_list, listItem);
>       gtk_object_destroy( GTK_OBJECT (listItem));
>       g_list_free_1( listItem);
>       listItem = g_list_first( myGroup->item_list);
>   }
> 
> ?
>  
>  -Erik


Looking at gnome_canvas_group_destroy, we have:

=========================================

gnome_canvas_group_destroy (GtkObject *object)
{
	GnomeCanvasGroup *group;
	GnomeCanvasItem *child;
	GList *list;

	g_return_if_fail (object != NULL);
	g_return_if_fail (GNOME_IS_CANVAS_GROUP (object));

	group = GNOME_CANVAS_GROUP (object);

	list = group->item_list;
	while (list) {
		child = list->data;
		list = list->next;

		gtk_object_destroy (GTK_OBJECT (child));
	}

	if (GTK_OBJECT_CLASS (group_parent_class)->destroy)
		(* GTK_OBJECT_CLASS (group_parent_class)->destroy)
(object);
}

======================================

The "while (list)" bit indicates that all children are also destroyed.  So
it looks like the entire group is destroyed, and not just the grouping
canvas.

					- Tony



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