Commit c753c10a authored by Bruno Coudoin's avatar Bruno Coudoin

*** RELEASE 8.0BETA4 ***


	- removed several race conditions. What happens is that in many activity
	  and even in GCompris core, we set callback before the end of the initialisation
	  like displaying all the content. It is then possible for the user to click
	  start an action while it's not completly displayed. It ends up either in graphical
	  inconsistencies or may even crash.
	  Hopefully, this may solve some intermitent crashes we have in GCompris.
	- Fixed several compilation issues
	- No more warnings when sqlite is disabled
parent 38af4a95
*** RELEASE 8.0BETA4 ***
2006-08-19 Bruno coudoin <bruno.coudoin@free.fr>
- removed several race conditions. What happens is that in many activity
and even in GCompris core, we set callback before the end of the initialisation
like displaying all the content. It is then possible for the user to click
start an action while it's not completly displayed. It ends up either in graphical
inconsistencies or may even crash.
Hopefully, this may solve some intermitent crashes we have in GCompris.
- Fixed several compilation issues
- No more warnings when sqlite is disabled
* boards/skins/gartoon/dialogbox.png: fixed a like glitch
* configure.in:
* src/boards/draw.c: (tool_event):
* src/boards/python/anim.py:
* src/boards/shapegame.c: (start_board), (shapegame_next_level),
(read_xml_file):
* src/gcompris/gameutil.c: (gcompris_find_absolute_filename):
* src/gcompris/gc_net.c: (gc_net_init), (gc_net_load_pixmap),
(gc_net_load_xml), (gc_net_get_url_from_file), (gc_net_is_url),
(gc_net_dir_read_name):
* src/gcompris/gc_net.h:
* src/gcompris/gcompris.c:
* src/gcompris/gcompris_confirm.c: (display_confirm):
* src/gcompris/gcompris_db.c: (gcompris_set_board_conf),
(gcompris_get_conf_with_table):
* src/gcompris/images_selector.c: (gcompris_images_selector_start),
(display_image), (display_image_set), (free_stuff),
(item_event_imageset_selector), (item_event_images_selector),
(parseImage), (read_xml_file), (read_dataset_directory):
* src/gcompris/skin.c: (skin_xml_load):
2006-08-15 Bruno coudoin <bruno.coudoin@free.fr>
- Fixed default path search for platform not supported by binreloc
......@@ -53,6 +87,8 @@
problem.
* src/gcompris/gameutil.c: (gcompris_find_absolute_filename): minor, fixed a debug warning
*** RELEASE 8.0BETA3 ***
2006-08-13 Bruno coudoin <bruno.coudoin@free.fr>
- Added support for relocation using http://autopackage.org/docs/binreloc/
......
......@@ -4,7 +4,7 @@
# Description: Top Makefile for win32 (mingw) port of GCompris
#
VERSION = "8.0BETA3"
VERSION = "8.0BETA4"
pkgdatadir = gcompris
......
boards/skins/gartoon/dialogbox.png

13.7 KB | W: | H:

boards/skins/gartoon/dialogbox.png

13.7 KB | W: | H:

boards/skins/gartoon/dialogbox.png
boards/skins/gartoon/dialogbox.png
boards/skins/gartoon/dialogbox.png
boards/skins/gartoon/dialogbox.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gcompris/gcompris.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(gcompris, 8.0BETA3)
AM_INIT_AUTOMAKE(gcompris, 8.0BETA4)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
......
......@@ -887,13 +887,8 @@ tool_event(GnomeCanvasItem *item, GdkEvent *event, gint tool)
return TRUE;
break;
case TOOL_IMAGE:
{
GcomprisProperties *properties = gcompris_get_properties();
gchar *dir = g_strconcat(properties->package_data_dir, "/dataset", NULL);
gcompris_images_selector_start(gcomprisBoard, dir, image_selected);
g_free(dir);
}
break;
gcompris_images_selector_start(gcomprisBoard, "dataset", image_selected);
break;
case TOOL_RAISE:
case TOOL_LOWER:
if(selected_anchors_item)
......
......@@ -604,7 +604,7 @@ class Gcompris_anim:
self.pos_y = gcompris.BOARD_HEIGHT/2
gcompris.images_selector_start(self.gcomprisBoard,
gcompris.DATA_DIR + "/dataset",
"dataset",
image_selected);
return True
......
/* gcompris - shapegame.c
*
* Time-stamp: <2006/08/13 18:11:02 bruno>
* Time-stamp: <2006/08/17 00:14:52 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -235,7 +235,6 @@ static void start_board (GcomprisBoard *agcomprisBoard)
if(agcomprisBoard!=NULL)
{
GcomprisProperties *properties = gcompris_get_properties();
gcomprisBoard = agcomprisBoard;
/* disable im_context */
......@@ -246,21 +245,19 @@ static void start_board (GcomprisBoard *agcomprisBoard)
/* Calculate the maxlevel based on the available data file for this board */
gcomprisBoard->maxlevel=1;
filename = g_strdup_printf("%s/%s/board%d_0.xml",
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->maxlevel);
while(g_file_test(filename, G_FILE_TEST_EXISTS))
/**/
while( (filename = gcompris_find_absolute_filename("%s/board%d_0.xml",
gcomprisBoard->boarddir,
gcomprisBoard->maxlevel++,
NULL)) )
{
gcomprisBoard->maxlevel++;
filename = g_strdup_printf("%s/%s/board%d_0.xml",
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->maxlevel);
g_free(filename);
}
/**/
gcomprisBoard->maxlevel--;
g_free(filename);
if (strcmp(gcomprisBoard->name, "imagename")==0){
gcompris_bar_set(GCOMPRIS_BAR_CONFIG|GCOMPRIS_BAR_LEVEL|GCOMPRIS_BAR_OK);
} else
......@@ -509,7 +506,6 @@ static gboolean increment_sublevel()
/* set initial values for the next level */
static void shapegame_next_level()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
gamewon = FALSE;
......@@ -521,23 +517,17 @@ static void shapegame_next_level()
shapegame_init_canvas(gnome_canvas_root(gcomprisBoard->canvas));
filename = g_strdup_printf("%s/%s/board%d_%d.xml",
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->level, gcomprisBoard->sublevel);
while(!g_file_test(filename, G_FILE_TEST_EXISTS)
&& ((gcomprisBoard->level != 1) || (gcomprisBoard->sublevel!=0)))
while( ((filename = gcompris_find_absolute_filename("%s/board%d_%d.xml",
gcomprisBoard->boarddir,
gcomprisBoard->level,
gcomprisBoard->sublevel,
NULL)) == NULL)
&& ((gcomprisBoard->level != 1) || (gcomprisBoard->sublevel!=0)))
{
/* Try the next level */
gcomprisBoard->sublevel=gcomprisBoard->number_of_sublevel;
gcomprisBoard->sublevel = gcomprisBoard->number_of_sublevel;
if(!increment_sublevel())
return;
g_free(filename);
filename = g_strdup_printf("%s/%s/board%d_%d.xml",
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->level, gcomprisBoard->sublevel);
}
read_xml_file(filename);
......@@ -1900,16 +1890,8 @@ read_xml_file(char *fname)
g_return_val_if_fail(fname!=NULL,FALSE);
/* if the file doesn't exist */
if(!g_file_test(fname, G_FILE_TEST_EXISTS))
{
g_warning("Couldn't find file %s !", fname);
return FALSE;
}
g_warning("found file %s !", fname);
/* parse the new file and put the result into newdoc */
doc = xmlParseFile(fname);
doc = gc_net_load_xml(fname);
/* in case something went wrong */
if(!doc)
return FALSE;
......
/* gcompris - gameutil.c
*
* Time-stamp: <2006/08/15 04:27:21 bruno>
* Time-stamp: <2006/08/19 02:16:40 bruno>
*
* Copyright (C) 2000-2006 Bruno Coudoin
*
......@@ -1223,7 +1223,7 @@ gchar *g_utf8_strndup(gchar* utf8text, gint n)
* and if not found the short locale name. It support printf formating.
* \param ...: additional params for the format (printf like)
*
* \return NULL or a new gchar* with the absolute_filename of the given filename
* \return NULL or a new gchar* with the absolute_filename of the given filename or a full url to it.
*
*/
gchar*
......@@ -1235,7 +1235,6 @@ gcompris_find_absolute_filename(const gchar *format, ...)
gchar *absolute_filename;
gchar *dir_to_search[4];
GcomprisProperties *properties = gcompris_get_properties();
GcomprisBoard *gcomprisBoard = get_current_gcompris_board();
if (!format)
return NULL;
......@@ -1260,10 +1259,6 @@ gcompris_find_absolute_filename(const gchar *format, ...)
dir_to_search[i++] = properties->package_data_dir;
dir_to_search[i++] = properties->user_data_dir;
if(gcomprisBoard)
dir_to_search[i++] = gcomprisBoard->board_dir;
dir_to_search[i++] = NULL;
absolute_filename = g_strdup(filename);
......@@ -1293,7 +1288,7 @@ gcompris_find_absolute_filename(const gchar *format, ...)
}
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename2, NULL)))
if((absolute_filename = gc_net_get_url_from_file(filename2, NULL)))
{
g_strfreev(tmp);
g_free(filename2);
......@@ -1315,7 +1310,7 @@ gcompris_find_absolute_filename(const gchar *format, ...)
}
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename2, NULL)))
if((absolute_filename = gc_net_get_url_from_file(filename2, NULL)))
{
g_free(filename2);
goto FOUND;
......@@ -1332,7 +1327,7 @@ gcompris_find_absolute_filename(const gchar *format, ...)
goto FOUND;
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename, NULL)))
if((absolute_filename = gc_net_get_url_from_file(filename, NULL)))
goto FOUND;
}
......
......@@ -50,9 +50,11 @@ void gc_net_init()
{
SUPPORT_OR_RETURN();
#ifdef USE_GNET
#endif
}
/** Load a pixmap from the network
/** Load a pixmap localy or from the network
*
* \param pixmapfile : a full URL to the file to load as an image
* in case a local file is given, it will be loaded.
......@@ -65,6 +67,25 @@ GdkPixbuf *gc_net_load_pixmap(const char *url)
SUPPORT_OR_RETURN(NULL);
#ifdef USE_GNET
#endif
}
/** Load an xml file from the network
*
* \param xmlfile : a full URL to the xml file to load as an xmlDocPtr
* in case a local file is given, it will be loaded.
* \return a xmlDocPtr or NULL
*/
xmlDocPtr gc_net_load_xml(const char *url)
{
if(!gc_net_is_url(url))
return(xmlParseFile(url));
SUPPORT_OR_RETURN(NULL);
#ifdef USE_GNET
#endif
}
/** return an absolute URL if the given file is part of the file available on our server
......@@ -77,6 +98,8 @@ gc_net_get_url_from_file(const gchar *format, ...)
{
SUPPORT_OR_RETURN(NULL);
#ifdef USE_GNET
#endif
}
/** return TRUE if the url starts with http://
......@@ -92,3 +115,19 @@ gc_net_is_url(const gchar *url)
return TRUE;
}
/** return a glist with the content of the files in the given directory
*
* \param dir: the directory to scan
* \param ext: optional extention filter. e.g. ".xml" to get only *.xml files.
*
* \return: a new allocated glist that points to internal elements. Do not free the list
* data itself.
*/
GSList *gc_net_dir_read_name(const gchar* dir, const gchar *ext)
{
SUPPORT_OR_RETURN(NULL);
#ifdef USE_GNET
#endif
}
......@@ -28,13 +28,19 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
/* libxml includes */
#include <libxml/tree.h>
#include <libxml/parser.h>
#include "gcompris.h"
#define GCOMPRIS_BASE_URL "http://gcompris.net/gcompris"
void gc_net_init();
GdkPixbuf *gc_net_load_pixmap(const char *url);
gchar * gc_net_get_url_from_file(const gchar *format, ...);
gboolean gc_net_is_url(const char *url);
xmlDocPtr gc_net_load_xml(const char *url);
gchar *gc_net_get_url_from_file(const gchar *format, ...);
gboolean gc_net_is_url(const char *url);
GSList *gc_net_dir_read_name(const gchar* dir, const gchar *ext);
#endif
......@@ -157,7 +157,7 @@ static struct poptOption options[] = {
N_("Disable XF86VidMode (No screen resolution change)."), NULL},
{"root-menu", 'l', POPT_ARG_STRING, &popt_root_menu, 0,
N_("Run gcompris with local menu (e.g -l /reading will let you play only activities in the reading directory, -l /boards/connect4 only the connect4 activity)"), NULL},
N_("Run gcompris with local menu (e.g -l /reading will let you play only activities in the reading directory, -l /strategy/connect4 only the connect4 activity)"), NULL},
{"local-activity", 'L', POPT_ARG_STRING, &popt_local_activity, 0,
N_("Run GCompris with local activity directory added to menu"), NULL},
......
/* gcompris - gcompris_confirm.c
*
* Time-stamp: <2006/08/11 17:28:11 bruno>
* Time-stamp: <2006/08/16 19:47:10 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -320,7 +320,7 @@ display_confirm(gchar *title,
gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
"text", no_text,
"font", gcompris_skin_font_title,
"font", gcompris_skin_font_subtitle,
"x", (double) button_x + gdk_pixbuf_get_width(pixmap) + button_x_int ,
"y", (double) button_y + 2*button_h/3,
"anchor", GTK_ANCHOR_WEST,
......@@ -368,7 +368,7 @@ display_confirm(gchar *title,
item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
"text", yes_text,
"font", gcompris_skin_font_title,
"font", gcompris_skin_font_subtitle,
"x", (double) button_x + gdk_pixbuf_get_width(pixmap) + button_x_int ,
"y", (double) button_y + button_h/3,
"anchor", GTK_ANCHOR_WEST,
......
......@@ -1232,6 +1232,7 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
gchar *key,
gchar *value)
{
#ifdef USE_SQLITE
char *zErrMsg;
char **result;
int rc;
......@@ -1239,7 +1240,6 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
int ncolumn;
gchar *request;
#ifdef USE_SQLITE
request = sqlite3_mprintf(CHECK_CONF,
profile->profile_id,
board->board_id,
......@@ -1309,6 +1309,9 @@ void gcompris_set_board_conf(GcomprisProfile *profile,
GHashTable *gcompris_get_conf_with_table(int profile_id, int board_id, GHashTable *table )
{
GHashTable *hash_conf = table;
#ifdef USE_SQLITE
char *zErrMsg;
char **result;
int rc;
......@@ -1317,9 +1320,6 @@ GHashTable *gcompris_get_conf_with_table(int profile_id, int board_id, GHashTabl
gchar *request;
int i;
GHashTable *hash_conf = table;
#ifdef USE_SQLITE
request = g_strdup_printf(GET_CONF(profile_id,
board_id));
......
/* gcompris - images_selector.c
*
* Time-stamp: <2006/08/13 17:29:47 bruno>
* Time-stamp: <2006/08/19 02:09:57 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -46,7 +46,7 @@ static gint item_event_scroll(GnomeCanvasItem *item,
static gboolean read_xml_file(gchar *fname);
static gboolean read_dataset_directory(gchar *dataset_dir);
static void display_image(gchar *imagename, GnomeCanvasItem *rootitem);
static void free_stuff (GtkObject *obj, GList *data);
static void free_stuff (GtkObject *obj, GSList *data);
static gboolean images_selector_displayed = FALSE;
......@@ -61,6 +61,8 @@ static GnomeCanvasItem *image_bg_item;
static ImageSelectorCallBack imageSelectorCallBack = NULL;
static gboolean display_in_progress;
/* Represent the limits of the image area */
#define DRAWING_AREA_X1 111.0
#define DRAWING_AREA_Y1 14.0
......@@ -98,8 +100,9 @@ static guint isy;
* Do all the images_selector display and register the events
*/
void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *dataset,
ImageSelectorCallBack iscb)
void
gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *dataset,
ImageSelectorCallBack iscb)
{
GnomeCanvasItem *item, *item2;
......@@ -107,7 +110,7 @@ void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *datase
gint y = 0;
gint y_start = 0;
gint x_start = 0;
gchar *name = NULL;
gchar *dataseturl = NULL;
GtkWidget *w;
......@@ -118,7 +121,6 @@ void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *datase
board_pause(TRUE);
name = gcomprisBoard->name;
imageSelectorCallBack=iscb;
rootitem = \
......@@ -128,6 +130,8 @@ void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *datase
"y", (double)0,
NULL);
images_selector_displayed = TRUE;
pixmap = gcompris_load_skin_pixmap("images_selector_bg.png");
y_start = (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
x_start = (BOARDWIDTH - gdk_pixbuf_get_width(pixmap))/2;
......@@ -236,6 +240,60 @@ void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *datase
(GtkSignalFunc) item_event_scroll,
GNOME_CANVAS(canvas_image_selector));
/*
* DISPLAY IMAGES
*/
/* Initial image position */
ix = 0;
iy = 0;
isy = 0;
/* I need the following :
-> if dataset is a file read it.
-> if dataset is a directory, read all xml file in it.
*/
dataseturl = \
gcompris_find_absolute_filename(dataset,
NULL);
/* if the file doesn't exist */
if(g_file_test ((dataseturl), G_FILE_TEST_IS_DIR) )
{
g_warning("dataset %s is a directory. Trying to read xml", dataseturl);
read_dataset_directory(dataseturl);
}
else if(dataseturl)
{
/* Read the given data set file, local or net */
read_xml_file(dataseturl);
}
else
{
/* Network code for dataset directory */
GSList *filelist = NULL;
GSList *i = NULL;
g_free(dataseturl);
dataseturl = g_strconcat("boards/", dataset, NULL);
filelist = gc_net_dir_read_name(dataseturl, ".xml");
for (i = filelist; i != NULL; i = g_slist_next (i))
{
gchar *url = gcompris_find_absolute_filename(i->data,
NULL);
printf("processing dataset=%s\n", (char *)i->data);
read_xml_file(url);
g_free(url);
}
g_slist_free(filelist);
}
g_free(dataseturl);
/*
* OK Button
* ---------
......@@ -271,29 +329,6 @@ void gcompris_images_selector_start (GcomprisBoard *gcomprisBoard, gchar *datase
item);
gdk_pixbuf_unref(pixmap);
images_selector_displayed = TRUE;
/* Initial image position */
ix = 0;
iy = 0;
isy = 0;
/* I need the following :
-> if dataset is a file read it.
-> if dataset is a directory, read all xml file in it.
*/
/* if the file doesn't exist */
if(g_file_test ((dataset), G_FILE_TEST_IS_DIR) )
{
g_warning("dataset %s is a directory. Trying to read xml", dataset);
read_dataset_directory(dataset);
}
else
/* Read the given data set */
read_xml_file(dataset);
}
/*
......@@ -336,7 +371,7 @@ static void display_image(gchar *imagename, GnomeCanvasItem *root_item)
double xratio, yratio;
double iw, ih;
if (imagename==NULL)
if (imagename==NULL || !images_selector_displayed)
return;
pixmap = gcompris_load_pixmap(imagename);
......@@ -395,16 +430,15 @@ static void display_image(gchar *imagename, GnomeCanvasItem *root_item)
* Same as display_image but for the dataset
* The imagelist contains the list of images to be displayed when this dataset is selected
*/
static void display_image_set(gchar *imagename, GList *imagelist)
static void display_image_set(gchar *imagename, GSList *imagelist)
{
GdkPixbuf *pixmap = NULL;
GnomeCanvasItem *item;
GnomeCanvasItem *rootitem_set;
double xratio, yratio;
double iw, ih;
if (imagename==NULL)
if (imagename==NULL || !images_selector_displayed)
return;
pixmap = gcompris_load_pixmap(imagename);
......@@ -466,13 +500,13 @@ static void display_image_set(gchar *imagename, GList *imagelist)
}
static void
free_stuff (GtkObject *obj, GList *list)
free_stuff (GtkObject *obj, GSList *list)
{
while (g_list_length(list) > 0) {
g_free(g_list_nth_data(list,0));
list = g_list_remove(list, g_list_nth_data(list,0));
while (g_slist_length(list) > 0) {
g_free(g_slist_nth_data(list,0));
list = g_slist_remove(list, g_slist_nth_data(list,0));
}
g_list_free(list);
g_slist_free(list);
}
......@@ -480,10 +514,13 @@ free_stuff (GtkObject *obj, GList *list)
static gint
item_event_imageset_selector(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
{
GList *image_list;
GSList *image_list;
GnomeCanvasItem *rootitem_set;
guint imageset_done;
if(display_in_progress)
return TRUE;
switch (event->type)
{
case GDK_ENTER_NOTIFY:
......@@ -494,8 +531,10 @@ item_event_imageset_selector(GnomeCanvasItem *item, GdkEvent *event, gpointer da
{
guint last_iy;
display_in_progress = TRUE;
/* We must display the list of images for this set */
image_list = (GList *)g_object_get_data (G_OBJECT (item), "imagelist");
image_list = (GSList *)g_object_get_data (G_OBJECT (item), "imagelist");
g_return_val_if_fail (image_list != NULL, FALSE);
/* We must display the list of images for this set */
......@@ -516,7 +555,7 @@ item_event_imageset_selector(GnomeCanvasItem *item, GdkEvent *event, gpointer da
iy_calc = IMAGE_HEIGHT + IMAGE_GAP;
g_object_set_data (G_OBJECT (rootitem_set), "iy", GINT_TO_POINTER (iy_calc));
g_list_foreach (image_list, (GFunc) display_image, rootitem_set);
g_slist_foreach (image_list, (GFunc) display_image, rootitem_set);
g_object_set_data (G_OBJECT (item), "imageset_done", GINT_TO_POINTER (1));
}
......@@ -537,6 +576,8 @@ item_event_imageset_selector(GnomeCanvasItem *item, GdkEvent *event, gpointer da
/* Back to the initial image position */
ix = 0;
iy = 0;
display_in_progress = FALSE;
}
default:
break;
......@@ -550,6 +591,9 @@ static gint
item_event_images_selector(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
{
if(display_in_progress)
return TRUE;
switch (event->type)
{
case GDK_ENTER_NOTIFY:
......@@ -607,15 +651,14 @@ item_event_scroll(GnomeCanvasItem *item, GdkEvent *event, GnomeCanvas *canvas)
void
parseImage (xmlDocPtr doc, xmlNodePtr cur) {
GcomprisProperties *properties = gcompris_get_properties();
gchar *imageSetName = NULL;
gchar *filename;
gchar *pathname = NULL;
gchar *absolutepath;
GList *imageList = NULL; /* List of Images */
gchar *imageSetName = NULL;
gchar *filename;
gchar *pathname = NULL;
gchar *absolutepath;
GSList *imageList = NULL; /* List of Images */
gboolean havePathName = FALSE;
gchar *type = NULL;
GDir *imageset_directory;
GError **error = NULL;
gchar *type = NULL;
GDir *imageset_directory;
/* get the filename of this ImageSet */
imageSetName = (gchar *)xmlGetProp(cur, BAD_CAST "filename");
......@@ -646,21 +689,16 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) {
/* -> and else for PACKAGE_DATA_DIR/imagesetname */
if (havePathName) {
if (!g_path_is_absolute (imageSetName)){
absolutepath = g_strdup_printf("%s/%s",pathname,imageSetName);
if(!g_file_test ((absolutepath), G_FILE_TEST_EXISTS) ){
g_free(absolutepath);
absolutepath = g_strdup_printf("%s/%s", properties->package_data_dir, imageSetName);
}
else
imageSetName = g_strdup(absolutepath);
absolutepath = gcompris_find_absolute_filename("%s/%s", pathname, imageSetName,
NULL);
}
else
absolutepath = g_strdup(imageSetName);
}
else
absolutepath = g_strdup_printf("%s/%s", properties->package_data_dir, imageSetName);
absolutepath = gcompris_find_absolute_filename(imageSetName, NULL);
if(!g_file_test ((absolutepath), G_FILE_TEST_EXISTS) )
if(!absolutepath)
{
g_warning("In ImageSet %s, an image is not found. Skipping ImageSet...", absolutepath);
return;
......@@ -677,7 +715,7 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) {
if (havePathName){
filename = g_strdup_printf("%s/%s",pathname,filename);
}
imageList = g_list_append (imageList, filename);
imageList = g_slist_prepend (imageList, filename);
}
cur = cur->next;
}
......@@ -697,7 +735,7 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) {
return;
}
}
imageset_directory = g_dir_open (pathname, 0, error);
imageset_directory = g_dir_open (pathname, 0, NULL);
const gchar * onefile;
while ((onefile = g_dir_read_name(imageset_directory))){
if ((g_ascii_strcasecmp (type,"lsdir") != 0) &&
......@@ -721,13 +759,13 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) {
filename = filename2;
}
}
imageList = g_list_append (imageList, filename);
imageList = g_slist_prepend (imageList, filename);
}
g_dir_close(imageset_directory);
}
/* do not display if there is nothing to display */
if (imageList != NULL) /* g_list is not empty */
if (imageList != NULL) /* g_slist is not empty */
display_image_set(imageSetName, imageList);
g_free(absolutepath);
......@@ -764,24 +802,20 @@ parse_doc(xmlDocPtr doc) {
/* read an xml file into our memory structures and update our view,
dump any old data we have in memory if we can load a new set */
* dump any old data we have in memory if we can load a new set
*
* \param fname is an absolute file name