[gcompris-devel] 2 programming questions

pgeorges pascal.georges1 at free.fr
Thu Nov 15 11:30:04 UTC 2001


I have 2 problems and would like to know if somebody can help :

1. How to move an item at an absolute position (not a relative one). I
am using a work around with a mix of 

	gnome_canvas_item_get_bounds(item, &dx1, &dy1, &dx2, &dy2);
	gnome_canvas_item_move(item, xOffset-dx1, line[0]-dy2);

(don't stare at parameters). This works but I would like something less
ugly.

2. More important (here i am stuck) : I don't know how to clear a GList.

If I use 
g_list_free(int_model_list);

the length of the list is not 0 !!

worse if I use my helper function below, the length of the list is not
0, but remains the same as it was before !

/* ==================================== */
static void reset_list(GList * list) {
  int i;
  for (i=0; i<g_list_length(list); i++)
	list = g_list_remove(list, g_list_nth_data(list,0));
}


I checked the news, but It seems that I am alone not to be able to cope
with this.

Pascal





More information about the Gcompris-devel mailing list