Re: Loading JPGs



Diego Zuccato wrote:

> Obviously this doesn't work. mycbk() never gets called (maybe because I
> only added a GdkPixbuf ?).
> So what should I do to clear the canvas ? Hope I don't have to destroy
> it and make a new one...
> If so, what happens if you have 100 items and want to remove the 50th?
> Is there a way to iterate on the items contained in a canvas?
Ops... I'm auto-quoting cause I found a possible solution.

static void _empty_canvas(GtkWidget *w, gpointer c)
{
	if(w)
		gtk_object_destroy(GTK_OBJECT(w));
}

void gnome_canvas_clear(GnomeCanvas *gc)
{
	GnomeCanvasGroup *gcg=gnome_canvas_root(gc);
	g_list_foreach(gcg->item_list, _empty_canvas, NULL);
	g_list_free(gcg->item_list);
	gcg->item_list=gcg->item_list_end=NULL;
}

Does it lead to memory leaks (maybe if there are multiple groups)? Any
drawbacks?

Tks,
 Diego.



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