gcompris r3715 - in branches/GCOMPRIS_8_3: . boards/colors boards/gcompris/dice boards/gcompris/misc boards/gcompris/timers boards/images boards/opt boards/skins/babytoy boards/wordsgame src/boards src/boards/python src/gcompris



Author: bcoudoin
Date: Sat Jan 31 13:25:59 2009
New Revision: 3715
URL: http://svn.gnome.org/viewvc/gcompris?rev=3715&view=rev

Log:
Merge trunk 3700,3701 to 3705-3713


Added:
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_0.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_0.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_1.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_1.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_2.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_2.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_3.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_3.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_4.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_4.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_5.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_5.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_6.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_6.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_7.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_7.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_8.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_8.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/small_dice_9.png
      - copied unchanged from r3713, /trunk/boards/gcompris/dice/small_dice_9.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux0.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux0.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux1.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux1.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux10.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux10.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux2.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux2.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux3.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux3.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux4.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux4.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux5.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux5.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux6.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux6.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux7.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux7.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux8.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux8.png
   branches/GCOMPRIS_8_3/boards/gcompris/timers/tux9.png
      - copied unchanged from r3713, /trunk/boards/gcompris/timers/tux9.png
   branches/GCOMPRIS_8_3/boards/images/fish00.png
      - copied unchanged from r3713, /trunk/boards/images/fish00.png
   branches/GCOMPRIS_8_3/boards/images/fish01.png
      - copied unchanged from r3713, /trunk/boards/images/fish01.png
   branches/GCOMPRIS_8_3/boards/images/fish02.png
      - copied unchanged from r3713, /trunk/boards/images/fish02.png
   branches/GCOMPRIS_8_3/boards/images/fish03.png
      - copied unchanged from r3713, /trunk/boards/images/fish03.png
   branches/GCOMPRIS_8_3/src/gcompris/board_config_combo.c
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_combo.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config_common.c
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_common.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config_common.h
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_common.h
   branches/GCOMPRIS_8_3/src/gcompris/board_config_radio.c
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_radio.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config_textview.c
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_textview.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config_wordlist.c
      - copied unchanged from r3701, /trunk/src/gcompris/board_config_wordlist.c
Removed:
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice0.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice1.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice2.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice3.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice4.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice5.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice6.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice7.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice8.png
   branches/GCOMPRIS_8_3/boards/gcompris/dice/gnome-dice9.png
Modified:
   branches/GCOMPRIS_8_3/   (props changed)
   branches/GCOMPRIS_8_3/ChangeLog
   branches/GCOMPRIS_8_3/boards/colors/colors_bg.png
   branches/GCOMPRIS_8_3/boards/gcompris/misc/toomanyerrors.png
   branches/GCOMPRIS_8_3/boards/opt/target_background.jpg
   branches/GCOMPRIS_8_3/boards/skins/babytoy/button_up_selected.png
   branches/GCOMPRIS_8_3/boards/wordsgame/default-fr.xml
   branches/GCOMPRIS_8_3/src/boards/advanced_colors.c
   branches/GCOMPRIS_8_3/src/boards/click_on_letter.c
   branches/GCOMPRIS_8_3/src/boards/colors.c
   branches/GCOMPRIS_8_3/src/boards/gletters.c
   branches/GCOMPRIS_8_3/src/boards/imageid.c
   branches/GCOMPRIS_8_3/src/boards/menu2.c
   branches/GCOMPRIS_8_3/src/boards/missingletter.c
   branches/GCOMPRIS_8_3/src/boards/py-mod-gcompris.c
   branches/GCOMPRIS_8_3/src/boards/python/bargame.py
   branches/GCOMPRIS_8_3/src/boards/python/connect4.py
   branches/GCOMPRIS_8_3/src/boards/python/redraw.py
   branches/GCOMPRIS_8_3/src/boards/reading.c
   branches/GCOMPRIS_8_3/src/boards/reversecount.c
   branches/GCOMPRIS_8_3/src/boards/scale.c
   branches/GCOMPRIS_8_3/src/boards/shapegame.c
   branches/GCOMPRIS_8_3/src/boards/smallnumbers.c
   branches/GCOMPRIS_8_3/src/boards/target.c
   branches/GCOMPRIS_8_3/src/boards/wordsgame.c
   branches/GCOMPRIS_8_3/src/gcompris/Makefile.am
   branches/GCOMPRIS_8_3/src/gcompris/bar.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config.c
   branches/GCOMPRIS_8_3/src/gcompris/board_config.h
   branches/GCOMPRIS_8_3/src/gcompris/timer.c
   branches/GCOMPRIS_8_3/src/gcompris/timer.h
   branches/GCOMPRIS_8_3/src/gcompris/wordlist.c
   branches/GCOMPRIS_8_3/src/gcompris/wordlist.h

Modified: branches/GCOMPRIS_8_3/boards/colors/colors_bg.png
==============================================================================
Binary files. No diff available.

Modified: branches/GCOMPRIS_8_3/boards/gcompris/misc/toomanyerrors.png
==============================================================================
Binary files. No diff available.

Modified: branches/GCOMPRIS_8_3/boards/opt/target_background.jpg
==============================================================================
Binary files. No diff available.

Modified: branches/GCOMPRIS_8_3/boards/skins/babytoy/button_up_selected.png
==============================================================================
Binary files. No diff available.

Modified: branches/GCOMPRIS_8_3/boards/wordsgame/default-fr.xml
==============================================================================
--- branches/GCOMPRIS_8_3/boards/wordsgame/default-fr.xml	(original)
+++ branches/GCOMPRIS_8_3/boards/wordsgame/default-fr.xml	Sat Jan 31 13:25:59 2009
@@ -1,89 +1,9 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml version="1.0"?>
 <GCompris>
-<Wordlist name="default-fr" description="Default French" locale="fr">
-<level value="1">
-moto
-auto
-marmelade
-mare
-natte
-tape
-lape
-tache
-passe
-tasse
-marie
-pot
-mot
-porte
-mur
-sur
-</level>
-<level value="2">
-navire
-arrive
-sort
-port
-piano
-violon
-os
-chatte
-mer
-loto
-amie
-copine
-tortue
-sorti
-sourire
-auto
-</level>
-<level value="3">
-samedi
-vendredi
-jeudi
-mercredi
-mardi
-lundi
-dimanche
-sale
-cafÃ
-rit
-chocolat
-lape
-pale
-nuit
-fuit
-lit
-suit
-ratÃ
-mal
-six
-patte
-</level>
-<level value="4">
-pic
-roc
-sac
-choc
-canne
-carte
-cape
-colle
-cafÃ
-canard
-carpe
-cachalot
-canari
-pie
-carrÃ
-cassÃ
-ÃcorchÃ
-cache
-cuit
-calÃ
-copie
-canot
-colorie
-</level>
-</Wordlist>
+  <Wordlist name="default-fr" description="Default French" locale="fr">
+    <level value="4">pic roc sac choc canne carte cape colle caf&#xE9; canard carpe cachalot canari pie carr&#xE9; cass&#xE9; &#xE9;corch&#xE9; cache cuit cal&#xE9; copie canot colorie </level>
+    <level value="2">coucou popo pupu </level>
+    <level value="3">gfgfd gf gfd gdf g </level>
+    <level value="1">clara cl&#xE9;ment bruno &#xE2;ne </level>
+  </Wordlist>
 </GCompris>

Modified: branches/GCOMPRIS_8_3/src/boards/advanced_colors.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/advanced_colors.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/advanced_colors.c	Sat Jan 31 13:25:59 2009
@@ -477,7 +477,13 @@
 	  sColor = g_strdup_printf("color%d", i+1);
 	  if (!strcmp((char *)xmlnode->name, sColor))
 	    {
-	      colors[i] = gettext((char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1));
+	      text = (char*)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
+	      if(text)
+	      {
+	      	colors[i] = gettext((char *)text);
+	        g_free(text);
+	      }
+	      text = NULL;
 	      g_free(sColor);
 	      break;
 	    }

Modified: branches/GCOMPRIS_8_3/src/boards/click_on_letter.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/click_on_letter.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/click_on_letter.c	Sat Jan 31 13:25:59 2009
@@ -623,8 +623,8 @@
   gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 				 agcomprisBoard->name,
 				 aProfile ? aProfile->name : "");
-
-  gc_board_config_window_display(label, conf_ok);
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display(label, conf_ok);
 
   g_free(label);
 
@@ -633,7 +633,7 @@
 
   gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound");
 
-  gc_board_config_combo_locales_asset( "Select sound locale", saved_locale_sound,
+  gc_board_config_combo_locales_asset(bconf, "Select sound locale", saved_locale_sound,
 				"voices/$LOCALE/colors/purple.ogg");
 
   gboolean up_init = FALSE;
@@ -643,7 +643,7 @@
   if (up_init_str && (strcmp(up_init_str, "True")==0))
     up_init = TRUE;
 
-  gc_board_config_boolean_box(_("Uppercase only text"),
+  gc_board_config_boolean_box(bconf, _("Uppercase only text"),
 		       "uppercase_only",
 		       up_init);
 

Modified: branches/GCOMPRIS_8_3/src/boards/colors.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/colors.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/colors.c	Sat Jan 31 13:25:59 2009
@@ -165,7 +165,7 @@
   label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 			  agcomprisBoard->name, aProfile ? aProfile->name : "");
 
-  gc_board_config_window_display(label, conf_ok);
+  GcomprisBoardConf *bconf = gc_board_config_window_display(label, conf_ok);
 
   g_free(label);
 
@@ -174,7 +174,7 @@
 
   gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound");
 
-  gc_board_config_combo_locales_asset( _("Select sound locale"), saved_locale_sound,
+  gc_board_config_combo_locales_asset(bconf, _("Select sound locale"), saved_locale_sound,
 				"voices/$LOCALE/colors/purple.ogg");
 
   g_hash_table_destroy(config);

Modified: branches/GCOMPRIS_8_3/src/boards/gletters.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/gletters.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/gletters.c	Sat Jan 31 13:25:59 2009
@@ -859,7 +859,7 @@
   label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 			  agcomprisBoard->name, aProfile ? aProfile->name : "");
 
-  gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok);
+  GcomprisBoardConf *bconf = gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok);
 
   g_free(label);
 
@@ -868,7 +868,7 @@
 
   gchar *locale = g_hash_table_lookup( config, "locale");
 
-  gc_board_config_combo_locales( locale);
+  gc_board_config_combo_locales( bconf, locale);
 
   gboolean up_init = FALSE;
 
@@ -877,7 +877,7 @@
   if (up_init_str && (strcmp(up_init_str, "True")==0))
     up_init = TRUE;
 
-  gc_board_conf_separator();
+  gc_board_conf_separator(bconf);
 
   gchar *control_sound = g_hash_table_lookup( config, "with_sound");
   if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0)
@@ -885,11 +885,11 @@
   else
     with_sound = FALSE;
 
-  gc_board_config_boolean_box(_("Enable sounds"), "with_sound", with_sound);
+  gc_board_config_boolean_box(bconf, _("Enable sounds"), "with_sound", with_sound);
 
-  gc_board_conf_separator();
+  gc_board_conf_separator(bconf);
 
-  gc_board_config_boolean_box(_("Uppercase only text"),
+  gc_board_config_boolean_box(bconf, _("Uppercase only text"),
 		       "uppercase_only",
 		       up_init);
 

Modified: branches/GCOMPRIS_8_3/src/boards/imageid.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/imageid.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/imageid.c	Sat Jan 31 13:25:59 2009
@@ -53,7 +53,6 @@
 } Board;
 
 /* XML */
