Commit 09a1b0a5 authored by Bruno Coudoin's avatar Bruno Coudoin

- fixed bug#352350 Some typos in the PO file

	- added ukrainian flag, waiting for po file.
	- fixed several acivity make them work with gc_net_load_xml API
	  they no more get their xml data file locally
	- fixed several activity to get their translations from gettext instead of
	  the xml data file itself. It saves a lot of space and makes packagers happy.
parent c6427287
2006-08-23 Bruno coudoin <bruno.coudoin@free.fr>
- fixed bug#352350 Some typos in the PO file
- added ukrainian flag, waiting for po file.
- fixed several acivity make them work with gc_net_load_xml API
they no more get their xml data file locally
- fixed several activity to get their translations from gettext instead of
the xml data file itself. It saves a lot of space and makes packagers happy.
* boards/advanced_colors/Makefile.am:
* boards/flags/uk.png:
* boards/imageid/Makefile.am:
* boards/missing_letter/Makefile.am:
* boards/read_colors/Makefile.am:
* boards/scales/Makefile.am:
* boards/traffic.xml.in:
* docs/gcompris2spip.pl: added russian and ukrainian
* src/boards/advanced_colors.c: (init_xml), (add_xml_data),
(parse_doc), (read_xml_file):
* src/boards/imageid.c: (pause_board), (imageid_destroy_all_items),
(imageid_create_item), (game_won), (process_ok_timeout),
(process_ok), (highlight_selected), (dump_xml), (init_xml),
(add_xml_data), (parse_doc), (read_xml_file), (destroy_board_list),
(destroy_board), (config_start):
* src/boards/missingletter.c: (init_xml), (add_xml_data),
(read_xml_file):
* src/boards/read_colors.c: (init_xml), (add_xml_data),
(read_xml_file):
* src/gcompris/gcompris.c:
2006-08-22 Bruno coudoin <bruno.coudoin@free.fr>
- cleanup, removed deprecated wordslevel* now the xml version
......
......@@ -23,5 +23,4 @@ $(xml_DATA): %.xml: %.xml.in
sed -e "s/\(\<\)\/*_//g" $< > $@
CLEANFILES = $(xml_DATA)
......@@ -14,6 +14,4 @@ xml_DATA = $(xml_in_files:.xml.in=.xml)
$(xml_DATA): %.xml: %.xml.in
sed -e "s/\(\<\)\/*_//g" $< > $@
CLEANFILES = $(xml_DATA)
xmldir = $(pkgdatadir)/@PACKAGE_DATA_DIR@/scales
xmldir = $(pkgdatadir)/@PACKAGE_DATA_DIR@/missing_letter
xml_in_files = \
board1.xml.in
......@@ -15,5 +15,4 @@ $(xml_DATA): %.xml: %.xml.in
sed -e "s/\(\<\)\/*_//g" $< > $@
CLEANFILES = $(xml_DATA)
......@@ -13,6 +13,4 @@ xml_DATA = $(xml_in_files:.xml.in=.xml)
$(xml_DATA): %.xml: %.xml.in
sed -e "s/\(\<\)\/*_//g" $< > $@
CLEANFILES = $(xml_DATA)
......@@ -32,5 +32,4 @@ $(xml_DATA): %.xml: %.xml.in
sed -e "s/\(\<\)\/*_//g" $< > $@
CLEANFILES = $(xml_DATA)
......@@ -13,7 +13,7 @@
<_description>Remove the red car from the parking lot through the gate on the right</_description>
<_prerequisite></_prerequisite>
<_goal>Remove the red car from the parking lot through the gate on the right</_goal>
<_manual>Each car can only move either horizontaly or verticaly. You must make some room in order to let the red car move through the gate on the right.</_manual>
<_manual>Each car can only move either horizontally or vertically. You must make some room in order to let the red car move through the gate on the right.</_manual>
</Board>
<Data directory=""/>
</GCompris>
......@@ -78,7 +78,7 @@ my %sections = (
"pt", 28,
"pt_BR", 141,
"ro", 0,
"ru", 0,
"ru", 160,
"rw", 0,
"sk", 0,
"sl", 0,
......@@ -89,6 +89,7 @@ my %sections = (
"ta", 154,
"th", 0,
"tr", 157,
"uk", 161,
"vi", 116,
"wa", 0,
"zh_CN", 0,
......@@ -135,7 +136,7 @@ my %rubriques = (
"pt", 56,
"pt_BR", 142,
"ro", 0,
"ru", 0,
"ru", 162,
"rw", 0,
"sk", 0,
"sl", 0,
......@@ -146,6 +147,7 @@ my %rubriques = (
"ta", 155,
"th", 0,
"tr", 158,
"uk", 164,
"vi", 117,
"wa", 0,
"zh_CN", 0,
......@@ -204,6 +206,7 @@ my %rubriques_all = (
"ta", 156,
"th", 0,
"tr", 159,
"uk", 165,
"vi", 118,
"wa", 0,
"zh_CN", 0,
......
......@@ -445,19 +445,14 @@ static void highlight_selected(int c) {
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gc_prop_get();
char *filename;
filename = g_strdup_printf("%s/%s/board%d.xml",
properties->package_data_dir,
filename = gc_file_find_absolute("%s/board%d.xml",
gcomprisBoard->boarddir,
gcomprisBoard->level);
g_debug("filename = %s %s %s\n",
properties->package_data_dir,
filename,
gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
g_free(filename);
}
......@@ -466,45 +461,31 @@ static void add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child)
{
char *text = NULL;
char *sColor = NULL;
int color = 0;
int i;
gchar *lang;
xmlnode = xmlnode->xmlChildrenNode;
xmlnode = xmlnode->next;
while (xmlnode != NULL) {
if (!strcmp((char *)xmlnode->name, "pixmapfile"))
backgroundFile = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
lang = (char *)xmlGetProp(xmlnode, BAD_CAST "lang");
// try to match color[i]
for (i=0; i<8; i++) {
sColor = g_strdup_printf("color%d", i+1);
if (!strcmp((char *)xmlnode->name, sColor)) {
if (lang == NULL) { // get default value
text = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
colors[i] = text;
} else { // get correct language
if ( !strncmp(lang, gc_locale_get(), strlen(lang)) ) {
text = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
g_warning("color prop::lang=%s locale=%s text=%s\n", lang, gc_locale_get(), text);
colors[i] = text;
}
}
g_free(sColor);
break;
}
g_free(sColor);
} // end for
xmlnode = xmlnode->next;
}
g_warning("colors found in XML:\n");
for (color=0; color<8; color++)
g_warning("%d %s\n", color, colors[color]);
while (xmlnode != NULL)
{
if (!strcmp((char *)xmlnode->name, "pixmapfile"))
backgroundFile = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
// try to match color[i]
for (i=0; i<8; i++)
{
sColor = g_strdup_printf("color%d", i+1);
if (!strcmp((char *)xmlnode->name, sColor))
{
colors[i] = gettext((char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1));
g_free(sColor);
break;
}
g_free(sColor);
} // end for
xmlnode = xmlnode->next;
}
// I really don't know why this test, but otherwise, the list is doubled
// with 1 line on 2 filled with NULL elements
......@@ -520,7 +501,7 @@ static void parse_doc(xmlDocPtr doc)
for(node = doc->children->children; node != NULL; node = node->next) {
if ( g_strcasecmp((char *)node->name, "Board") == 0 )
add_xml_data(doc, node,NULL);
add_xml_data(doc, node, NULL);
}
}
......@@ -534,16 +515,9 @@ static gboolean 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;
......
......@@ -47,14 +47,9 @@ static void highlight_selected(GnomeCanvasItem *);
static void game_won(void);
static void config_start(GcomprisBoard *agcomprisBoard,
GcomprisProfile *aProfile);
GcomprisProfile *aProfile);
static void config_stop(void);
#ifdef DEBUG
static void dump_xml(void);
#endif
typedef struct {
char *pixmapfile;
char *text1;
......@@ -142,7 +137,7 @@ GET_BPLUGIN_INFO(imageid)
* in : boolean TRUE = PAUSE : FALSE = CONTINUE
*
*/
static void pause_board (gboolean pause)
static void pause_board (gboolean pause)
{
if(gcomprisBoard==NULL)
return;
......@@ -257,7 +252,7 @@ static void imageid_next_level()
static void imageid_destroy_all_items()
{
if(boardRootItem!=NULL)
gtk_object_destroy (GTK_OBJECT(boardRootItem));
gtk_object_destroy (GTK_OBJECT(boardRootItem));
boardRootItem = NULL;
}
......@@ -272,9 +267,9 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent)
Board * board;
board_number = (gcomprisBoard->level-1) * NUMBER_OF_SUBLEVELS + gcomprisBoard->sublevel-1;
/* if (board_number >= g_list_length(board_list))
board_number = g_list_length(board_list)-1;
*/
/* if (board_number >= g_list_length(board_list))
board_number = g_list_length(board_list)-1;
*/
assert(board_number >= 0 && board_number < g_list_length(board_list));
place = ((int)(3.0*rand()/(RAND_MAX+1.0)));
assert(place >= 0 && place < 3);
......@@ -338,20 +333,20 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent)
yp = (gcomprisBoard->height - 3*gdk_pixbuf_get_height(button_pixmap) - 2*VERTICAL_SEPARATION)/2;
button1 = gnome_canvas_item_new (boardRootItem,
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[0],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
gnome_canvas_text_get_type (),
"text", buf[0],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
text1_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[0],
......@@ -364,20 +359,20 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent)
yp += gdk_pixbuf_get_height(button_pixmap) + VERTICAL_SEPARATION;
button2 = gnome_canvas_item_new (boardRootItem,
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[1],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
gnome_canvas_text_get_type (),
"text", buf[1],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
text2_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[1],
......@@ -390,21 +385,21 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent)
yp += gdk_pixbuf_get_height(button_pixmap) + VERTICAL_SEPARATION;
button3 = gnome_canvas_item_new (boardRootItem,
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
"x", (double) xp,
"y", (double) yp,
NULL);
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[2],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
gnome_canvas_text_get_type (),
"text", buf[2],
"font", gcompris_skin_font_board_big,
"x", (double) xp + gdk_pixbuf_get_width(button_pixmap)/2 + 1.0,
"y", (double) yp + gdk_pixbuf_get_height(button_pixmap)/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
text3_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", buf[2],
......@@ -436,9 +431,9 @@ static void game_won()
gcomprisBoard->sublevel=1;
gcomprisBoard->level++;
if(gcomprisBoard->level>gcomprisBoard->maxlevel) { // the current board is finished : bail out
board_finished(BOARD_FINISHED_TUXLOCO);
return;
}
board_finished(BOARD_FINISHED_TUXLOCO);
return;
}
}
imageid_next_level();
}
......@@ -446,11 +441,11 @@ static void game_won()
/* ==================================== */
static gboolean process_ok_timeout() {
gcompris_display_bonus(gamewon, BONUS_SMILEY);
return FALSE;
return FALSE;
}
static void process_ok() {
// leave time to display the right answer
// leave time to display the right answer
g_timeout_add(TIME_CLICK_TO_BONUS, process_ok_timeout, NULL);
}
/* ==================================== */
......@@ -519,16 +514,16 @@ static void highlight_selected(GnomeCanvasItem * item) {
}
if (selected_button != NULL && selected_button != button) {
button_pixmap = gcompris_load_skin_pixmap("button_large.png");
gnome_canvas_item_set(selected_button, "pixbuf", button_pixmap, NULL);
gdk_pixbuf_unref(button_pixmap);
button_pixmap = gcompris_load_skin_pixmap("button_large.png");
gnome_canvas_item_set(selected_button, "pixbuf", button_pixmap, NULL);
gdk_pixbuf_unref(button_pixmap);
}
if (selected_button != button) {
button_pixmap_selected = gcompris_load_skin_pixmap("button_large_selected.png");
gnome_canvas_item_set(button, "pixbuf", button_pixmap_selected, NULL);
selected_button = button;
gdk_pixbuf_unref(button_pixmap_selected);
button_pixmap_selected = gcompris_load_skin_pixmap("button_large_selected.png");
gnome_canvas_item_set(button, "pixbuf", button_pixmap_selected, NULL);
selected_button = button;
gdk_pixbuf_unref(button_pixmap_selected);
}
}
......@@ -538,22 +533,8 @@ static void highlight_selected(GnomeCanvasItem * item) {
* XML stuff
* Ref : shapegame.c
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gc_prop_get();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
g_debug("filename = %s %s %s\n", filename, properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
g_free(filename);
#ifdef DEBUG
dump_xml();
#endif
}
/* ====== for DEBUG ======== */
#ifdef DEBUG
#if 0
static void dump_xml() {
GList *list;
g_warning("XML lentgh = %d\n", g_list_length(board_list));
......@@ -561,10 +542,21 @@ static void dump_xml() {
for(list = board_list; list != NULL; list = list->next) {
Board * board = list->data;
g_warning("xml = %s %s %s %s\n", board->pixmapfile, board->text1, board->text2, board->text3);
}
}
}
#endif
static void init_xml()
{
char *filename;
filename = gc_file_find_absolute("%s/board1.xml",
gcomprisBoard->boarddir);
assert(read_xml_file(filename)== TRUE);
g_free(filename);
}
/* ==================================== */
static void add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child)
{
......@@ -578,73 +570,38 @@ static void add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child)
xmlnode = xmlnode->next;
while(xmlnode!=NULL) {
gchar *lang = (gchar *)xmlGetProp(xmlnode, BAD_CAST "lang");
if (!strcmp((char *)xmlnode->name, "pixmapfile"))
pixmapfile = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
if (!found_text1 && !strcmp((char *)xmlnode->name, "text1"))
{
if(lang==NULL && text1==NULL)
if(text1==NULL)
{
text1 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
}
else if(!strncmp(gc_locale_get(), lang, 5))
{
if(text1) free(text1);
text1 = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
/* That's the perfect choice, do not continue or we may override it */
found_text1 = TRUE;
}
else if(!strncmp(gc_locale_get(), lang, strlen(lang)))
{
if(text1) free(text1);
text1 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
text1 = \
g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
}
}
if (!found_text2 && !strcmp((char *)xmlnode->name, "text2"))
{
if(lang==NULL && text2==NULL)
{
text2 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
}
else if(!strncmp(gc_locale_get(), lang, 5))
if(text2==NULL)
{
if(text2) free(text2);
text2 = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
/* That's the perfect choice, do not continue or we may override it */
found_text2 = TRUE;
}
else if(!strncmp(gc_locale_get(), lang, strlen(lang)))
{
if(text2) free(text2);
text2 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
text2 = \
g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
}
}
if (!found_text3 && !strcmp((char *)xmlnode->name, "text3"))
{
if(lang==NULL && text3==NULL)
{
text3 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
}
else if(!strncmp(gc_locale_get(), lang, 5))
if(text3==NULL)
{
if(text3) free(text3);
text3 = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
/* That's the perfect choice, do not continue or we may override it */
found_text3 = TRUE;
}
else if(!strncmp(gc_locale_get(), lang, strlen(lang)))
{
if(text3) free(text3);
text3 = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
text3 = \
g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
}
}
xmlnode = xmlnode->next;
g_free(lang);
}
// I really don't know why this test, but otherwise, the list is doubled
// with 1 line on 2 filled with NULL elements
......@@ -666,7 +623,7 @@ static void parse_doc(xmlDocPtr doc)
for(node = doc->children->children; node != NULL; node = node->next) {
if ( g_strcasecmp((gchar *)node->name, "Board") == 0 )
add_xml_data(doc, node,NULL);
add_xml_data(doc, node,NULL);
}
}
......@@ -680,16 +637,9 @@ static gboolean 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;
......@@ -710,8 +660,9 @@ static gboolean read_xml_file(char *fname)
}
/* ======================================= */
static void destroy_board_list() {
Board *board;
while(g_list_length(board_list)>0)
Board *board;
while(g_list_length(board_list)>0)
{
board = g_list_nth_data(board_list, 0);
board_list = g_list_remove (board_list, board);
......@@ -721,11 +672,11 @@ Board *board;
/* ======================================= */
static void destroy_board(Board * board) {
g_free(board->pixmapfile);
g_free(board->text1);
g_free(board->text2);
g_free(board->text3);
g_free(board);
g_free(board->pixmapfile);
g_free(board->text1);
g_free(board->text2);
g_free(board->text3);
g_free(board);
}
......@@ -794,7 +745,7 @@ static GcomprisConfCallback conf_ok(GHashTable *table)
static void
config_start(GcomprisBoard *agcomprisBoard,
GcomprisProfile *aProfile)
GcomprisProfile *aProfile)
{
board_conf = agcomprisBoard;
profile_conf = aProfile;
......
......@@ -555,6 +555,7 @@ static void highlight_selected(GnomeCanvasItem * item) {
* Ref : shapegame.c
* ==================================== */
/* ====== for DEBUG ======== */
#if 0
static void dump_xml() {
GList *list;
g_warning("XML lentgh = %d\n", g_list_length(board_list));
......@@ -564,16 +565,19 @@ static void dump_xml() {
g_warning("xml = %s %s %s %s %s %s\n", board->pixmapfile, board->answer, board->question, board->l1, board->l2, board->l3);
}
}
#endif
/* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gc_prop_get();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
filename = gc_file_find_absolute("%s/board1.xml",
gcomprisBoard->boarddir);
assert(read_xml_file(filename)== TRUE);
g_free(filename);
dump_xml();
}
/* ==================================== */
......@@ -591,32 +595,18 @@ static void add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child)
xmlnode = xmlnode->next;
while (xmlnode != NULL && !found) {
gchar *lang = (gchar *)xmlGetProp(xmlnode, BAD_CAST "lang");
if (!strcmp((char *)xmlnode->name, "pixmapfile"))
pixmapfile = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
if (!found && !strcmp((char *)xmlnode->name, "data"))
{
if(lang==NULL && data==NULL)
{
data = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
}
else if(!strncmp(gc_locale_get(), lang, 5))
if(data==NULL)
{
if(data) free(data);
data = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
/* That's the perfect choice, do not continue or we may override it */
found = TRUE;
}
else if(!strncmp(gc_locale_get(), lang, strlen(lang)))
{
if(data) free(data);
data = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
data = gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1));
}
}
xmlnode = xmlnode->next;
g_free(lang);
}
// I really don't know why this test, but otherwise, the list is doubled
......@@ -671,16 +661,9 @@ static gboolean 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;
......
......@@ -407,13 +407,13 @@ static void highlight_selected(int c) {
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gc_prop_get();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
g_warning("filename = %s %s %s\n", filename, properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
filename = gc_file_find_absolute("%s/board1.xml",
gcomprisBoard->boarddir);
assert(read_xml_file(filename)== TRUE);