diff options
author | Yves Combe <ycombe@src.gnome.org> | 2006-03-19 22:24:06 (GMT) |
---|---|---|
committer | Yves Combe <ycombe@src.gnome.org> | 2006-03-19 22:24:06 (GMT) |
commit | 3c347926ef8b42331bc42318f1c10179c0ad4303 (patch) | |
tree | 9ac7ac562def8382df230244639f301c0f672785 | |
parent | b15f7f26439b092e508e12d0f04b4d861c34c1d7 (diff) |
fix crashes and misfonctionnement of boards config on fly
if compiled without sqlite (e.g. Windows version).
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/boards/click_on_letter.c | 22 | ||||
-rw-r--r-- | src/boards/colors.c | 17 | ||||
-rw-r--r-- | src/boards/gletters.c | 53 | ||||
-rw-r--r-- | src/boards/imageid.c | 26 | ||||
-rw-r--r-- | src/boards/missingletter.c | 28 | ||||
-rw-r--r-- | src/boards/reading.c | 29 | ||||
-rw-r--r-- | src/boards/shapegame.c | 28 | ||||
-rw-r--r-- | src/boards/smallnumbers.c | 20 |
9 files changed, 175 insertions, 63 deletions
@@ -1,3 +1,18 @@ +2006-03-19 Yves Combe <yves@ycombe.net> + + fix crashes and misfonctionnement of boards config on fly + if compiled without sqlite (e.g. Windows version). + + * src/boards/click_on_letter.c: (conf_ok), (config_start): + * src/boards/colors.c: (conf_ok), (colors_config_start): + * src/boards/gletters.c: (start_board), (gletters_create_item), + (conf_ok), (gletter_config_start): + * src/boards/imageid.c: (conf_ok), (config_start): + * src/boards/missingletter.c: (conf_ok), (config_start): + * src/boards/reading.c: (conf_ok), (reading_config_start): + * src/boards/shapegame.c: (conf_ok), (config_start): + * src/boards/smallnumbers.c: (conf_ok), (smallnumber_config_start): + 2006-03-16 Yves Combe <yves@ycombe.net> fix missing buttons images in gtans. diff --git a/src/boards/click_on_letter.c b/src/boards/click_on_letter.c index 22bcabe..ab8db67 100644 --- a/src/boards/click_on_letter.c +++ b/src/boards/click_on_letter.c @@ -581,7 +581,11 @@ static GcomprisConfCallback conf_ok(GHashTable *table) profile_conf = NULL; if (gcomprisBoard){ - GHashTable *config = gcompris_get_board_conf(); + GHashTable *config; + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_reset_locale(); gcompris_change_locale(g_hash_table_lookup( config, "locale")); @@ -593,7 +597,8 @@ static GcomprisConfCallback conf_ok(GHashTable *table) else uppercase_only = FALSE; - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); sounds_are_fine(); @@ -603,6 +608,9 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); } + + board_conf = NULL; + profile_conf = NULL; } static void @@ -615,10 +623,14 @@ config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - gcompris_configuration_window( g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, - aProfile ? aProfile->name : ""), + gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", + agcomprisBoard->name, + aProfile ? aProfile->name : ""); + + gcompris_configuration_window( label, (GcomprisConfCallback )conf_ok); + + g_free(label); /* init the combo to previously saved value */ GHashTable *config = gcompris_get_conf( profile_conf, board_conf); diff --git a/src/boards/colors.c b/src/boards/colors.c index 411d24f..2d3ea40 100644 --- a/src/boards/colors.c +++ b/src/boards/colors.c @@ -130,26 +130,29 @@ static GcomprisConfCallback conf_ok(GHashTable *table) g_hash_table_foreach(table, (GHFunc) save_table, NULL); - board_conf = NULL; - profile_conf = NULL; - - if (gcomprisBoard){ GHashTable *config = gcompris_get_board_conf(); + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; + if (locale_sound) g_free(locale_sound); locale_sound = g_strdup(g_hash_table_lookup( config, "locale_sound")); - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); colors_next_level(); pause_board(FALSE); } + board_conf = NULL; + profile_conf = NULL; - } static gboolean check_text(gchar *key, gchar *text, GtkLabel *label){ @@ -172,7 +175,7 @@ colors_config_start(GcomprisBoard *agcomprisBoard, pause_board(TRUE); label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, aProfile->name); + agcomprisBoard->name, aProfile ? aProfile->name : ""); gcompris_configuration_window(label, (GcomprisConfCallback )conf_ok); diff --git a/src/boards/gletters.c b/src/boards/gletters.c index bb03675..8486960 100644 --- a/src/boards/gletters.c +++ b/src/boards/gletters.c @@ -1,6 +1,6 @@ /* gcompris - gletters.c * - * Time-stamp: <2006/01/31 13:25:17 yves> + * Time-stamp: <2006/03/19 23:15:02 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -124,6 +124,8 @@ static guint32 fallSpeed = 0; static double speed = 0.0; static int gamewon; +static gboolean with_sound = FALSE; + /* Description of this plugin */ static BoardPlugin menu_bp = { @@ -297,6 +299,13 @@ static void start_board (GcomprisBoard *agcomprisBoard) else uppercase_only = FALSE; + gchar *control_sound = g_hash_table_lookup( config, "with_sound"); + + if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) + with_sound = TRUE; + else + with_sound = FALSE; + g_hash_table_destroy(config); if(agcomprisBoard!=NULL) @@ -615,7 +624,9 @@ static GnomeCanvasItem *gletters_create_item(GnomeCanvasGroup *parent) gchar *letter_unichar_name= gcompris_alphabet_sound(letter); str2 = gcompris_get_asset_file("gcompris alphabet", NULL, "audio/x-ogg",letter_unichar_name); - gcompris_play_ogg(str2, NULL); + + if (with_sound) + gcompris_play_ogg(str2, NULL); g_free(letter_unichar_name); g_free(str2); @@ -780,12 +791,15 @@ static GcomprisConfCallback conf_ok(GHashTable *table) g_hash_table_foreach(table, (GHFunc) save_table, NULL); - board_conf = NULL; - profile_conf = NULL; - if (gcomprisBoard){ gcompris_reset_locale(); - GHashTable *config = gcompris_get_board_conf(); + + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_change_locale(g_hash_table_lookup( config, "locale")); @@ -795,8 +809,16 @@ static GcomprisConfCallback conf_ok(GHashTable *table) uppercase_only = TRUE; else uppercase_only = FALSE; + + gchar *control_sound = g_hash_table_lookup( config, "with_sound"); - g_hash_table_destroy(config); + if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) + with_sound = TRUE; + else + with_sound = FALSE; + + if (profile_conf) + g_hash_table_destroy(config); load_default_charset(); @@ -806,7 +828,10 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); } - + + board_conf = NULL; + profile_conf = NULL; + } static void @@ -822,7 +847,7 @@ gletter_config_start(GcomprisBoard *agcomprisBoard, pause_board(TRUE); label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, aProfile->name); + agcomprisBoard->name, aProfile ? aProfile->name : ""); gcompris_configuration_window(label, (GcomprisConfCallback )conf_ok); @@ -843,7 +868,17 @@ gletter_config_start(GcomprisBoard *agcomprisBoard, up_init = TRUE; gcompris_separator(); + + gchar *control_sound = g_hash_table_lookup( config, "with_sound"); + if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) + with_sound = TRUE; + else + with_sound = FALSE; + + GtkCheckButton *sound_control = gcompris_boolean_box("Enable sounds", "with_sound", with_sound); + gcompris_separator(); + gcompris_boolean_box(_("Uppercase only text"), "uppercase_only", up_init); diff --git a/src/boards/imageid.c b/src/boards/imageid.c index 01935f5..7f9611b 100644 --- a/src/boards/imageid.c +++ b/src/boards/imageid.c @@ -716,18 +716,21 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - - board_conf = NULL; - profile_conf = NULL; if (gcomprisBoard) { gcompris_reset_locale(); - GHashTable *config = gcompris_get_board_conf(); + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_change_locale(g_hash_table_lookup( config, "locale")); - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); destroy_board_list(); @@ -738,6 +741,9 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); } + board_conf = NULL; + profile_conf = NULL; + } static void @@ -750,11 +756,15 @@ config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - gcompris_configuration_window( g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, - aProfile ? aProfile->name : ""), + gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", + agcomprisBoard->name, + aProfile ? aProfile->name : ""); + + gcompris_configuration_window( label, (GcomprisConfCallback )conf_ok); + g_free(label); + /* init the combo to previously saved value */ GHashTable *config = gcompris_get_conf( profile_conf, board_conf); diff --git a/src/boards/missingletter.c b/src/boards/missingletter.c index 60a6158..2a1d77c 100644 --- a/src/boards/missingletter.c +++ b/src/boards/missingletter.c @@ -730,17 +730,21 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - - board_conf = NULL; - profile_conf = NULL; if (gcomprisBoard){ gcompris_reset_locale(); - GHashTable *config = gcompris_get_board_conf(); + + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_change_locale(g_hash_table_lookup( config, "locale")); - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); destroy_board_list(); @@ -750,6 +754,10 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } + + board_conf = NULL; + profile_conf = NULL; + return NULL; } @@ -763,11 +771,15 @@ config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - gcompris_configuration_window( g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, - aProfile->name), + gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", + agcomprisBoard->name, + aProfile ? aProfile->name : ""); + + gcompris_configuration_window( label, (GcomprisConfCallback )conf_ok); + g_free(label); + /* init the combo to previously saved value */ GHashTable *config = gcompris_get_conf( profile_conf, board_conf); diff --git a/src/boards/reading.c b/src/boards/reading.c index c0e7b1c..88ed640 100644 --- a/src/boards/reading.c +++ b/src/boards/reading.c @@ -1,6 +1,6 @@ /* gcompris - reading.c * - * Time-stamp: <2006/01/31 09:20:51 yves> + * Time-stamp: <2006/03/19 22:59:13 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -836,24 +836,29 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - - board_conf = NULL; - profile_conf = NULL; - if (gcomprisBoard){ gcompris_reset_locale(); - GHashTable *config = gcompris_get_board_conf(); + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_change_locale(g_hash_table_lookup( config, "locale")); - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); reading_next_level(); pause_board(FALSE); } + + board_conf = NULL; + profile_conf = NULL; } @@ -867,11 +872,15 @@ reading_config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - gcompris_configuration_window( g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, - aProfile? aProfile->name: ""), + gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", + agcomprisBoard->name, + aProfile? aProfile->name: ""); + + gcompris_configuration_window( label, (GcomprisConfCallback )conf_ok); + g_free(label); + /* init the combo to previously saved value */ GHashTable *config = gcompris_get_conf( profile_conf, board_conf); diff --git a/src/boards/shapegame.c b/src/boards/shapegame.c index ded9c11..d0f61ee 100644 --- a/src/boards/shapegame.c +++ b/src/boards/shapegame.c @@ -1,6 +1,6 @@ /* gcompris - shapegame.c * - * Time-stamp: <2006/01/31 00:13:12 yves> + * Time-stamp: <2006/03/19 22:57:35 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -2103,23 +2103,29 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - - board_conf = NULL; - profile_conf = NULL; if ((gcomprisBoard) && (strcmp(gcomprisBoard->name, "imagename")==0)){ - GHashTable *config = gcompris_get_board_conf(); + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; gcompris_reset_locale(); gcompris_change_locale(g_hash_table_lookup( config, "locale")); - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); shapegame_next_level(); pause_board(FALSE); } + + board_conf = NULL; + profile_conf = NULL; } @@ -2133,11 +2139,15 @@ config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - gcompris_configuration_window( g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, - aProfile? aProfile->name : ""), + gchar * label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", + agcomprisBoard->name, + aProfile? aProfile->name : ""); + + gcompris_configuration_window( label, (GcomprisConfCallback )conf_ok); + g_free(label); + /* init the combo to previously saved value */ GHashTable *config = gcompris_get_conf( profile_conf, board_conf); diff --git a/src/boards/smallnumbers.c b/src/boards/smallnumbers.c index b14b874..a769ff7 100644 --- a/src/boards/smallnumbers.c +++ b/src/boards/smallnumbers.c @@ -1,6 +1,6 @@ /* gcompris - smallnumbers.c * - * Time-stamp: <2006/03/01 01:05:57 bruno> + * Time-stamp: <2006/03/19 22:55:57 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -514,12 +514,14 @@ static GcomprisConfCallback conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - - board_conf = NULL; - profile_conf = NULL; if (gcomprisBoard){ - GHashTable *config = gcompris_get_board_conf(); + GHashTable *config; + + if (profile_conf) + config = gcompris_get_board_conf(); + else + config = table; if (locale_sound) g_free(locale_sound); @@ -533,7 +535,8 @@ static GcomprisConfCallback conf_ok(GHashTable *table) else with_sound = FALSE; - g_hash_table_destroy(config); + if (profile_conf) + g_hash_table_destroy(config); smallnumbers_next_level(); @@ -541,6 +544,9 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); } + + board_conf = NULL; + profile_conf = NULL; } static gboolean check_text(gchar *key, gchar *text, GtkLabel *label){ @@ -569,7 +575,7 @@ smallnumber_config_start(GcomprisBoard *agcomprisBoard, gchar *label; label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, aProfile->name); + agcomprisBoard->name, aProfile ? aProfile->name : ""); gcompris_configuration_window(label, (GcomprisConfCallback )conf_ok); |