-static gboolean		 read_xml_file(char *fname);
 static void		 init_xml(void);
 static void		 add_xml_data(xmlDocPtr doc,xmlNodePtr xmlnode, GNode * child);
 static void		 parse_doc(xmlDocPtr doc);
@@ -555,8 +554,8 @@
 {
   gchar *pixmapfile = NULL;
   gchar *text1 = NULL, *text2 = NULL, *text3 = NULL;
+  xmlChar* tmp;
   Board * board = g_new(Board,1);
-  gboolean found_text1 = FALSE, found_text2 = FALSE, found_text3 = FALSE;
 
   xmlnode = xmlnode->xmlChildrenNode;
 
@@ -567,30 +566,33 @@
     if (!strcmp((char *)xmlnode->name, "pixmapfile"))
       pixmapfile = (gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
 
-    if (!found_text1 && !strcmp((char *)xmlnode->name, "text1"))
+    if (!strcmp((char *)xmlnode->name, "text1"))
       {
 	if(text1==NULL)
 	  {
-	    text1 = \
-	      g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
+	    tmp = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
+	    text1 = g_strdup(gettext((gchar*)tmp));
+	    g_free(tmp);
 	  }
       }
 
-    if (!found_text2 && !strcmp((char *)xmlnode->name, "text2"))
+    if (!strcmp((char *)xmlnode->name, "text2"))
       {
 	if(text2==NULL)
 	  {
-	    text2 = \
-	      g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
+	    tmp = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
+	    text2 = g_strdup(gettext((gchar*)tmp));
+	    g_free(tmp);
 	  }
       }
 
-    if (!found_text3 && !strcmp((char *)xmlnode->name, "text3"))
+    if (!strcmp((char *)xmlnode->name, "text3"))
       {
 	if(text3==NULL)
 	  {
-	    text3 = \
-	      g_strdup(gettext((gchar *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1)));
+	    tmp = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 1);
+	    text3 = g_strdup(gettext((gchar *)tmp));
+	    g_free(tmp);
 	  }
       }
 
@@ -749,8 +751,8 @@
   gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 				 agcomprisBoard->name,
 				 aProfile ? aProfile->name : "");
-
-  gc_board_config_window_display( label,
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display( label,
 				 (GcomprisConfCallback )conf_ok);
 
   g_free(label);
@@ -760,7 +762,7 @@
 
   gchar *locale = g_hash_table_lookup( config, "locale");
 
-  gc_board_config_combo_locales( locale);
+  gc_board_config_combo_locales(bconf, locale);
 
 }
 

Modified: branches/GCOMPRIS_8_3/src/boards/menu2.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/menu2.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/menu2.c	Sat Jan 31 13:25:59 2009
@@ -662,10 +662,13 @@
 
 	}
       else
-	{
+	// This should prevent an evil crash bug
+	// when the kids press 2 buttons at the same time
+	if (event->button.button == 1)
+	 {
 	  gc_sound_play_ogg ("sounds/level.wav", NULL);
 	  gc_board_run_next (board);
-	}
+	 }
 
       break;
 

Modified: branches/GCOMPRIS_8_3/src/boards/missingletter.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/missingletter.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/missingletter.c	Sat Jan 31 13:25:59 2009
@@ -771,8 +771,8 @@
   gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 				 agcomprisBoard->name,
 				 aProfile ? aProfile->name : "");
-
-  gc_board_config_window_display( label,
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display( label,
 				 (GcomprisConfCallback )conf_ok);
 
   g_free(label);
@@ -782,7 +782,7 @@
 
   gchar *locale = g_hash_table_lookup( config, "locale");
 
-  gc_board_config_combo_locales( locale);
+  gc_board_config_combo_locales(bconf, locale);
 
 }
 

Modified: branches/GCOMPRIS_8_3/src/boards/py-mod-gcompris.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/py-mod-gcompris.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/py-mod-gcompris.c	Sat Jan 31 13:25:59 2009
@@ -1077,7 +1077,7 @@
 
   /* Call the corresponding C function */
   return (PyObject *)pygobject_new((GObject*) \
-				    gc_board_config_boolean_box((const gchar *)label, key, PyObject_IsTrue(py_bool)));
+				    gc_board_config_boolean_box(NULL,(const gchar *)label, key, PyObject_IsTrue(py_bool)));
 
 }
 
@@ -1112,7 +1112,7 @@
 
   /* Call the corresponding C function */
   return (PyObject *)pygobject_new((GObject*) \
-				    gc_board_config_combo_box((const gchar *)label,
+				    gc_board_config_combo_box(NULL, (const gchar *)label,
 						       list,
 						       key,
 						       init));
@@ -1197,7 +1197,7 @@
 			  g_strdup(PyString_AsString(pyvalue)));
   }
 
-  result = gc_board_config_radio_buttons(label,
+  result = gc_board_config_radio_buttons(NULL,label,
 				  key,
 				  buttons_label,
 				  init);
@@ -1219,7 +1219,7 @@
     return NULL;
 
   return (PyObject *)pygobject_new((GObject*) \
-				   gc_board_config_spin_int((const gchar *)label,
+				   gc_board_config_spin_int(NULL, (const gchar *)label,
 						     key,
 						     min,
 						     max,
@@ -1238,7 +1238,7 @@
     return NULL;
 
   /* Create and return the result */
-  return (PyObject *)pygobject_new((GObject*) gc_board_conf_separator());
+  return (PyObject *)pygobject_new((GObject*) gc_board_conf_separator(NULL));
 
 }
 
@@ -1253,7 +1253,7 @@
     return NULL;
 
   return (PyObject *)pygobject_new((GObject*) \
-				   gc_board_config_combo_locales( init));
+				   gc_board_config_combo_locales(NULL, init));
 }
 
 
@@ -1296,7 +1296,7 @@
     return NULL;
 
   return (PyObject *)pygobject_new((GObject*) \
-				   gc_board_config_combo_locales_asset( label, init, file ));
+				   gc_board_config_combo_locales_asset(NULL, label, init, file ));
 }
 
 
@@ -1447,7 +1447,7 @@
 
   return (PyObject *) \
              pygobject_new((GObject*) \
-			   gc_board_config_textview( label,
+			   gc_board_config_textview(NULL, label,
 					      key,
 					      desc,
 					      init_text,

Modified: branches/GCOMPRIS_8_3/src/boards/python/bargame.py
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/python/bargame.py	(original)
+++ branches/GCOMPRIS_8_3/src/boards/python/bargame.py	Sat Jan 31 13:25:59 2009
@@ -518,9 +518,13 @@
       self.prof_item.connect("event",self.event_play)
       # This item is clickeable and it must be seen
       self.prof_item.connect("event", gcompris.utils.item_event_focus)
+      self.prof_item.connect("event",
+                             lambda tux, event: self.set_prof(self.prof_image) \
+                               if event.type == gtk.gdk.LEAVE_NOTIFY else None  )
 
     def set_prof(self, prof_image):
       self.prof_item.set(pixbuf = gcompris.utils.load_pixmap(prof_image))
+      self.prof_image = prof_image
 
     def event_play(self, item, event):
       if ((event.type != gtk.gdk.BUTTON_PRESS) or

Modified: branches/GCOMPRIS_8_3/src/boards/python/connect4.py
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/python/connect4.py	(original)
+++ branches/GCOMPRIS_8_3/src/boards/python/connect4.py	Sat Jan 31 13:25:59 2009
@@ -1,7 +1,5 @@
 #  gcompris - connect4
 #
-# Time-stamp:
-#
 # Copyright (C) 2005 Laurent Lacheny
 #
 #   This program is free software; you can redistribute it and/or modify
@@ -352,7 +350,7 @@
             width_pixels = 8
             )
         self.redLine.set_property("cap-style", gtk.gdk.CAP_ROUND)
-        if player == 1:
+        if player == 1 or self.mode == 2:
             gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
         elif player == 2:
             gcompris.bonus.display(gcompris.bonus.LOOSE, gcompris.bonus.FLOWER)

Modified: branches/GCOMPRIS_8_3/src/boards/python/redraw.py
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/python/redraw.py	(original)
+++ branches/GCOMPRIS_8_3/src/boards/python/redraw.py	Sat Jan 31 13:25:59 2009
@@ -199,9 +199,14 @@
       self.erase_drawing_area()
       if (self.increment_level() == 1):
         self.gamewon = 1
-        gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
-        self.display_current_level()
-        self.root_targetitem.hide()
+        # (Quick fix) Trying to avoid a crash when board is finished
+        if self.display_current_level() == 0:  # the current board is finished...
+            gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
+            self.end()
+        else:   # Level up
+            self.root_targetitem.hide()
+            gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
+
 
     else:
       # Delete previous mark if any
@@ -287,10 +292,8 @@
     i = (self.gcomprisBoard.level-1)*self.gcomprisBoard.number_of_sublevel+ \
         (self.gcomprisBoard.sublevel-1)
 
-    if(i>=len(self.drawlist)):
-       # the current board is finished : bail out
-       gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)
-       return
+    if(i>=len(self.drawlist)): # if board is finished Only return 
+        return 0
 
     self.draw_image_target(self.drawlist[i])
 
@@ -332,6 +335,8 @@
       # Try the next level
       self.gcomprisBoard.sublevel=1
       self.gcomprisBoard.level += 1
+    
+      
       if(self.gcomprisBoard.level>self.gcomprisBoard.maxlevel) or self.gcomprisBoard.level*self.gcomprisBoard.sublevel>=len(self.drawlist):
         # the current board is finished : bail out
         gcompris.bonus.board_finished(gcompris.bonus.FINISHED_RANDOM)

Modified: branches/GCOMPRIS_8_3/src/boards/reading.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/reading.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/reading.c	Sat Jan 31 13:25:59 2009
@@ -47,7 +47,8 @@
 typedef enum
 {
   MODE_HORIZONTAL		= 0,
-  MODE_VERTICAL			= 1
+  MODE_VERTICAL			= 1,
+  MODE_HORIZONTAL_RTL		= 2
 } Mode;
 static Mode currentMode = MODE_VERTICAL;
 
@@ -211,10 +212,9 @@
 
       g_warning ("Font to display words have size %d  ascent : %d, descent : %d.\n Set inerline to %d", font_size, ascent, descent, interline);
 
-      /* Default mode */
-      currentMode=MODE_VERTICAL;
-      if(gcomprisBoard->mode && g_strcasecmp(gcomprisBoard->mode, "horizontal")==0)
-	currentMode=MODE_HORIZONTAL;
+
+
+      
 
       gc_wordlist = gc_wordlist_get_from_file("wordsgame/default-$LOCALE.xml");
 
@@ -231,7 +231,17 @@
 	    }
 	}
 
-      reading_next_level();
+      
+      currentMode=MODE_VERTICAL; // Default mode 
+      if(gcomprisBoard->mode && g_strcasecmp(gcomprisBoard->mode, "horizontal")==0)
+        {
+          if (pango_unichar_direction(g_utf8_get_char(gc_wordlist_random_word_get(gc_wordlist, gcomprisBoard->level))) == PANGO_DIRECTION_RTL)	
+              currentMode=MODE_HORIZONTAL_RTL;
+          else
+               currentMode=MODE_HORIZONTAL;
+        }
+   
+       reading_next_level();
     }
 }
 
@@ -315,7 +325,7 @@
     }
   else
     {
-      current_x = BASE_X1;
+      current_x = BASE_X2;
       numberOfLine=2+gcomprisBoard->level;
     }
 
@@ -462,6 +472,8 @@
 
   if(currentMode==MODE_HORIZONTAL)
     anchor=GTK_ANCHOR_WEST;
+  else if (currentMode==MODE_HORIZONTAL_RTL)
+    anchor=GTK_ANCHOR_EAST;
 
   previousFocus.item = \
     gnome_canvas_item_new (GNOME_CANVAS_GROUP(previousFocus.rootItem),
@@ -498,6 +510,24 @@
       current_y += interline;
       numberOfLine--;
     }
+  else if (currentMode==MODE_HORIZONTAL_RTL)
+    {
+      double x1, y1, x2, y2;
+
+      gnome_canvas_item_get_bounds(GNOME_CANVAS_ITEM(previousFocus.rootItem), &x1, &y1, &x2, &y2);
+
+      // Are we out of bound
+      if(x1<BASE_X1)
+	{
+	  // Do the line Wrapping
+	  gnome_canvas_item_move(GNOME_CANVAS_ITEM(previousFocus.rootItem), BASE_X2-x2, interline);
+	  current_y += interline;
+	  current_x = BASE_X2;
+	  numberOfLine--;
+	}
+      current_x -= x2-x1 + font_size;
+     }
+
   else
     {
       double x1, y1, x2, y2;
@@ -822,6 +852,7 @@
 reading_config_start(GcomprisBoard *agcomprisBoard,
 		    GcomprisProfile *aProfile)
 {
+  GcomprisBoardConf *conf;
   board_conf = agcomprisBoard;
   profile_conf = aProfile;
 
@@ -832,7 +863,7 @@
 				 agcomprisBoard->name,
 				 aProfile? aProfile->name: "");
 
-  gc_board_config_window_display( label,
+  conf = gc_board_config_window_display( label,
 				 (GcomprisConfCallback )conf_ok);
 
   g_free(label);
@@ -842,8 +873,8 @@
 
   gchar *locale = g_hash_table_lookup( config, "locale");
 
-  gc_board_config_combo_locales( locale);
-
+  gc_board_config_combo_locales(conf, locale);
+  gc_board_config_wordlist(conf, "wordsgame/default-$LOCALE.xml");
 }
 
 

Modified: branches/GCOMPRIS_8_3/src/boards/reversecount.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/reversecount.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/reversecount.c	Sat Jan 31 13:25:59 2009
@@ -89,41 +89,17 @@
   "opt/epaulard.png",
   "opt/narval.png",
 };
-#define NUMBER_OF_IMAGES 10
+#define NUM_IMAGELIST G_N_ELEMENTS(imageList)
 
 // List of fish to use in the game
 static gchar *fishList[] =
 {
-  "fishes/blueking2_0.png",
-  "fishes/butfish_0.png",
-  "fishes/cichlid1_0.png",
-  "fishes/cichlid4_0.png",
-  "fishes/collaris_0.png",
-  "fishes/discus2_0.png",
-  "fishes/discus3_0.png",
-  "fishes/eel_0.png",
-  "fishes/f00_0.png",
-  "fishes/f01_0.png",
-  "fishes/f02_0.png",
-  "fishes/f03_0.png",
-  "fishes/f04_0.png",
-  "fishes/f05_0.png",
-  "fishes/f06_0.png",
-  "fishes/f07_0.png",
-  "fishes/f08_0.png",
-  "fishes/f09_0.png",
-  "fishes/f10_0.png",
-  "fishes/f11_0.png",
-  "fishes/f12_0.png",
-  "fishes/f13_0.png",
-  "fishes/manta_0.png",
-  "fishes/newf1_0.png",
-  "fishes/QueenAngel_0.png",
-  "fishes/shark1_0.png",
-  "fishes/six_barred_0.png",
-  "fishes/teeth_0.png"
+  "images/fish00.png",
+  "images/fish01.png",
+  "images/fish02.png",
+  "images/fish03.png",
 };
-#define NUMBER_OF_FISHES 27
+#define NUMBER_OF_FISHES G_N_ELEMENTS(fishList)
 
 /* Description of this plugin */
 static BoardPlugin menu_bp =
@@ -331,6 +307,7 @@
 /* set initial values for the next level */
 static void reversecount_next_level()
 {
+  g_assert(NUM_IMAGELIST > gcomprisBoard->level-1);
 
   gc_set_background(gnome_canvas_root(gcomprisBoard->canvas),
 			  imageList[gcomprisBoard->level-1]);
@@ -530,7 +507,7 @@
 
   //----------------------------------------
   // Create the dices
-  pixmap = gc_pixmap_load("gcompris/dice/gnome-dice1.png");
+  pixmap = gc_pixmap_load("gcompris/dice/small_dice_1.png");
 
   for(d=0; d<number_of_dices; d++)
     {
@@ -711,7 +688,7 @@
 	  break;
 	}
 
-      str = g_strdup_printf("gcompris/dice/gnome-dice%d.png", dicevalue_array[i]);
+      str = g_strdup_printf("gcompris/dice/small_dice_%d.png", dicevalue_array[i]);
 
       pixmap = gc_pixmap_load(str);
 
@@ -743,7 +720,7 @@
   if(value<0)
     return;
 
-  str = g_strdup_printf("%s%d.png", "gcompris/timers/clock",value);
+  str = g_strdup_printf("%s%d.png", "gcompris/timers/tux",value);
 
   pixmap = gc_pixmap_load(str);
 
@@ -766,7 +743,7 @@
   if(value<0)
     return;
 
-  str = g_strdup_printf("%s%d.png", "gcompris/timers/clock",value);
+  str = g_strdup_printf("%s%d.png", "gcompris/timers/tux",value);
 
   pixmap = gc_pixmap_load(str);
 

Modified: branches/GCOMPRIS_8_3/src/boards/scale.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/scale.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/scale.c	Sat Jan 31 13:25:59 2009
@@ -862,8 +862,8 @@
   gchar * label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 				  agcomprisBoard->name,
 				  aProfile? aProfile->name : "");
-
-  gc_board_config_window_display( label,
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display( label,
 				 (GcomprisConfCallback )conf_ok);
 
   g_free(label);
@@ -879,7 +879,7 @@
   else
     drag_previous = 0;
 
-  gc_board_config_combo_drag( drag_mode);
+  gc_board_config_combo_drag(bconf, drag_mode);
 
 }
 

Modified: branches/GCOMPRIS_8_3/src/boards/shapegame.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/shapegame.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/shapegame.c	Sat Jan 31 13:25:59 2009
@@ -435,6 +435,7 @@
   char *filename;
 
   gamewon = FALSE;
+  gc_drag_stop(gnome_canvas_root(gcomprisBoard->canvas));
 
   shapegame_destroy_all_items();
   next_shapelist_item = previous_shapelist_item = NULL;
@@ -457,6 +458,8 @@
 
   read_xml_file(filename);
 
+
+  gc_drag_start(gnome_canvas_root(gcomprisBoard->canvas), (gc_Drag_Func) item_event_drag, drag_mode);
   g_free(filename);
 }
 
@@ -1868,7 +1871,8 @@
 				  agcomprisBoard->name,
 				  aProfile? aProfile->name : "");
 
-  gc_board_config_window_display( label,
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display( label,
 				 (GcomprisConfCallback )conf_ok);
 
   g_free(label);
@@ -1879,7 +1883,7 @@
   if (strcmp(agcomprisBoard->name, "imagename")==0){
     gchar *locale = g_hash_table_lookup( config, "locale");
 
-    gc_board_config_combo_locales( locale);
+    gc_board_config_combo_locales( bconf, locale);
   }
 
   gchar *drag_mode_str = g_hash_table_lookup( config, "drag_mode");
@@ -1890,7 +1894,7 @@
   else
     drag_previous = 0;
 
-  gc_board_config_combo_drag( drag_mode);
+  gc_board_config_combo_drag(bconf, drag_mode);
 
 }
 

Modified: branches/GCOMPRIS_8_3/src/boards/smallnumbers.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/smallnumbers.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/smallnumbers.c	Sat Jan 31 13:25:59 2009
@@ -593,7 +593,8 @@
   label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
 			  agcomprisBoard->name, aProfile ? aProfile->name : "");
 
-  gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok);
+  GcomprisBoardConf *bconf;
+  bconf = gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok);
 
   g_free(label);
 
@@ -608,9 +609,9 @@
   else
     with_sound = FALSE;
 
-  GtkCheckButton  *sound_control = gc_board_config_boolean_box(_("Enable sounds"), "with_sound", with_sound);
+  GtkCheckButton  *sound_control = gc_board_config_boolean_box(bconf, _("Enable sounds"), "with_sound", with_sound);
 
-  GtkComboBox *sound_box = gc_board_config_combo_locales_asset( _("Select sound locale"),
+  GtkComboBox *sound_box = gc_board_config_combo_locales_asset(bconf, _("Select sound locale"),
 							 saved_locale_sound,
 							 "voices/$LOCALE/colors/purple.ogg");
 

Modified: branches/GCOMPRIS_8_3/src/boards/target.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/target.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/target.c	Sat Jan 31 13:25:59 2009
@@ -377,7 +377,7 @@
   gnome_canvas_item_new (speedRootItem,
 			 gnome_canvas_line_get_type (),
 			 "points", canvasPoints,
-			 "fill_color_rgba", 0x6df438FF,
+			 "fill_color", "red",
 			 "width_units", (double)1,
 			 "width_pixels", (guint) 4,
 			 "last_arrowhead", TRUE,
@@ -395,7 +395,7 @@
 			 "y1", (double)SPEED_CENTER_Y-5,
 			 "x2", (double)SPEED_CENTER_X+5,
 			 "y2", (double)SPEED_CENTER_Y+5,
-			 "fill_color_rgba", 0x6df438FF,
+			 "fill_color", "red",
 			 "outline_color", "red",
 			 "width_units", (double)1,
 			 NULL);
@@ -476,7 +476,7 @@
 			 "x", (double) 0,
 			 "y", (double) BOARDHEIGHT-TARGET_CENTER_Y -45,
 			 "anchor", GTK_ANCHOR_CENTER,
-			 "fill_color", "white",
+			 "fill_color", "black",
 			 NULL);
   g_free(tmpstr);
 
@@ -551,7 +551,7 @@
 				       "x", (double) x_offset + gdk_pixbuf_get_width(button_pixmap)/2,
 				       "y", (double) y_offset + gdk_pixbuf_get_height(button_pixmap)/2,
 				       "anchor", GTK_ANCHOR_CENTER,
-				       "fill_color", "white",
+				       "fill_color", "black",
 				       NULL);
   g_free(tmpstr);
 

Modified: branches/GCOMPRIS_8_3/src/boards/wordsgame.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/boards/wordsgame.c	(original)
+++ branches/GCOMPRIS_8_3/src/boards/wordsgame.c	Sat Jan 31 13:25:59 2009
@@ -82,6 +82,10 @@
 static void		 wordsgame_destroy_all_items(void);
 static void		 wordsgame_next_level(void);
 static void		 wordsgame_add_new_item(void);
+static void		 wordsgame_config_start(GcomprisBoard *agcomprisBoard,
+					     GcomprisProfile *aProfile);
+static void		 wordsgame_config_stop(void);
+
 
 static void		 player_win(LettersItem *item);
 static void		 player_loose(void);
