Commit 45882ba9 authored by Bruno Coudoin's avatar Bruno Coudoin

removed useless phone item indenting fixed major memory leak in the focus

	* src/boards/click_on_letter.c: (end_board),
	(click_on_letter_create_item): removed useless phone item
	* src/gcompris/bonus.c: (bonus_image), (end_bonus): indenting
	* src/gcompris/gameutil.c: (free_image_focus),
	(gcompris_set_image_focus): fixed major memory leak in the focus system
	* src/gcompris/gcompris.c: (gcompris_set_background): reuse the background item
parent e6e7a808
2004-06-01 Bruno coudoin <bruno.coudoin@free.fr>
* src/boards/click_on_letter.c: (end_board),
(click_on_letter_create_item): removed useless phone item
* src/gcompris/bonus.c: (bonus_image), (end_bonus): indenting
* src/gcompris/gameutil.c: (free_image_focus),
(gcompris_set_image_focus): fixed major memory leak in the focus system
* src/gcompris/gcompris.c: (gcompris_set_background): reuse the background item
2004-06-01 Bruno coudoin <bruno.coudoin@free.fr>
* src/boards/menu.c: (menu_start), (menu_end),
......
......@@ -51,7 +51,6 @@ static void repeat(void);
static GnomeCanvasGroup *boardRootItem = NULL;
static GnomeCanvasItem *phone_note_item = NULL;
static GnomeCanvasItem *l1_item = NULL, *l2_item = NULL, *l3_item = NULL, *l4_item = NULL;
static GnomeCanvasItem *button1 = NULL, *button2 = NULL, *button3 = NULL, *button4 = NULL, *selected_button = NULL;
......@@ -155,7 +154,7 @@ static void end_board ()
gcompris_score_end();
click_on_letter_destroy_all_items();
}
gcomprisBoard = NULL;
gcomprisBoard = NULL;
}
/* ======================================= */
......@@ -409,9 +408,9 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent)
for (i=0; i<numberOfLetters; i++) {
g_free(str[i]);
}
gdk_pixbuf_unref(button_pixmap);
gtk_signal_connect(GTK_OBJECT(l1_item), "event", (GtkSignalFunc) item_event, GINT_TO_POINTER(1));
gtk_signal_connect(GTK_OBJECT(l2_item), "event", (GtkSignalFunc) item_event, GINT_TO_POINTER(2));
gtk_signal_connect(GTK_OBJECT(l3_item), "event", (GtkSignalFunc) item_event, GINT_TO_POINTER(3));
......@@ -434,7 +433,6 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent)
(GtkSignalFunc) gcompris_item_event_focus,
NULL);
gtk_signal_connect(GTK_OBJECT(phone_note_item), "event", (GtkSignalFunc) phone_event, NULL);
return NULL;
}
/* ==================================== */
......
......@@ -227,7 +227,7 @@ void bonus_image(char *image, int gamewon)
/* check that bonus_item is a singleton */
if (bonus_item != NULL) {
bonus_display_running = FALSE;
bonus_display_running = FALSE;
return;
}
......@@ -281,7 +281,7 @@ void end_bonus()
gtk_object_destroy (GTK_OBJECT(bonus_item));
bonus_item = NULL;
bonus_display_running = FALSE;
bonus_display_running = FALSE;
gcompris_bar_hide(FALSE);
......
/* gcompris - gameutil.c
*
* Time-stamp: <2004/05/31 06:35:33 bcoudoin>
* Time-stamp: <2004/06/01 01:08:19 bcoudoin>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -206,6 +206,17 @@ make_hc_pixbuf(GdkPixbuf *pb, gint val)
return new;
}
/**
* Free the highlight image from our image_focus system
*/
static void
free_image_focus (GnomeCanvasItem *item, void *none)
{
GdkPixbuf *pixbuf;
pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (item), "pixbuf_ref");
gdk_pixbuf_unref(pixbuf);
}
/**
* Set the focus of the given image (highlight or not)
......@@ -226,6 +237,10 @@ void gcompris_set_image_focus(GnomeCanvasItem *item, gboolean focus)
{
g_object_set_data (G_OBJECT (item), "pixbuf_ref", pixbuf);
pixbuf_ref = pixbuf;
g_signal_connect (item, "destroy",
G_CALLBACK (free_image_focus),
NULL);
}
......
/* gcompris - gcompris.c
*
* Time-stamp: <2004/05/31 07:26:45 bcoudoin>
* Time-stamp: <2004/06/01 01:19:55 bcoudoin>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
......@@ -195,16 +195,18 @@ GnomeCanvasItem *gcompris_set_background(GnomeCanvasGroup *parent, gchar *file)
background_pixmap = gcompris_load_pixmap (file);
if(backgroundimg)
gtk_object_destroy (GTK_OBJECT(backgroundimg));
backgroundimg=gnome_canvas_item_new (parent,
gnome_canvas_pixbuf_get_type (),
"pixbuf", background_pixmap,
"x", 0.0,
"y", 0.0,
"width", (double) BOARDWIDTH,
"height", (double) BOARDHEIGHT,
NULL);
gnome_canvas_item_set (backgroundimg,
"pixbuf", background_pixmap,
NULL);
else
backgroundimg=gnome_canvas_item_new (parent,
gnome_canvas_pixbuf_get_type (),
"pixbuf", background_pixmap,
"x", 0.0,
"y", 0.0,
"width", (double) BOARDWIDTH,
"height", (double) BOARDHEIGHT,
NULL);
gnome_canvas_item_lower_to_bottom(backgroundimg);
gdk_pixbuf_unref(background_pixmap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment