[gcompris] core: major rework of the locale change API.



commit 99fe7d3ba0f19f760976581e5bc3aa1a0c7bd2a0
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Aug 28 23:27:32 2011 +0200

    core: major rework of the locale change API.
    
    The methods gc_locale_reset() gc_locale_change() have been removed.
    Now we can use gc_locale_set() to do the same thing.
    
    Changed the combo locale system to display the language in their textual
    form instead of their locale code. Maintain them sorted to make it even
    easier to use.
    
    Now in click_on_letter configuration, changing the locale in the combo
    changes the edition part.

 src/babymatch-activity/shapegame.c             |    4 +-
 src/boards/py-mod-gcompris.c                   |   44 +--------
 src/click_on_letter-activity/click_on_letter.c |  121 +++++++++++++-----------
 src/gcompris/board_config.h                    |    7 +-
 src/gcompris/board_config_combo.c              |   39 ++------
 src/gcompris/board_config_common.h             |    2 +-
 src/gcompris/gcompris.c                        |   13 ++-
 src/gcompris/gcompris.h                        |    2 +-
 src/gletters-activity/gletters.c               |    4 +-
 src/imageid-activity/imageid.c                 |    4 +-
 src/missing_letter-activity/missingletter.c    |    4 +-
 src/pythontest-activity/pythontest.py          |    8 +-
 src/readingh-activity/reading.c                |    4 +-
 src/smallnumbers-activity/smallnumbers.c       |    5 +-
 src/wordsgame-activity/wordsgame.c             |    4 +-
 15 files changed, 109 insertions(+), 156 deletions(-)
---
diff --git a/src/babymatch-activity/shapegame.c b/src/babymatch-activity/shapegame.c
index 5553a2c..045c2f1 100644
--- a/src/babymatch-activity/shapegame.c
+++ b/src/babymatch-activity/shapegame.c
@@ -225,7 +225,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
   GHashTable *config = gc_db_get_board_conf();
 
   if (strcmp(agcomprisBoard->name, "imagename")==0){
-    gc_locale_change(g_hash_table_lookup( config, "locale"));
+    gc_locale_set(g_hash_table_lookup( config, "locale"));
   }
 
   gchar *drag_mode_str = g_hash_table_lookup( config, "drag_mode");
@@ -322,7 +322,7 @@ end_board ()
     }
 
   if (strcmp(gcomprisBoard->name, "imagename")==0){
-    gc_locale_reset();
+    gc_locale_set( NULL );
   }
 
   if (selector_item)
diff --git a/src/boards/py-mod-gcompris.c b/src/boards/py-mod-gcompris.c
index 071fa34..bb8a80b 100644
--- a/src/boards/py-mod-gcompris.c
+++ b/src/boards/py-mod-gcompris.c
@@ -378,7 +378,7 @@ py_gc_locale_get_name(PyObject* self, PyObject* args)
     return NULL;
 
   /* Call the corresponding C function */
-  gchar *result = gc_locale_get_name(locale);
+  const gchar *result = gc_locale_get_name(locale);
 
   /* Create and return the result */
   return Py_BuildValue("s", result);
@@ -1410,7 +1410,9 @@ py_gc_board_config_combo_locales_asset(PyObject* self, PyObject* args)
     return NULL;
   bconf = (pyGcomprisBoardConfigObject*)py_bconf;
   return (PyObject *)pygobject_new((GObject*) \
-				   gc_board_config_combo_locales_asset(bconf->cdata, label, init, file ));
+				   gc_board_config_combo_locales_asset(bconf->cdata,
+								       label, init, file,
+								       NULL));
 }
 
 
@@ -1455,42 +1457,6 @@ py_gcompris_gettext(PyObject* self, PyObject* args)
 
 
 
-/* void gc_locale_change(gchar *locale); */
-static PyObject*
-py_gc_locale_change(PyObject* self, PyObject* args)
-{
-  gchar *locale;
-
-  /* Parse arguments */
-  if(!PyArg_ParseTuple(args, "s:gc_locale_change", &locale))
-    return NULL;
-
-  /* Call the corresponding C function */
-  gc_locale_set(locale);
-
-  /* Create and return the result */
-  Py_INCREF(Py_None);
-  return Py_None;
-}
-
-
-/* void gc_locale_reset(gchar *locale); */
-static PyObject*
-py_gc_locale_reset(PyObject* self, PyObject* args)
-{
-  /* Parse arguments */
-  if(!PyArg_ParseTuple(args, ":gc_locale_reset"))
-    return NULL;
-
-  /* Call the corresponding C function */
-  gc_locale_reset();
-
-  /* Create and return the result */
-  Py_INCREF(Py_None);
-  return Py_None;
-}
-
-
 /* How can i free that ? */
 static GHashTable *text_callbacks = NULL;
 
@@ -1683,8 +1649,6 @@ static PyMethodDef PythonGcomprisModule[] = {
   { "combo_locales",  py_gc_board_config_combo_locales, METH_VARARGS, "gc_board_config_combo_locales" },
   { "get_locales_list",  py_gc_locale_gets_list, METH_VARARGS, "gc_locale_gets_list" },
   { "gcompris_gettext",  py_gcompris_gettext, METH_VARARGS, "gcompris_gettext" },
-  { "change_locale",  py_gc_locale_change, METH_VARARGS, "gc_locale_change" },
-  { "reset_locale",  py_gc_locale_reset, METH_VARARGS, "gc_locale_reset" },
   { "combo_locales_asset",  py_gc_board_config_combo_locales_asset, METH_VARARGS, "gc_board_config_combo_locales_asset" },
   { "get_locales_asset_list",  py_gc_locale_gets_asset_list, METH_VARARGS, "gc_locale_gets_asset_list" },
   { "textview",  py_gc_board_config_textview, METH_VARARGS, "gc_board_config_textview" },
diff --git a/src/click_on_letter-activity/click_on_letter.c b/src/click_on_letter-activity/click_on_letter.c
index dcfb763..3aa36e6 100644
--- a/src/click_on_letter-activity/click_on_letter.c
+++ b/src/click_on_letter-activity/click_on_letter.c
@@ -170,7 +170,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 
   board_paused = TRUE;
 
-  gc_locale_change(g_hash_table_lookup( config, "locale_sound"));
+  gc_locale_set(g_hash_table_lookup( config, "locale_sound"));
 
   gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
 
@@ -283,7 +283,7 @@ static void end_board ()
       g_object_unref(cloud_svg_handle);
       clear_levels();
     }
-  gc_locale_reset();
+  gc_locale_set( NULL );
   gcomprisBoard = NULL;
   gc_sound_bg_resume();
 }
@@ -362,6 +362,15 @@ static void repeat ()
     }
 }
 
+static gchar *
+get_alphabet()
+{
+  gchar *alphabet = gettext( _("abcdefghijklmnopqrstuvwxyz") );
+  /* TRANSLATORS: Put here the alphabet in your language */
+  g_assert(g_utf8_validate(alphabet, -1, NULL)); // require by all utf8-functions
+  return alphabet;
+}
+
 static guint sounds_are_fine()
 {
   char *letter_str;
@@ -372,16 +381,16 @@ static guint sounds_are_fine()
 
   if(!properties->fx)
     {
-      gchar *msg = g_strconcat( _("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialog to\nenable the sound"),
+      gchar *msg = g_strconcat( _("Error: this activity cannot be played with the\n"
+				  "sound effects disabled.\nGo to the configuration"
+				  " dialog to\nenable the sound"),
 			       "\n", text_mode_str, NULL);
       gc_dialog(msg, click_on_letter_next_level);
       g_free(msg);
       return(OK_NO_INIT);
     }
 
-  /* TRANSLATORS: Put here the alphabet in your language */
-  alphabet=_("abcdefghijklmnopqrstuvwxyz");
-  g_assert(g_utf8_validate(alphabet, -1, NULL)); // require by all utf8-functions
+  alphabet = get_alphabet();
 
   gchar *letter = g_new0(gchar, 8);
   g_unichar_to_utf8(g_utf8_get_char(alphabet), letter);
@@ -389,52 +398,17 @@ static guint sounds_are_fine()
   g_free(letter);
 
   str2 = gc_file_find_absolute("voices/$LOCALE/alphabet/%s", letter_str);
+  g_free(letter_str);
 
   if (!str2)
     {
-      gchar *locale;
-      gchar **localsearch;
-      localsearch = g_strsplit_set(gc_locale_get(), "_", 2);
-      if(g_strv_length(localsearch) <= 1)
-	return NOT_OK; /* Should not happens */
-      locale = g_strdup(localsearch[0]);
-      g_strfreev(localsearch);
-
-      gc_locale_reset();
-      gc_locale_set(GC_DEFAULT_LOCALE);
-
-      str2 = gc_file_find_absolute("voices/$LOCALE/alphabet/%s", letter_str);
-
-      if (!str2)
-	{
-	  gchar *msg2 = g_strdup_printf( _("Error: this activity requires that you first install\nthe packages with GCompris voices for the locale '%s' or '%s'"),
-					locale, "en");
-	  gchar *msg = g_strconcat(msg2, "\n", text_mode_str, NULL);
-	  g_free(msg2);
-	  gc_dialog(msg, click_on_letter_next_level);
-	  g_free(msg);
-	  g_free(locale);
-	  g_free(letter_str);
-	  return (OK_NO_INIT);
-	}
-      else
-	{
-	  gchar *msg2 = g_strdup_printf( _("Error: this activity requires that you first install\nthe packages with GCompris voices for the locale '%s' ! Fallback to english, sorry!"),
-					locale);
-	  gchar *msg = g_strconcat(msg2, "\n", text_mode_str, NULL);
-	  g_free(msg2);
-	  gc_dialog(msg, click_on_letter_next_level);
-	  g_free(msg);
-	  g_free(str2);
-	  g_free(locale);
-	  g_free(letter_str);
-	  return(OK_NO_INIT);
-	}
-    }
-  else
-    {
-      g_free(str2);
-      g_free(letter_str);
+      gchar *msg2 = g_strdup_printf( _("Error: this activity requires that you first install\nthe packages with GCompris voices for the %s locale."),
+				     gc_locale_get_name( gc_locale_get() ) );
+      gchar *msg = g_strconcat(msg2, "\n", text_mode_str, NULL);
+      g_free(msg2);
+      gc_dialog(msg, click_on_letter_next_level);
+      g_free(msg);
+      return (OK_NO_INIT);
     }
 
   return(OK);
@@ -705,6 +679,7 @@ static void highlight_selected(GooCanvasItem * item) {
 
 static void load_desktop_datafile(gchar *filename)
 {
+  printf("load_desktop_datafile %s\n", filename);
   GKeyFile *keyfile = g_key_file_new ();
   GError *error = NULL;
   if ( ! g_key_file_load_from_file (keyfile,
@@ -777,9 +752,14 @@ static void load_datafile() {
 
   clear_levels();
 
+  // Reset the alphabet to match the current locale
+  alphabet = get_alphabet();
+  printf("alphabet=%s\n", alphabet);
+
   /* create level array */
   levels = g_array_sized_new (FALSE, FALSE, sizeof (Level), 10);
 
+  printf("load_datafile %s\n", filename);
   if ( filename )
     {
       load_desktop_datafile(filename);
@@ -929,23 +909,23 @@ valid_entry(Level *level)
       goto error;
     }
 
-  if ( strlen(level->answers) == 0 )
+  /* Now check all chars in questions are in answers */
+  guint n_answers = g_utf8_strlen (level->answers, -1);
+  guint n_questions = g_utf8_strlen (level->questions, -1);
+
+  if ( n_answers == 0 )
     {
       error = g_strdup( _("Answers cannot be empty.") );
       goto error;
     }
 
-  if ( strlen(level->answers) > MAX_N_ANSWER )
+  if ( n_answers > MAX_N_ANSWER )
     {
       error = g_strdup_printf( _("Too many characters in the Answer (maximum is %d)."),
 				 MAX_N_ANSWER );
       goto error;
     }
 
-  /* Now check all chars in questions are in answers */
-  guint n_answers = g_utf8_strlen (level->answers, -1);
-  guint n_questions = g_utf8_strlen (level->questions, -1);
-
   /* The shuffle is not important, we are using it to get an array of chars */
   gchar **answers = shuffle_utf8(level->answers);
   gchar **questions = shuffle_utf8(level->questions);
@@ -1063,6 +1043,7 @@ conf_ok(GHashTable *table)
       return FALSE;
 
 
+    printf("conf_ok =%s\n", (char*)g_hash_table_lookup(config, "locale_sound"));
     gc_locale_set(g_hash_table_lookup(config, "locale_sound"));
 
     gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
@@ -1306,6 +1287,31 @@ static void configure_colummns(GtkTreeView *treeview)
 
 
 static void
+locale_changed (GtkComboBox *combobox, gpointer data)
+{
+  const gchar *locale;
+  GtkTreeIter iter;
+  gchar *text = NULL;
+
+  if (gtk_combo_box_get_active_iter (combobox, &iter))
+    gtk_tree_model_get (gtk_combo_box_get_model (combobox), &iter,
+			0, &text, -1);
+
+  // Get back the locale from the locale name (French becomes fr_FR.UTF8)
+  locale = gc_locale_get_locale( text );
+  printf("LOCALE = %s\n", locale);
+
+  gc_locale_set(locale);
+
+  load_datafile();
+  load_model_from_levels(model);
+
+  // Our job is done, set back the default locale
+  gc_locale_set( NULL );
+}
+
+
+static void
 config_start(GcomprisBoard *agcomprisBoard,
 	     GcomprisProfile *aProfile)
 {
@@ -1315,6 +1321,8 @@ config_start(GcomprisBoard *agcomprisBoard,
   if (gcomprisBoard)
     pause_board(TRUE);
 
+  gc_locale_set( NULL );
+
   gchar *label = g_strdup_printf(_("<b>%1$s</b> configuration\n for profile <b>%2$s</b>"),
 				 agcomprisBoard->name,
 				 aProfile ? aProfile->name : "");
@@ -1329,7 +1337,8 @@ config_start(GcomprisBoard *agcomprisBoard,
   gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound");
 
   gc_board_config_combo_locales_asset(bconf, "Select sound locale", saved_locale_sound,
-				"voices/$LOCALE/colors/purple.ogg");
+				      "voices/$LOCALE/colors/purple.ogg",
+				      G_CALLBACK (locale_changed));
 
   gboolean up_init = FALSE;
 
diff --git a/src/gcompris/board_config.h b/src/gcompris/board_config.h
index 14267c8..57a374d 100644
--- a/src/gcompris/board_config.h
+++ b/src/gcompris/board_config.h
@@ -78,14 +78,11 @@ GtkComboBox *gc_board_config_combo_locales(GcomprisBoardConf *config, gchar *ini
 
 GtkComboBox *gc_board_config_combo_drag( GcomprisBoardConf *config, gint init);
 
-void gc_locale_change(gchar *locale);
-
-void gc_locale_reset();
-
 GList *gc_locale_gets_asset_list(const gchar *file);
 
 GtkComboBox *gc_board_config_combo_locales_asset(GcomprisBoardConf *config,
-	const gchar *label, gchar *init, const gchar *file);
+						 const gchar *label, gchar *init,
+						 const gchar *file, GCallback callback);
 /***********************************/
 /* TextView  facility              */
 /* Callback is text vaidating function */
diff --git a/src/gcompris/board_config_combo.c b/src/gcompris/board_config_combo.c
index c84a739..b72117b 100644
--- a/src/gcompris/board_config_combo.c
+++ b/src/gcompris/board_config_combo.c
@@ -127,6 +127,7 @@ gc_board_config_combo_locales_changed(GtkComboBox *combobox,
 
   g_hash_table_replace(u->config->hash_conf,
 		       (gpointer) the_key, (gpointer) g_strdup( value ) );
+
 }
 
 /* key = "locale" */
@@ -318,36 +319,6 @@ gc_board_config_combo_drag(GcomprisBoardConf *config, gint init)
 
 }
 
-static gchar *current_locale = NULL;
-void
-gc_locale_change(gchar *locale)
-{
-  if (!locale)
-    return;
-
-  if (g_strcmp0(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
@@ -418,7 +389,8 @@ gc_locale_gets_asset_list(const gchar *filename)
 GtkComboBox *gc_board_config_combo_locales_asset(GcomprisBoardConf *config,
 						 const gchar *label,
 						 gchar *init,
-						 const gchar *file)
+						 const gchar *file,
+						 GCallback callback)
 {
   g_return_val_if_fail(config, NULL);
   GtkWidget *combobox;
@@ -500,6 +472,11 @@ GtkComboBox *gc_board_config_combo_locales_asset(GcomprisBoardConf *config,
 		   "changed",
 		   G_CALLBACK(gc_board_config_combo_locales_changed),
 		   u);
+  if ( callback )
+    g_signal_connect_after(G_OBJECT(combobox),
+			   "changed",
+			   G_CALLBACK(callback),
+			   u);
 
   return GTK_COMBO_BOX(combobox);
 }
diff --git a/src/gcompris/board_config_common.h b/src/gcompris/board_config_common.h
index f807fa2..93efee1 100644
--- a/src/gcompris/board_config_common.h
+++ b/src/gcompris/board_config_common.h
@@ -28,7 +28,7 @@ typedef struct
 {
 	gchar *key;
 	GcomprisBoardConf *config;
-} _gc_boardconf_key;
+  } _gc_boardconf_key;
 
 void _gc_destroy_boardconf_key(GtkWidget*w, gpointer data);
 
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index e430a0e..76bde26 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -1426,14 +1426,21 @@ char *gc_locale_get_user_default()
 
 /*
  * This set the locale for which text must be displayed
+ * If locale is NULL, "" or "NULL" then locale is set to the user's default locale
+ * if any or the user's system locale instead.
  *
  */
 void
-gc_locale_set(gchar *locale)
+gc_locale_set(const gchar *locale)
 {
 
-  if(!locale)
-    return;
+  if(!locale || locale[0] == '\0' || (g_strcmp0(locale, "NULL") == 0) )
+    {
+      if ( properties->locale && properties->locale[0] != '\0')
+	locale = properties->locale;
+      else
+	locale = gc_locale_get_user_default();
+    }
 
   g_message("gc_locale_set '%s'\n", locale);
   if(gc_locale != NULL)
diff --git a/src/gcompris/gcompris.h b/src/gcompris/gcompris.h
index e914ff7..736eb2a 100644
--- a/src/gcompris/gcompris.h
+++ b/src/gcompris/gcompris.h
@@ -168,7 +168,7 @@ GooCanvas       *gc_get_canvas(void);
 GtkWidget	*gc_get_window(void);
 
 const gchar	*gc_locale_get(void);
-void		 gc_locale_set(gchar *locale);
+void		 gc_locale_set(const gchar *locale);
 char		*gc_locale_get_user_default(void);
 const gchar	*gc_locale_get_name(const gchar *locale);
 const gchar	*gc_locale_get_locale(const gchar *name);
diff --git a/src/gletters-activity/gletters.c b/src/gletters-activity/gletters.c
index d90fc66..cfbb441 100644
--- a/src/gletters-activity/gletters.c
+++ b/src/gletters-activity/gletters.c
@@ -289,7 +289,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 {
   GHashTable *config = gc_db_get_board_conf();
 
-  gc_locale_change(g_hash_table_lookup( config, "locale"));
+  gc_locale_set(g_hash_table_lookup( config, "locale"));
 
   gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
 
@@ -343,7 +343,7 @@ end_board ()
       g_free(keyMap);
     }
 
-  gc_locale_reset();
+  gc_locale_set( NULL );
 
   gcomprisBoard = NULL;
 }
diff --git a/src/imageid-activity/imageid.c b/src/imageid-activity/imageid.c
index 4d277ed..472572d 100644
--- a/src/imageid-activity/imageid.c
+++ b/src/imageid-activity/imageid.c
@@ -145,7 +145,7 @@ start_board (GcomprisBoard *agcomprisBoard)
   gchar *filename = NULL;
   GHashTable *config = gc_db_get_board_conf();
 
-  gc_locale_change(g_hash_table_lookup( config, "locale"));
+  gc_locale_set(g_hash_table_lookup( config, "locale"));
 
   g_hash_table_destroy(config);
 
@@ -192,7 +192,7 @@ end_board ()
       destroy_board_list();
     }
 
-  gc_locale_reset();
+  gc_locale_set( NULL );
 
   gcomprisBoard = NULL;
 }
diff --git a/src/missing_letter-activity/missingletter.c b/src/missing_letter-activity/missingletter.c
index a8da762..e5ece82 100644
--- a/src/missing_letter-activity/missingletter.c
+++ b/src/missing_letter-activity/missingletter.c
@@ -154,7 +154,7 @@ start_board (GcomprisBoard *agcomprisBoard)
 {
   GHashTable *config = gc_db_get_board_conf();
 
-  gc_locale_change(g_hash_table_lookup( config, "locale"));
+  gc_locale_set(g_hash_table_lookup( config, "locale"));
 
   gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
 
@@ -193,7 +193,7 @@ static void end_board ()
       board_list = NULL;
     }
 
-  gc_locale_reset();
+  gc_locale_set( NULL );
 
   gcomprisBoard_missing = NULL;
 }
diff --git a/src/pythontest-activity/pythontest.py b/src/pythontest-activity/pythontest.py
index a3058a3..783b841 100644
--- a/src/pythontest-activity/pythontest.py
+++ b/src/pythontest-activity/pythontest.py
@@ -98,10 +98,8 @@ class Gcompris_pythontest:
 
     print "self.config_dict final :", self.config_dict
 
-    self.previous_locale = gcompris.get_locale()
-
     if self.config_dict.has_key('locale'):
-      gcompris.change_locale(self.config_dict['locale'])
+      gcompris.set_locale(self.config_dict['locale'])
 
     # self.colors['line'] s set in init.
     # I put here the configuration use
@@ -284,7 +282,7 @@ class Gcompris_pythontest:
 
   def end(self):
 
-    gcompris.reset_locale()
+    gcompris.set_locale( "" )
 
     # Remove the root item removes all the others inside it
     self.rootitem.remove()
@@ -512,7 +510,7 @@ class Gcompris_pythontest:
 
     gcompris.combo_locales_asset(bconf, _("Select sound locale"),
                                  self.config_dict['locale_sound'],
-                                 "voices/$LOCALE/colors/red.ogg" )
+                                 "voices/$LOCALE/colors/red.ogg")
 
   def color_disable(self, button):
     self.color_choice.set_sensitive(not button.get_active())
diff --git a/src/readingh-activity/reading.c b/src/readingh-activity/reading.c
index 8866a93..0e6d66b 100644
--- a/src/readingh-activity/reading.c
+++ b/src/readingh-activity/reading.c
@@ -171,7 +171,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 {
   GHashTable *config = gc_db_get_board_conf();
 
-  gc_locale_change(g_hash_table_lookup( config, "locale"));
+  gc_locale_set(g_hash_table_lookup( config, "locale"));
 
   gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
 
@@ -260,7 +260,7 @@ end_board ()
     gc_wordlist = NULL;
   }
 
-  gc_locale_reset();
+  gc_locale_set( NULL );
 
   gcomprisBoard = NULL;
 }
diff --git a/src/smallnumbers-activity/smallnumbers.c b/src/smallnumbers-activity/smallnumbers.c
index d445a2a..13a94df 100644
--- a/src/smallnumbers-activity/smallnumbers.c
+++ b/src/smallnumbers-activity/smallnumbers.c
@@ -616,8 +616,9 @@ smallnumber_config_start(GcomprisBoard *agcomprisBoard,
   GtkCheckButton  *sound_control = gc_board_config_boolean_box(bconf, _("Enable sounds"), "with_sound", with_sound);
 
   GtkComboBox *sound_box = gc_board_config_combo_locales_asset(bconf, _("Select sound locale"),
-							 saved_locale_sound,
-							 "voices/$LOCALE/colors/purple.ogg");
+							       saved_locale_sound,
+							       "voices/$LOCALE/colors/purple.ogg",
+							       NULL);
 
   gtk_widget_set_sensitive(GTK_WIDGET(sound_box), with_sound);
 
diff --git a/src/wordsgame-activity/wordsgame.c b/src/wordsgame-activity/wordsgame.c
index 59f7dfc..203374f 100644
--- a/src/wordsgame-activity/wordsgame.c
+++ b/src/wordsgame-activity/wordsgame.c
@@ -180,7 +180,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
       gcomprisBoard=agcomprisBoard;
 
       GHashTable *config = gc_db_get_board_conf();
-      gc_locale_change(g_hash_table_lookup( config, "locale"));
+      gc_locale_set(g_hash_table_lookup( config, "locale"));
 
       gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
       if (up_init_str && (strcmp(up_init_str, "True")==0))
@@ -247,7 +247,7 @@ end_board ()
       }
     }
 
-  gc_locale_reset();
+  gc_locale_set( NULL );
 }
 
 static void



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