@@ -124,8 +128,8 @@
     set_level,
     NULL,
     NULL,
-    NULL,
-    NULL
+    wordsgame_config_start,
+    wordsgame_config_stop
   };
 
 /*
@@ -188,7 +192,7 @@
       gcomprisBoard->level = 1;
       gcomprisBoard->maxlevel = 6;
       gcomprisBoard->sublevel = 0;
-      gc_bar_set(GC_BAR_LEVEL);
+      gc_bar_set(GC_BAR_LEVEL|GC_BAR_CONFIG);
 
       /* Default speed */
       speed=DEFAULT_SPEED;
@@ -650,9 +654,14 @@
                                    &y2);
 
   if(direction_anchor == GTK_ANCHOR_NW)
-    gnome_canvas_item_move (item->rootitem,(double) (g_random_int()%(gcomprisBoard->width-(gint)(x2))),(double) 0);
+      gnome_canvas_item_move (item->rootitem,(double) (g_random_int()%(gcomprisBoard->width-(gint)(x2))),(double) 0);
   else
-    gnome_canvas_item_move (item->rootitem,(double) (g_random_int()%(gcomprisBoard->width+(gint)(x2))),(double) 0);
+   {
+      double new_x = (double)( g_random_int()%gcomprisBoard->width); 
+      if ( new_x < -x1 )      
+		new_x -=  x1;
+      gnome_canvas_item_move (item->rootitem, new_x ,(double) 0);
+   }
 
   g_static_rw_lock_writer_lock (&items_lock);
   g_ptr_array_add(items, item);
@@ -755,3 +764,30 @@
 {
   gc_sound_play_ogg ("sounds/crash.wav", NULL);
 }
+
+static void conf_ok(gpointer data)
+{
+	pause_board(FALSE);
+}
+
+static void wordsgame_config_start(GcomprisBoard *agcomprisBoard, GcomprisProfile *aProfile)
+{
+	if (gcomprisBoard)
+		pause_board(TRUE);
+
+	gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
+			agcomprisBoard->name,
+			aProfile? aProfile->name: "");
+	GcomprisBoardConf *bconf;
+	bconf = gc_board_config_window_display( label,
+			(GcomprisConfCallback )conf_ok);
+
+	g_free(label);
+
+	gc_board_config_wordlist(bconf, "wordsgame/default-$LOCALE.xml");
+}
+
+static void wordsgame_config_stop(void)
+{
+}
+

Modified: branches/GCOMPRIS_8_3/src/gcompris/Makefile.am
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/Makefile.am	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/Makefile.am	Sat Jan 31 13:25:59 2009
@@ -71,7 +71,9 @@
 	binreloc.c \
 	binreloc.h \
 	board.h board.c \
-	board_config.h \
+	board_config_common.c board_config_common.h \
+	board_config_combo.c board_config_radio.c\
+	board_config_textview.c board_config_wordlist.c \
 	board_config.h board_config.c \
 	bonus.c \
 	bonus.h \

Modified: branches/GCOMPRIS_8_3/src/gcompris/bar.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/bar.c	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/bar.c	Sat Jan 31 13:25:59 2009
@@ -544,7 +544,11 @@
 		}
 	    }
 	}
-      else if(!strcmp((char *)data, "back"))
+      /*
+	 using left button only should prevent the menu from freezing
+	 when pressing two or more buttons at the same time
+      */
+      else if( !strcmp((char *)data, "back") && event->button.button == 1 )
 	{
 	  gc_bar_hide (TRUE);
 	  gc_board_stop();

Modified: branches/GCOMPRIS_8_3/src/gcompris/board_config.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/board_config.c	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/board_config.c	Sat Jan 31 13:25:59 2009
@@ -20,10 +20,8 @@
  */
 
 #include <string.h>
-
 #include "gcompris.h"
-
-#define COMBOBOX_COL_MAX 15
+#include "board_config_common.h"
 
 static GcomprisBoard *config_board;
 
@@ -61,37 +59,23 @@
   return;
 }
 
-static GtkWindow *conf_window = NULL;
-static GtkVBox *main_conf_box = NULL;
-static GHashTable *hash_conf = NULL;
-static GcomprisConfCallback Confcallback = NULL;
-static gchar *label_markup = NULL;
-
-
-static void
-check_key(gchar *key)
-{
-  if ((strcmp(key, "locale") == 0) ||
-      (strcmp(key, "locale_sound") == 0) ||
-      (strcmp(key, "wordlist") == 0))
-    g_error(" Key %s forbiden ! Change !", key);
-}
-
 void
 gc_board_conf_close (GtkDialog *dialog,
 		     gpointer   user_data)
 {
+  GcomprisBoardConf *u= (GcomprisBoardConf*)user_data;
+
   gtk_object_destroy(GTK_OBJECT(dialog));
-  g_hash_table_destroy (hash_conf);
-  hash_conf = NULL;
+  g_hash_table_destroy (u->hash_conf);
+  u->hash_conf = NULL;
 
   /* in case we close without response */
-  if (Confcallback){
-    Confcallback(NULL);
-    Confcallback = NULL;
+  if (u->Confcallback){
+    u->Confcallback(NULL);
+    u->Confcallback = NULL;
   }
+  g_free(u);
 
-  g_free(label_markup);
 }
 
 void
@@ -99,28 +83,29 @@
 		      gint arg1,
 		      gpointer user_data)
 {
+  GcomprisBoardConf *u= (GcomprisBoardConf*)user_data;
 
-  if (Confcallback){
+  if (u->Confcallback){
 
     switch (arg1){
     case GTK_RESPONSE_APPLY:
-      Confcallback(hash_conf);
+      u->Confcallback(u->hash_conf);
       break;
     case GTK_RESPONSE_CANCEL:
-      Confcallback(NULL);
+      u->Confcallback(NULL);
       break;
     case GTK_RESPONSE_NONE:
-      Confcallback(NULL);
+      u->Confcallback(NULL);
       break;
     default:
-      Confcallback(NULL);
+      u->Confcallback(NULL);
       break;
     }
 
-    Confcallback = NULL;
+    u->Confcallback = NULL;
   }
 
-  gc_board_conf_close (GTK_DIALOG(conf_window), NULL);
+  gc_board_conf_close (GTK_DIALOG(u->conf_window), u);
 
 }
 
@@ -131,6 +116,7 @@
 _conf_window_configured(GtkWindow *window,
 			GdkEventConfigure *event, gpointer param)
 {
+  GcomprisBoardConf *u= (GcomprisBoardConf*)param;
   gint new_x, new_y;
   double screen_width, screen_height;
   /* Because we call gtk_window_move, we cause a configure event. Filter out
@@ -144,7 +130,7 @@
     new_x = ((gint)screen_width - event->width) / 2;
     new_y = ((gint)screen_height - event->height) / 2;
     /* printf("screen %dx%d, window %dx%d, place %dx%d\n", (int)screen_width, (int)screen_height, event->width, event->height, new_x, new_y); */
-    gtk_window_move (conf_window, new_x, new_y);
+    gtk_window_move (u->conf_window, new_x, new_y);
     memcpy(&last_configure_event, event, sizeof(GdkEventConfigure));
   }
 
@@ -153,14 +139,17 @@
 }
 #endif
 
-GtkVBox *
+GcomprisBoardConf *
 gc_board_config_window_display(gchar *label, GcomprisConfCallback callback)
 {
   GtkWidget *header;
+  GcomprisBoardConf *config;
+
+  config = g_malloc0(sizeof(GcomprisBoardConf));
 
   /* init static values or callbacks */
-  Confcallback = callback;
-  hash_conf = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+  config->Confcallback = callback;
+  config->hash_conf = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
   /* Creating a config window will cause our main window to loose focus,
      this tells the main window to ignore the next focus out event (and thus
@@ -168,7 +157,7 @@
   gc_ignore_next_focus_out();
 
   /* main configuration window */
-  conf_window = \
+  config->conf_window = \
     GTK_WINDOW(gtk_dialog_new_with_buttons ("GCompris",
 					    GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET(gc_board_get_current()->canvas))),
 					    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -185,16 +174,16 @@
       !gc_prop_get()->noxf86vm)
     {
       memset(&last_configure_event, 0, sizeof(GdkEventConfigure));
-      gtk_widget_add_events(GTK_WIDGET(conf_window), GDK_STRUCTURE_MASK);
-      gtk_signal_connect (GTK_OBJECT (conf_window), "configure_event",
+      gtk_widget_add_events(GTK_WIDGET(config->conf_window), GDK_STRUCTURE_MASK);
+      gtk_signal_connect (GTK_OBJECT (config->conf_window), "configure_event",
         GTK_SIGNAL_FUNC (_conf_window_configured), 0);
     }
   else
 #endif
-      gtk_window_set_position (conf_window,
+      gtk_window_set_position (config->conf_window,
 				   GTK_WIN_POS_CENTER_ALWAYS);
 
-  gtk_widget_show(GTK_WIDGET(conf_window));
+  gtk_widget_show(GTK_WIDGET(config->conf_window));
 
   GcomprisProperties *properties = gc_prop_get();
   if (properties->fullscreen && !properties->noxf86vm)
@@ -204,24 +193,24 @@
       g_warning("Pointer grab failed");
 
   /* main vbox in window */
-  main_conf_box = GTK_VBOX(GTK_DIALOG(conf_window)->vbox);
+  config->main_conf_box = GTK_VBOX(GTK_DIALOG(config->conf_window)->vbox);
 
-  g_signal_connect(G_OBJECT(conf_window),
+  g_signal_connect(G_OBJECT(config->conf_window),
 		   "response",
 		   G_CALLBACK(_response_board_conf),
-		   NULL);
+		   config);
 
-  g_signal_connect (G_OBJECT(conf_window),
+  g_signal_connect (G_OBJECT(config->conf_window),
 		    "close",
 		    G_CALLBACK(gc_board_conf_close),
-		    NULL);
+		    config);
 
 
 
   /* Label header */
   header = gtk_label_new ((gchar *)NULL);
   gtk_widget_show(header);
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
+  gtk_box_pack_start (GTK_BOX(config->main_conf_box),
 		      header,
 		      FALSE,
 		      FALSE,
@@ -230,20 +219,23 @@
   gtk_label_set_justify (GTK_LABEL(header),
 			 GTK_JUSTIFY_CENTER);
 
+  gchar *label_markup = NULL;
   label_markup = g_strdup_printf("<span size='large'>%s</span>",label);
   gtk_label_set_markup (GTK_LABEL(header),
                         (const gchar *)label_markup);
+  g_free(label_markup);
 
-  gc_board_conf_separator();
+  gc_board_conf_separator(config);
 
-  return main_conf_box;
+  return config;
 }
 
 void
 gc_board_conf_boolean_box_toggled (GtkToggleButton *togglebutton,
 			      gpointer key)
 {
-  gchar *the_key = g_strdup((gchar *)key);
+  _gc_boardconf_key *u = (_gc_boardconf_key*)key;
+  gchar *the_key = g_strdup(u->key);
   gchar *value;
 
   if (gtk_toggle_button_get_active (togglebutton))
@@ -251,19 +243,22 @@
   else
     value = g_strdup("False");
 
-  g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
+  g_hash_table_replace(u->config->hash_conf, (gpointer) the_key, (gpointer) value);
 }
 
 GtkCheckButton *
-gc_board_config_boolean_box(const gchar *label, gchar *key, gboolean initial_value)
+gc_board_config_boolean_box(GcomprisBoardConf *config, const gchar *label, gchar *key, gboolean initial_value)
 {
+  _gc_boardconf_key *user_data;
+
+  g_return_val_if_fail(config, NULL);
   check_key( key);
 
   GtkWidget *CheckBox = gtk_check_button_new_with_label (label);
 
   gtk_widget_show(CheckBox);
 
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
+  gtk_box_pack_start (GTK_BOX(config->main_conf_box),
 		      CheckBox,
 		      FALSE,
 		      FALSE,
@@ -272,242 +267,37 @@
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(CheckBox),
 				initial_value);
 
+  user_data = g_malloc0(sizeof(_gc_boardconf_key));
+  user_data -> key =g_strdup(key);
+  user_data -> config = config;
+
   g_signal_connect   (G_OBJECT(CheckBox),
 		      "toggled",
 		      G_CALLBACK(gc_board_conf_boolean_box_toggled),
-		      key);
-
+		      user_data);
+  g_signal_connect  (G_OBJECT(CheckBox),
+  			"destroy",
+			G_CALLBACK(_gc_destroy_boardconf_key),
+			user_data);
   return GTK_CHECK_BUTTON(CheckBox);
 }
 
-/* code get from gtk */
-/* included here to not depend on gtk 2.6 */
-
-static gchar *
-_get_active_text (GtkComboBox *combo_box)
-{
-  GtkTreeIter iter;
-  gchar *text = NULL;
-
-  g_return_val_if_fail (GTK_IS_LIST_STORE (gtk_combo_box_get_model (combo_box)), NULL);
-
-  if (gtk_combo_box_get_active_iter (combo_box, &iter))
-    gtk_tree_model_get (gtk_combo_box_get_model (combo_box), &iter,
-			0, &text, -1);
-
-  return text;
-}
-
-static void
-_combo_box_changed(GtkComboBox *combobox,
-		   gpointer key)
-{
-  gchar *the_key = g_strdup((gchar *)key);
-
-  gchar *value = g_strdup_printf("%s", _get_active_text (combobox));
-
-  g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
-}
-
-static inline int my_strcmp(gchar *a, gchar *b) { return strcmp( a, b); }
-
-
-GtkComboBox *gc_board_config_combo_box(const gchar *label, GList *strings, gchar *key, gchar *init)
-{
-  check_key( key);
-
-  GtkWidget *combobox;
-  GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
-  GList *list;
-  GtkWidget *label_combo;
-  gint init_index = 0;
-
-  if (init)
-    init_index =  g_list_position ( strings, g_list_find_custom ( strings,(gconstpointer)  init, (GCompareFunc) my_strcmp));
-
-  if (init_index < 0)
-    init_index=0;
-
-  gtk_widget_show(hbox);
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      hbox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Label */
-  label_combo = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(label_combo);
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      label_combo,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(label_combo),
-			 GTK_JUSTIFY_RIGHT);
-
-  gtk_label_set_markup (GTK_LABEL(label_combo),
-                        (const gchar *)label);
-
-
-  combobox = gtk_combo_box_new_text();
-
-  gtk_widget_show(combobox);
-
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      combobox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-
-  for (list = strings; list != NULL; list = list->next)
-    gtk_combo_box_append_text       (GTK_COMBO_BOX(combobox),
-				     list->data);
-
-  if (g_list_length(strings) > COMBOBOX_COL_MAX)
-    gtk_combo_box_set_wrap_width    (GTK_COMBO_BOX(combobox),
-  	     g_list_length(strings) / COMBOBOX_COL_MAX +1 );
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
-			    init_index);
-
-  g_signal_connect(G_OBJECT(combobox),
-		   "changed",
-		   G_CALLBACK(_combo_box_changed),
-		   key);
-
-  return GTK_COMBO_BOX(combobox);
-}
-
-static GSList *radio_group = NULL;
-static GtkWidget *radio_box;
-static gchar *radio_key = NULL;
-static gchar *radio_text = NULL;
-static gchar *radio_init = NULL;
-
-static void radio_changed(GtkToggleButton *togglebutton,
-			  gpointer key)
-{
-  gboolean state = gtk_toggle_button_get_active (togglebutton);
-  gchar *h_key;
-  gchar *h_value;
-
-  if (state){
-    h_key = g_strdup (radio_key);
-    h_value = g_strdup((gchar *) key);
-    g_hash_table_replace (hash_conf, h_key, h_value);
-  }
-}
-
-static void
-create_radio_buttons(gpointer key,
-		     gpointer value,
-		     gpointer hash_radio)
-{
-  GtkWidget *radio_button;
-  gchar *key_copy;
-
-  radio_button = gtk_radio_button_new_with_label (radio_group,
-						  (const gchar *) g_strdup(value));
-
-  gtk_box_pack_start (GTK_BOX (radio_box), radio_button, TRUE, TRUE, 2);
-
-  gtk_widget_show (GTK_WIDGET (radio_button));
-
-  radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
-
-  key_copy = g_strdup ((gchar *)key);
-
-  if (strcmp( key_copy, radio_init)==0)
-    gtk_toggle_button_set_active    (GTK_TOGGLE_BUTTON(radio_button),TRUE);
-
-  g_signal_connect(G_OBJECT(radio_button),
-		   "toggled",
-		   G_CALLBACK(radio_changed),
-		   (gpointer) key_copy);
-
-  g_hash_table_replace ( hash_radio, (gpointer) key_copy, (gpointer) radio_button);
-}
-
-static void
-destroy_hash (GtkObject *object,
-	      gpointer hash_table)
-{
-  g_hash_table_destroy((GHashTable *)hash_table);
-  radio_group = NULL;
-  g_free(radio_text);
-  g_free(radio_key);
-  g_free(radio_init);
-}
-
-GHashTable *
-gc_board_config_radio_buttons(const gchar *label,
-		       gchar *key,
-		       GHashTable *buttons_label,
-		       gchar *init)
-{
-  check_key( key);
-
-  GtkWidget *radio_label;
-
-  GHashTable *buttons = g_hash_table_new_full (g_str_hash,
-					       g_str_equal,
-					       g_free,
-					       NULL);
-
-  radio_box = gtk_vbox_new (TRUE, 2);
-  gtk_widget_show (GTK_WIDGET (radio_box));
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      radio_box,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  radio_label = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(radio_label);
-
-  gtk_box_pack_start (GTK_BOX(radio_box),
-		      radio_label,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(radio_label),
-			 GTK_JUSTIFY_CENTER);
-
-  radio_text = g_strdup(label);
-  gtk_label_set_markup (GTK_LABEL(radio_label),
-                        (const gchar *)radio_text);
-
-  radio_key = g_strdup(key);
-  radio_init = g_strdup(init);
-
-  g_hash_table_foreach( buttons_label,
-			(GHFunc) create_radio_buttons,
-			(gpointer) buttons);
-
-  g_signal_connect (G_OBJECT(radio_box), "destroy", G_CALLBACK(destroy_hash), (gpointer) buttons);
-
-  return buttons;
-}
-
 static void
 spin_changed (GtkSpinButton *spinbutton,
-	      gpointer key)
+	      gpointer data)
 {
-  gchar *h_key = g_strdup((gchar *) key);
+  _gc_boardconf_key *u = (_gc_boardconf_key*)data;
+
+  gchar *h_key = g_strdup(u->key);
   gchar *h_value = g_strdup_printf("%d",gtk_spin_button_get_value_as_int (spinbutton));
 
-  g_hash_table_replace (hash_conf, h_key, h_value);
+  g_hash_table_replace (u->config->hash_conf, h_key, h_value);
 }
 
 GtkSpinButton *
-gc_board_config_spin_int(const gchar *label, gchar *key, gint min, gint max, gint step, gint init)
+gc_board_config_spin_int(GcomprisBoardConf *config, const gchar *label, gchar *key, gint min, gint max, gint step, gint init)
 {
+  g_return_val_if_fail(config, NULL);
   check_key( key);
 
   GtkWidget *spin;
@@ -516,7 +306,7 @@
 
   gtk_widget_show(hbox);
 
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
+  gtk_box_pack_start (GTK_BOX(config->main_conf_box),
 		      hbox,
 		      FALSE,
 		      FALSE,
@@ -552,24 +342,33 @@
   gtk_spin_button_set_digits ( GTK_SPIN_BUTTON(spin), 0);
 
   gtk_spin_button_set_value ( GTK_SPIN_BUTTON(spin), (gdouble) init);
+  
+  _gc_boardconf_key *u = g_malloc0(sizeof(_gc_boardconf_key));
+  u->key = g_strdup(key);
+  u->config = config;
 
   g_signal_connect (G_OBJECT(spin),
 		    "value-changed",
 		    G_CALLBACK(spin_changed),
-		    key);
+		    u);
+  g_signal_connect( G_OBJECT(spin),
+	  	"destroy", 
+		G_CALLBACK(_gc_destroy_boardconf_key),
+		u);
 
   return GTK_SPIN_BUTTON(spin);
 
 }
 
 GtkHSeparator *
-gc_board_conf_separator()
+gc_board_conf_separator(GcomprisBoardConf *config)
 {
+  g_return_val_if_fail(config, NULL);
   GtkWidget *separator = gtk_hseparator_new ();
 
   gtk_widget_show(separator);
 
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
+  gtk_box_pack_start (GTK_BOX(config->main_conf_box),
 		      separator,
 		      FALSE,
 		      FALSE,
@@ -579,669 +378,3 @@
 
 }
 
-/***********************************************/
-/* L10n                                        */
-/***********************************************/
-
-/** \brief return the list of locales in which GCompris has been translated
- *         even partialy.
- *
- * \note The list is calculated at the first call and must not be freed.
- *       Uppon next call, the same list is returned.
- *
- * \return a list containing the locales we suport
- */
-GList*
-gc_locale_gets_list(){
-
-  static GList *gcompris_locales_list = NULL;
-
-  GcomprisProperties *properties = gc_prop_get();
-  GDir   *textdomain_dir;
-  GError **error = NULL;
-  GList  *locales = NULL;
-
-  if(gcompris_locales_list)
-    return(gcompris_locales_list);
-
-  /* There is no english locale but it exists anyway */
-  locales = g_list_append(locales, g_strdup("en"));
-
-  textdomain_dir = g_dir_open (properties->package_locale_dir, 0, error);
-  const gchar *fname;
-  gchar *fname_abs;
-  gchar *catalog;
-
-  while ((fname = g_dir_read_name(textdomain_dir))) {
-    fname_abs = g_strdup_printf("%s/%s", properties->package_locale_dir, fname);
-    if (!g_file_test(fname_abs, G_FILE_TEST_IS_DIR))
-      continue;
-
-    catalog = g_strdup_printf("%s/LC_MESSAGES/gcompris.mo", fname_abs);
-
-    if (g_file_test(catalog, G_FILE_TEST_EXISTS)){
-      locales = g_list_append(locales, g_strdup(fname));
-    }
-    g_free (fname_abs);
-    g_free(catalog);
-  }
-
-  g_dir_close (textdomain_dir);
-
-  /* Save it for next call */
-  gcompris_locales_list = locales;
-
-  return locales;
-}
-
-
-void
-gc_board_config_combo_locales_changed(GtkComboBox *combobox,
-			       gpointer key)
-{
-  gchar *the_key = g_strdup((gchar *)key);
-  gchar *value;
-  gint index = gtk_combo_box_get_active (combobox);
-
-  if (index == 0)
-    /* Default value of gcompris selected */
-    value = g_strdup ("NULL");
-  else
-    value = _get_active_text (combobox);
-
-  g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
-}
-
-/* key = "locale" */
-GtkComboBox*
-gc_board_config_combo_locales(gchar *init)
-{
-
-  GtkWidget *combobox;
-  GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
-  GList *list, *strings;
-  GtkWidget *label_combo;
-  gint init_index = 0;
-
-  strings = gc_locale_gets_list();
-
-  strings = g_list_prepend( strings, _("Default"));
-
-  if (init)
-    init_index = g_list_position(strings,
-				 g_list_find_custom(strings,
-						    (gconstpointer) init,
-						    (GCompareFunc) my_strcmp));
-
-  if (init_index < 0)
-    init_index=0;
-
-  gtk_widget_show(hbox);
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      hbox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Label */
-  label_combo = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(label_combo);
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      label_combo,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(label_combo),
-			 GTK_JUSTIFY_RIGHT);
-
-  gtk_label_set_markup (GTK_LABEL(label_combo),
-                        _("Select the language\n to use in the board"));
-
-  combobox = gtk_combo_box_new_text();
-
-  gtk_widget_show(combobox);
-
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      combobox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-
-  for (list = strings; list != NULL; list = list->next)
-    gtk_combo_box_append_text       (GTK_COMBO_BOX(combobox),
-				     list->data);
-
-  if (g_list_length(strings) > COMBOBOX_COL_MAX)
-    gtk_combo_box_set_wrap_width    (GTK_COMBO_BOX(combobox),
-  	     g_list_length(strings) / COMBOBOX_COL_MAX +1 );
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
-			    init_index);
-
-  g_signal_connect(G_OBJECT(combobox),
-		   "changed",
-		   G_CALLBACK(gc_board_config_combo_locales_changed),
-		   "locale");
-
-  return GTK_COMBO_BOX(combobox);
-
-}
-
-void
-gc_board_config_combo_drag_changed(GtkComboBox *combobox,
-			       gpointer key)
-{
-  gchar *the_key = g_strdup((gchar *)key);
-  gchar *value;
-  gint index = gtk_combo_box_get_active (combobox);
-
-  if (index == 0)
-    /* Default value of gcompris selected */
-    value = g_strdup ("NULL");
-  else
-    value = g_strdup_printf("%d", index);
-
-  g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
-}
-
-/* key = "locale" */
-GtkComboBox*
-gc_board_config_combo_drag(gint init)
-{
-
-  GtkWidget *combobox;
-  GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
-  GList *list, *strings;
-  GtkWidget *label_combo;
-  gint init_index;
-
-  strings = NULL;
-
-  strings = g_list_prepend( strings, _("Global GCompris mode"));
-  strings = g_list_append( strings, _("Normal"));
-  strings = g_list_append( strings, _("2 clicks"));
-  strings = g_list_append( strings, _("both modes"));
-
-  if (init < 0)
-    init_index =0;
-  else
-    init_index = init;
-
-  gtk_widget_show(hbox);
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      hbox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Label */
-  label_combo = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(label_combo);
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      label_combo,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(label_combo),
-			 GTK_JUSTIFY_RIGHT);
-
-  gtk_label_set_markup (GTK_LABEL(label_combo),
-                        _("Select the drag and drop mode\n to use in the board"));
-
-  combobox = gtk_combo_box_new_text();
-
-  gtk_widget_show(combobox);
-
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      combobox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-
-  for (list = strings; list != NULL; list = list->next)
-    gtk_combo_box_append_text       (GTK_COMBO_BOX(combobox),
-				     list->data);
-
-  if (g_list_length(strings) > COMBOBOX_COL_MAX)
-    gtk_combo_box_set_wrap_width    (GTK_COMBO_BOX(combobox),
-  	     g_list_length(strings) / COMBOBOX_COL_MAX +1 );
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
-			    init_index);
-
-  g_signal_connect(G_OBJECT(combobox),
-		   "changed",
-		   G_CALLBACK(gc_board_config_combo_drag_changed),
-		   "drag_mode");
-
-  return GTK_COMBO_BOX(combobox);
-
-}
-
-static gchar *current_locale = NULL;
-void
-gc_locale_change(gchar *locale)
-{
-  if (!locale)
-    return;
-
-  if (strcmp(locale, "NULL") == 0){
-    gc_locale_reset();
-    return;
-  }
-
-  current_locale = g_strdup(gc_locale_get());
-
-  gc_locale_set(locale);
-}
-
-void
-gc_locale_reset()
-{
-  if (current_locale == NULL)
-    return;
-
-  gc_locale_change(current_locale);
-
-  g_free(current_locale);
-  current_locale = NULL;
-}
-
-
-/** \brief Search the given file for each locale and returns the locale list
- *
- * \param file: the file to search. In order to work, you need to provide a
- *              filename that includes a $LOCALE in it like:
- *              voices/$LOCALE/colors/blue.ogg
- *
- * \return a list of locale
- */
-GList*
-gc_locale_gets_asset_list(const gchar *filename)
-{
-  GList *locales, *list, *locales_asset = NULL;
-  gchar *abs_filename;
-
-  locales = gc_locale_gets_list();
-
-  for (list = locales; list != NULL; list = list->next)
-    {
-      gchar **tmp;
-
-      /* Check there is a $LOCALE to replace */
-      if((tmp = g_strsplit(filename, "$LOCALE", -1)))
-	{
-	  gchar locale[6];
-	  gchar *filename2;
-
-	  /* try with the locale */
-	  g_strlcpy(locale, list->data, sizeof(locale));
-	  filename2 = g_strjoinv(locale, tmp);
-	  g_warning("trying locale file '%s'\n", filename2);
-	  abs_filename = gc_file_find_absolute(filename2);
-	  g_free(filename2);
-
-	  g_strfreev(tmp);
-	}
-      else
-	{
-	  abs_filename = gc_file_find_absolute(filename);
-	}
-
-      if(abs_filename)
-	/* It would be cleaner to provide the real locale name but then we need a way
-	 * to get back the locale code from it's name and from the boards
-	 *
-	 * locales_asset = g_list_append(locales_asset, gc_locale_get_name(list->data));
-	 *
-	 */
-	locales_asset = g_list_append(locales_asset, list->data);
-
-    }
-
-
-  return locales_asset;
-}
-
-/* key = "locale_sound" */
-GtkComboBox *gc_board_config_combo_locales_asset(const gchar *label,
-					  gchar *init,
-					  const gchar *file)
-{
-
-  GtkWidget *combobox;
-  GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
-  GList *list, *strings;
-  GtkWidget *label_combo;
-  gint init_index = 0;
-
-  strings = gc_locale_gets_asset_list(file);
-
-  strings = g_list_prepend( strings, _("Default"));
-
-  if (init)
-    {
-      init_index =  g_list_position(strings,
-				    g_list_find_custom(strings,
-						       (gconstpointer)init,
-						       (GCompareFunc) my_strcmp));
-    }
-
-  if (init_index < 0)
-    init_index=0;
-
-  gtk_widget_show(hbox);
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      hbox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Label */
-  label_combo = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(label_combo);
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      label_combo,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(label_combo),
-			 GTK_JUSTIFY_RIGHT);
-
-  gtk_label_set_markup (GTK_LABEL(label_combo),
-                        label);
-
-  combobox = gtk_combo_box_new_text();
-
-  gtk_widget_show(combobox);
-
-  gtk_box_pack_start (GTK_BOX(hbox),
-		      combobox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-
-  for (list = strings; list != NULL; list = list->next)
-    gtk_combo_box_append_text(GTK_COMBO_BOX(combobox),
-			      list->data);
-
-  if (g_list_length(strings) > COMBOBOX_COL_MAX)
-    gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combobox),
-				 g_list_length(strings) / COMBOBOX_COL_MAX +1 );
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
-			    init_index);
-
-  g_signal_connect(G_OBJECT(combobox),
-		   "changed",
-		   G_CALLBACK(gc_board_config_combo_locales_changed),
-		   "locale_sound");
-
-  return GTK_COMBO_BOX(combobox);
-
-}
-
-/****************************************/
-/* TextView                             */
-
-typedef struct {
-  gchar *key;
-  GcomprisTextCallback callback;
-  GtkLabel *feedback;
-  GtkTextBuffer *TextBuffer;
-} user_param_type;
-
-static void *
-_textview_destroy (GtkButton *button,
-		   gpointer user_data)
-{
-  g_free(((user_param_type *)user_data)->key);
-  g_free(user_data);
-
-  return NULL;
-}
-
-
-static void *
-_textbuffer_changed (GtkTextBuffer *buffer,
-		     gpointer user_data)
-{
-  gtk_widget_set_sensitive        (GTK_WIDGET(user_data),
-				   TRUE);
-
-  return NULL;
-}
-
-static void *
-_textview_yes (GtkButton *button,
-	       gpointer user_data)
-{
-
-  user_param_type *params= (user_param_type *) user_data;
-
-  gchar *key = params->key;
-  GcomprisTextCallback validate = params->callback;
-  GtkLabel *label = params->feedback;
-  GtkTextBuffer *text_buffer = params->TextBuffer;
-
-  GtkTextIter start_iter;
-  GtkTextIter end_iter;
-
-  gtk_text_buffer_get_start_iter  (text_buffer,
-                                   &start_iter);
-
-  gtk_text_buffer_get_end_iter  (text_buffer,
-				 &end_iter);
-
-  /* has this to be freed ? */
-  gchar *text = gtk_text_buffer_get_slice (text_buffer,
-					   &start_iter,
-					   &end_iter,
-					   TRUE);
-
-
-
-  gchar *in_memoriam_text = g_strdup (text);
-  gchar *in_memoriam_key = g_strdup (key);
-
-  if (validate( key, text, label)){
-    g_hash_table_replace ( hash_conf, (gpointer) in_memoriam_key, (gpointer) in_memoriam_text);
-    gtk_widget_set_sensitive        (GTK_WIDGET(button),
-				     FALSE);
-  }
-  else {
-    g_free (in_memoriam_text);
-    g_free (in_memoriam_key);
-  }
-  g_free(text);
-
-  return NULL;
-}
-
-GtkTextView *
-gc_board_config_textview(const gchar *label,
-		  gchar *key,
-		  const gchar*description,
-		  gchar *init_text,
-		  GcomprisTextCallback validate)
-{
-  GtkWidget*frame =  gtk_frame_new ("GCompris text tool");
-  gtk_widget_show(frame);
-
-  gtk_box_pack_start (GTK_BOX(main_conf_box),
-		      frame,
-		      FALSE,
-		      FALSE,
-		      8);
-
-
-
-  /* Main vbox for all our widegt */
-  GtkWidget *textVbox = gtk_vbox_new ( FALSE, 8);
-  gtk_widget_show(textVbox);
-
-  gtk_container_add(GTK_CONTAINER(frame),
-		    textVbox);
-  /* Title */
-  GtkWidget *title = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(title);
-
-  gtk_box_pack_start (GTK_BOX(textVbox),
-		      title,
-		      FALSE,
-		      FALSE,
-		      8);
-
-  gtk_label_set_justify (GTK_LABEL(title),
-			 GTK_JUSTIFY_CENTER);
-
-  gchar *title_text = g_strdup(label);
-  gtk_label_set_markup (GTK_LABEL(title),
-                        (const gchar *)title_text);
-
-  GtkWidget *separator = gtk_hseparator_new ();
-
-  gtk_widget_show(separator);
-
-  gtk_box_pack_start (GTK_BOX(textVbox),
-		      separator,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Description */
-  GtkWidget *desc = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(desc);
-
-  gtk_box_pack_start (GTK_BOX(textVbox),
-		      desc,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  //gtk_label_set_justify (GTK_LABEL(title),
-  //		 GTK_JUSTIFY_CENTER);
-
-  gtk_label_set_line_wrap(GTK_LABEL(desc), TRUE);
-
-  gchar *desc_text = g_strdup(description);
-  gtk_label_set_markup (GTK_LABEL(desc),
-                        (const gchar *)desc_text);
-
-  GtkWidget *scroll = gtk_scrolled_window_new ( NULL, NULL);
-
-
-  gtk_scrolled_window_set_policy  (GTK_SCROLLED_WINDOW(scroll),
-				   GTK_POLICY_AUTOMATIC,
-				   GTK_POLICY_AUTOMATIC);
-
-  gtk_widget_set_size_request     (scroll,
-				   -1,
-				   100);
-
-  gtk_widget_show( scroll);
-
-  gtk_box_pack_start (GTK_BOX(textVbox),
-		      scroll,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* TextView */
-  GtkWidget *textView = gtk_text_view_new ();
-  gtk_widget_show(textView);
-
-  gtk_container_add (GTK_CONTAINER(scroll),
-		     textView);
-
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textView), GTK_WRAP_WORD_CHAR);
-
-
-  GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textView));
-
-  gtk_text_buffer_set_text (buffer, g_strdup(init_text), -1);
-
-
-  /* hbox for feedback and validation button */
-  GtkWidget *validationHbox = gtk_vbox_new ( FALSE, 8);
-  gtk_widget_show(validationHbox);
-
-  gtk_box_pack_start (GTK_BOX(textVbox),
-		      validationHbox,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  /* Feedback */
-  GtkWidget *feedback = gtk_label_new ((gchar *)NULL);
-  gtk_widget_show(feedback);
-
-  gtk_box_pack_start (GTK_BOX(validationHbox),
-		      feedback,
-		      FALSE,
-		      FALSE,
-		      0);
-
-  gtk_label_set_justify (GTK_LABEL(title),
-			 GTK_JUSTIFY_FILL);
-
-  gtk_label_set_line_wrap(GTK_LABEL(feedback), TRUE);
-
-  user_param_type *user_param = g_malloc0(sizeof(user_param_type));
-
-  user_param->key = g_strdup(key);
-  user_param->callback = validate;
-  user_param->feedback = GTK_LABEL(feedback);
-  user_param->TextBuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(textView));
-
-
-  /* vbox for feedback and validation button */
-  GtkWidget *validationVbox = gtk_hbox_new ( FALSE, 8);
-  gtk_widget_show(validationVbox);
-
-  gtk_box_pack_end (GTK_BOX(validationHbox),
-		    validationVbox,
-		    FALSE,
-		    FALSE,
-		    0);
-
-
-  /* Validate button */
-  GtkWidget *button =  gtk_button_new_from_stock (GTK_STOCK_YES);
-  gtk_widget_show(button);
-  gtk_box_pack_end (GTK_BOX(validationVbox),
-		    button,
-		    FALSE,
-		    FALSE,
-		    0);
-
-  g_signal_connect(G_OBJECT(button),
-		   "clicked",
-		   G_CALLBACK(_textview_yes),
-		   (gpointer) user_param);
-
-
-  g_signal_connect(G_OBJECT(button),
-		   "destroy",
-		   G_CALLBACK(_textview_destroy),
-		   (gpointer) user_param);
-
-  g_signal_connect(G_OBJECT(user_param->TextBuffer),
-		   "changed",
-		   G_CALLBACK(_textbuffer_changed),
-		   (gpointer) button);
-
-  gtk_widget_set_sensitive (button,
-			    FALSE);
-
-  return GTK_TEXT_VIEW(textView);
-}

Modified: branches/GCOMPRIS_8_3/src/gcompris/board_config.h
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/board_config.h	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/board_config.h	Sat Jan 31 13:25:59 2009
@@ -1,7 +1,5 @@
 /* gcompris - board_config.h
  *
- * Time-stamp: <2006/08/29 01:12:58 bruno>
- *
  * Copyright (C) 2001 Pascal Georges
  *
  * This program is free software; you can redistribute it and/or modify
@@ -21,6 +19,18 @@
 
 #ifndef BOARD_CONFIG_H
 #define BOARD_CONFIG_H
+#include "gcompris.h"
+
+/* the callback type */
+typedef void (*GcomprisConfCallback) (GHashTable *table);
+
+typedef struct
+{
+	GtkWindow *conf_window;
+	GtkVBox *main_conf_box;
+	GHashTable *hash_conf;
+	GcomprisConfCallback Confcallback;
+} GcomprisBoardConf;
 
 void	 gc_board_config_start(GcomprisBoard *aBoard,
 			       GcomprisProfile *aProfile);
@@ -32,14 +42,11 @@
 /* You can add your own widget if you need */
 /* the callback is called wish the hash key, value when the apply button is clicked */
 
-/* the callback type */
-typedef void (*GcomprisConfCallback) (GHashTable *table);
-
-GtkVBox *gc_board_config_window_display(gchar *label, GcomprisConfCallback callback);
+GcomprisBoardConf *gc_board_config_window_display(gchar *label, GcomprisConfCallback callback);
 
-GtkCheckButton *gc_board_config_boolean_box(const gchar *label, gchar *key, gboolean initial_value);
+GtkCheckButton *gc_board_config_boolean_box(GcomprisBoardConf *config, const gchar *label, gchar *key, gboolean initial_value);
 
-GtkComboBox *gc_board_config_combo_box(const gchar *label, GList *strings, gchar *key, gchar *init);
+GtkComboBox *gc_board_config_combo_box(GcomprisBoardConf *config, const gchar *label, GList *strings, gchar *key, gchar *init);
 
 /* Params: */
 /*   - Label */
@@ -48,25 +55,26 @@
 /* Returns */
 /*   - g_hash_table (gchar *values, GtkWidget *pointer) */
 
-GHashTable *gc_board_config_radio_buttons(const gchar *label,
+GHashTable *gc_board_config_radio_buttons(GcomprisBoardConf *config, const gchar *label,
 				   gchar *key,
 				   GHashTable *buttons_label,
 				   gchar *init);
 
-GtkSpinButton *gc_board_config_spin_int(const gchar *label, 
-				 gchar *key, 
-				 gint min, 
-				 gint max, 
-				 gint step, 
-				 gint init);
+GtkSpinButton *gc_board_config_spin_int(GcomprisBoardConf *config,
+					const gchar *label,
+					gchar *key,
+					gint min,
+					gint max,
+					gint step,
+					gint init);
 
-GtkHSeparator *gc_board_conf_separator();
+GtkHSeparator *gc_board_conf_separator(GcomprisBoardConf *config);
 
 GList *gc_locale_gets_list();
 
-GtkComboBox *gc_board_config_combo_locales( gchar *init);
+GtkComboBox *gc_board_config_combo_locales(GcomprisBoardConf *config, gchar *init);
 
-GtkComboBox *gc_board_config_combo_drag( gint init);
+GtkComboBox *gc_board_config_combo_drag( GcomprisBoardConf *config, gint init);
 
 void gc_locale_change(gchar *locale);
 
@@ -74,10 +82,8 @@
 
 GList *gc_locale_gets_asset_list(const gchar *file);
 
-GtkComboBox *gc_board_config_combo_locales_asset(const gchar *label, gchar *init,
-					  const gchar *file);
-#endif
-
+GtkComboBox *gc_board_config_combo_locales_asset(GcomprisBoardConf *config,
+	const gchar *label, gchar *init, const gchar *file);
 /***********************************/
 /* TextView  facility              */
 /* Callback is text vaidating function */
@@ -86,8 +92,14 @@
 
 typedef gboolean (*GcomprisTextCallback) (gchar *key, gchar *text, GtkLabel *label);
 
-GtkTextView *gc_board_config_textview(const gchar *label, 
-			       gchar *key,
-			       const gchar*description, 
-			       gchar *init_text, 
-			       GcomprisTextCallback validate);
+GtkTextView *gc_board_config_textview(GcomprisBoardConf *config,
+				      const gchar *label,
+				      gchar *key,
+				      const gchar*description,
+				      gchar *init_text,
+				      GcomprisTextCallback validate);
+
+GtkWidget *gc_board_config_wordlist(GcomprisBoardConf *config, const gchar *files);
+
+#endif
+

Modified: branches/GCOMPRIS_8_3/src/gcompris/timer.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/timer.c	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/timer.c	Sat Jan 31 13:25:59 2009
@@ -47,6 +47,8 @@
   GdkFont *gdk_font;
   GdkPixbuf *pixmap = NULL;
   GcomprisProperties *properties = gc_prop_get();
+  char *image_prefix;
+
 
   /* Timer is not requested */
   if(properties->timer==0)
@@ -77,18 +79,28 @@
     {
     case GCOMPRIS_TIMER_SAND:
     case GCOMPRIS_TIMER_CLOCK:
+    case GCOMPRIS_TIMER_TUX:
       {
 	gchar		*filefull = NULL;
 	gchar		*filename = NULL;
 	gint		fileid;
 	
+	switch(type)
+	  {
+	  case GCOMPRIS_TIMER_SAND:
+	    image_prefix = "gcompris/timers/sablier%d.png";
+	  case GCOMPRIS_TIMER_CLOCK:
+	    image_prefix = "gcompris/timers/clock%d.png";
+	  case GCOMPRIS_TIMER_TUX:
+	    image_prefix = "gcompris/timers/tux%d.png";
+	  default:
+	    break;
+	  }
+
 	fileid = (gint)timer;
-	if(type==GCOMPRIS_TIMER_SAND)
-	  filename = g_strdup_printf("gcompris/timers/sablier%d.png", fileid);
-	else
-	  filename = g_strdup_printf("gcompris/timers/clock%d.png", fileid);
-	
+	filename = g_strdup_printf(image_prefix, fileid);
 	filefull = g_strdup_printf("%s/%s", properties->package_data_dir, filename);
+	
 	if (g_file_test ((filefull), G_FILE_TEST_EXISTS))
 	  {
 	    pixmap = gc_pixmap_load(filename);
@@ -222,6 +234,7 @@
     {
     case GCOMPRIS_TIMER_SAND:
     case GCOMPRIS_TIMER_CLOCK:
+    case GCOMPRIS_TIMER_TUX:
       /* No subanimation */
       break;
     case GCOMPRIS_TIMER_TEXT:

Modified: branches/GCOMPRIS_8_3/src/gcompris/timer.h
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/timer.h	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/timer.h	Sat Jan 31 13:25:59 2009
@@ -33,6 +33,7 @@
   GCOMPRIS_TIMER_SAND,
   GCOMPRIS_TIMER_BALLOON,
   GCOMPRIS_TIMER_CLOCK,
+  GCOMPRIS_TIMER_TUX,
 } TimerList;
 
 /* Callback when the timer is completed */

Modified: branches/GCOMPRIS_8_3/src/gcompris/wordlist.c
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/wordlist.c	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/wordlist.c	Sat Jan 31 13:25:59 2009
@@ -23,6 +23,8 @@
 
 #include "gcompris.h"
 
+void gc_wordlist_dump(GcomprisWordlist *wl);
+
 /** Load a wordlist formatted xml file. It contains a list of words.
  *
  * The xml file format must be like this:
@@ -63,13 +65,11 @@
   xmlNodePtr wlNode;
   xmlNodePtr node;
   xmlNodePtr wordsNode;
-  int i;
-  guint number_of_level = 0;
+  guint level;
 
   GcomprisWordlist     *wordlist;
   xmlChar              *text;
 
-  gchar               **wordsArray;
   GSList                *words = NULL;
 
   if (!format)
@@ -85,19 +85,21 @@
   if(!xmlfilename)
     {
       g_warning("Couldn't find file %s !", filename);
-      g_free(xmlfilename);
+      g_free(filename);
       return NULL;
     }
 
   g_warning("Wordlist found %s\n", xmlfilename);
 
   xmldoc = xmlParseFile(xmlfilename);
-  g_free(xmlfilename);
 
   if(!xmldoc){
     g_warning("Couldn't parse file %s !", xmlfilename);
+    g_free(filename);
+    g_free(xmlfilename);
     return NULL;
   }
+  g_free(xmlfilename);
 
   if(/* if there is no root element */
      !xmldoc->children ||
@@ -107,6 +109,7 @@
      g_strcasecmp((gchar *)xmldoc->children->name,(gchar *)"GCompris")!=0) {
     g_warning("No Gcompris node");
     xmlFreeDoc(xmldoc);
+    g_free(filename);
     return NULL;
   }
 
@@ -119,6 +122,7 @@
      g_strcasecmp((gchar *)wlNode->name,"Wordlist")!=0) {
     g_warning("No wordlist node %s", (wlNode == NULL) ? (gchar *)wlNode->name : "NULL node");
     xmlFreeDoc(xmldoc);
+    g_free(filename);
     return NULL;
   }
 
@@ -175,48 +179,60 @@
       break;
     }
 
-    text = xmlNodeGetContent ( wordsNode);
-
-    wordsArray = g_strsplit_set ((const gchar *) text,
-				 (const gchar *) " \n\t",
-				 0);
-
-    g_warning("Wordlist read : %s", text);
-
-    xmlFree (text);
-
-    i=0;
-    while (wordsArray[i] != NULL) {
-      if (wordsArray[i][0]!='\0')
-	words = g_slist_append( words, g_strdup( wordsArray[i]));
-      i++;
+    level=-1;
+    text = xmlGetProp ( node,
+		    (const xmlChar *) "value");
+    if (text) {
+	    level = atoi((gchar *) text);
+	    xmlFree (text);
     }
+    text = xmlNodeGetContent ( wordsNode);
+    gc_wordlist_set_wordlist(wordlist, level, (const gchar*)text);
+    xmlFree(text);
 
-    g_strfreev ( wordsArray);
-
-
-    /* initialise LevelWordlist struct */
-    LevelWordlist *level_words = g_malloc0(sizeof(LevelWordlist));
+    node = node->next;
+  }
+  xmlFreeDoc(xmldoc);
+  return wordlist;
+}
 
-    number_of_level++;
+void gc_wordlist_dump(GcomprisWordlist *wl)
+{
+	GSList *level, *words;
 
-    text = xmlGetProp ( node,
-			(const xmlChar *) "value");
-    if (text) {
-      level_words->level = atoi((gchar *) text);
-      xmlFree (text);
-    }
+	printf("Wordlist dump\n");
+	printf("filename:%s\n",wl->filename);
+	printf("number of level:%d\n",wl->number_of_level);
 
-    level_words->words = words;
+	for(level = wl->levels_words; level; level = level->next)
+	{
+		printf("Level %d\n", ((LevelWordlist*)level->data)->level);
+		printf("Words :");
+		for(words=((LevelWordlist*)level->data)->words; words; words=words->next)
+		{
+			printf(" %s", (char*)words->data);
+		}
+		puts("");
+	}
+}
 
-    wordlist->levels_words = g_slist_append( wordlist->levels_words, level_words);
+LevelWordlist*gc_wordlist_get_levelwordlist(GcomprisWordlist *wordlist, guint level)
+{
+	GSList *lev_list, *list;
+	LevelWordlist *lw;
 
-    node = node->next;
-  }
+	if(!wordlist)
+		return NULL;
 
-  wordlist->number_of_level = number_of_level;
+	lev_list = wordlist->levels_words;
 
-  return wordlist;
+	for (list = lev_list; list != NULL; list = list->next)
+	{
+		lw = list->data;
+		if(lw->level == level)
+			return lw;
+	}
+	return NULL;
 }
 
 /** get a random word from the wordlist in the given level
@@ -229,36 +245,37 @@
 gchar *
 gc_wordlist_random_word_get(GcomprisWordlist *wordlist, guint level)
 {
-  GSList *lev_list, *list;
+	LevelWordlist *lw;
+	gchar *word;
 
-  if(!wordlist)
-    return NULL;
-
-  lev_list = wordlist->levels_words;
-
-  /* cap to the number_of_level */
-  if(level > wordlist->number_of_level)
-    level = wordlist->number_of_level;
+	if(level>wordlist->number_of_level)
+		level = wordlist->number_of_level;
 
-  for (list = lev_list; list != NULL; list = list->next)
-    {
-      LevelWordlist *lw = list->data;
+	lw = gc_wordlist_get_levelwordlist(wordlist, level);
+	if(!lw)
+		return NULL;
+
+	g_warning("Level : %d", lw->level);
+
+	/* We got the proper level, find a random word */
+	word = (gchar *)g_slist_nth_data(lw->words,
+			RAND(0, g_slist_length(lw->words))
+			);
+	g_warning("returning random word '%s'", word);
+	return(g_strdup(word));
+}
 
-      if(lw->level == level)
-	{
-	  gchar *word;
-	  g_warning("Level : %d", lw->level);
+static void gc_wordlist_free_level(LevelWordlist *lw)
+{
+	GSList *words;
 
-	  /* We got the proper level, find a random word */
-	  word = (gchar *)g_slist_nth_data(lw->words,
-					  RAND(0, g_slist_length(lw->words)-1)
-					  );
-	  g_warning("returning random word '%s'", word);
-	  return(g_strdup(word));
-	}
-    }
+	if(!lw)
+		return;
 
-  return NULL;
+	for (words = lw->words; words !=NULL; words = words->next)
+		g_free(words->data);
+	g_slist_free(lw->words);
+	g_free(lw);
 }
 
 /** call it to free a GcomprisWordlist as returned by gc_wordlist_get_from_file
@@ -269,7 +286,7 @@
 void
 gc_wordlist_free(GcomprisWordlist *wordlist)
 {
-  GSList *list, *words;
+  GSList *list;
 
   if(!wordlist)
     return;
@@ -281,11 +298,103 @@
 
   for ( list = wordlist->levels_words; list !=NULL; list=list->next){
     LevelWordlist *lw = (LevelWordlist *)list->data;
-    for ( words = lw->words; words !=NULL; words = words->next)
-      g_free(words->data);
-    g_slist_free(lw->words);
-    g_free(lw);
+    gc_wordlist_free_level(lw);
   }
   g_slist_free ( wordlist->levels_words);
   g_free (wordlist);
 }
+
+void gc_wordlist_set_wordlist(GcomprisWordlist *wordlist, guint level, const gchar*text)
+{
+	LevelWordlist *lw;
+	GSList *words=NULL;
+	gchar **wordsArray;
+	int i;
+	
+	g_warning("wordlist : add level=%d text=%s\n", level, text);
+	/* remove level */
+	if((lw = gc_wordlist_get_levelwordlist(wordlist, level)))
+	{
+		g_warning("remove level %d", lw->level);
+		wordlist->levels_words = g_slist_remove(wordlist->levels_words, lw);
+		gc_wordlist_free_level(lw);
+		wordlist->number_of_level--;
+	}
+
+	/* add new level */
+	wordsArray = g_strsplit_set (text, " \n\t", 0);
+
+	i=0;
+	for(i=0;wordsArray[i] != NULL; i++)
+		if (wordsArray[i][0]!='\0' &&
+			!g_slist_find_custom(words, wordsArray[i], (GCompareFunc)strcmp))
+				words = g_slist_append( words, g_strdup(wordsArray[i]));
+
+	g_strfreev ( wordsArray);
+
+	if(words==NULL)
+		return;
+
+	/* initialise LevelWordlist struct */
+	LevelWordlist *level_words = g_malloc0(sizeof(LevelWordlist));
+
+	level_words->words = words;
+	level_words->level = level;
+
+	wordlist->number_of_level++;
+	wordlist->levels_words = g_slist_append( wordlist->levels_words, level_words);
+}
+
+void gc_wordlist_save(GcomprisWordlist *wordlist)
+{
+	GSList *listlevel,*listword;
+	LevelWordlist *level;
+	gchar *filename, *tmp;
+	xmlNodePtr wlnode, levelnode, node;
+	xmlDocPtr doc;
+
+	if(!wordlist)
+		return;
+	doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
+	if(!doc)
+		return;
+
+	node = xmlNewNode(NULL, BAD_CAST "GCompris");
+	xmlDocSetRootElement(doc,node);
+	wlnode = xmlNewChild(node, NULL, BAD_CAST "Wordlist", NULL);
+
+	if(wordlist->name)
+		xmlSetProp(wlnode, BAD_CAST "name", BAD_CAST wordlist->name);
+	if(wordlist->description)
+		xmlSetProp(wlnode, BAD_CAST "description", BAD_CAST wordlist->description);
+	if(wordlist->locale)
+		xmlSetProp(wlnode, BAD_CAST "locale", BAD_CAST wordlist->locale);
+	for(listlevel = wordlist->levels_words; listlevel; listlevel = listlevel->next)
+	{
+		level = (LevelWordlist*)listlevel->data;
+		levelnode = xmlNewChild(wlnode, NULL, BAD_CAST "level", NULL);
+		if((tmp = g_strdup_printf("%d", level->level)))
+		{
+			xmlSetProp(levelnode, BAD_CAST "value", BAD_CAST tmp);
+			g_free(tmp);
+		}
+		for(listword = level->words; listword; listword=listword->next)
+		{
+			xmlNodeAddContent(levelnode, BAD_CAST listword->data);
+			xmlNodeAddContent(levelnode, BAD_CAST " ");
+		}
+	}
+
+	filename = gc_file_find_absolute(wordlist->filename);
+	if(filename)
+	{
+		if(xmlSaveFormatFileEnc(filename, doc, NULL, 1)<0)
+		{
+			g_warning("Fail to write %s", filename);
+			g_free(filename);
+		}
+		g_free(filename);
+	}
+	xmlFreeDoc(doc);
+}
+

Modified: branches/GCOMPRIS_8_3/src/gcompris/wordlist.h
==============================================================================
--- branches/GCOMPRIS_8_3/src/gcompris/wordlist.h	(original)
+++ branches/GCOMPRIS_8_3/src/gcompris/wordlist.h	Sat Jan 31 13:25:59 2009
@@ -36,7 +36,9 @@
 } GcomprisWordlist;
 
 GcomprisWordlist *gc_wordlist_get_from_file(const gchar *fileformat, ...);
+LevelWordlist	 *gc_wordlist_get_levelwordlist(GcomprisWordlist *wordlist, guint level);
 void              gc_wordlist_free(GcomprisWordlist *wordlist);
 gchar		 *gc_wordlist_random_word_get(GcomprisWordlist *wordlist, guint level);
-
+void		  gc_wordlist_set_wordlist(GcomprisWordlist *wordlist, guint level, const gchar*words);
+void 		  gc_wordlist_save(GcomprisWordlist *wordlist);
 #endif



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