[gcompris/gcomprixogoo] Added support for forced uppercase in missingletter.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] Added support for forced uppercase in missingletter.
- Date: Mon, 22 Nov 2010 21:20:28 +0000 (UTC)
commit 9f3769ef448bcec22b3978f84dc3f2c77055fe72
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Mon Nov 22 21:51:31 2010 +0100
Added support for forced uppercase in missingletter.
Thanks to Luciana from sleducational.org
src/missing_letter-activity/missingletter.c | 45 +++++++++++++++++---
src/missing_letter-activity/missingletter_config.c | 15 ++++++-
2 files changed, 52 insertions(+), 8 deletions(-)
---
diff --git a/src/missing_letter-activity/missingletter.c b/src/missing_letter-activity/missingletter.c
index 4891923..2ffac91 100644
--- a/src/missing_letter-activity/missingletter.c
+++ b/src/missing_letter-activity/missingletter.c
@@ -45,7 +45,7 @@ static void config_start(GcomprisBoard *agcomprisBoard,
static void config_stop(void);
/* from missingletter_config.c */
-void config_missing_letter(GcomprisBoardConf *config);
+void config_missing_letter(GcomprisBoardConf *bconf, GHashTable *config);
/* XML */
static void init_xml(guint level);
@@ -66,6 +66,7 @@ static GooCanvasItem *boardRootItem = NULL;
static GooCanvasItem *text = NULL;
static GooCanvasItem *selected_button = NULL;
+static gboolean uppercase_only;
static void missing_letter_create_item(GooCanvasItem *parent);
static void missing_letter_destroy_all_items(void);
@@ -155,6 +156,13 @@ start_board (GcomprisBoard *agcomprisBoard)
gc_locale_change(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))
+ uppercase_only = TRUE;
+ else
+ uppercase_only = FALSE;
+
g_hash_table_destroy(config);
if(agcomprisBoard!=NULL)
@@ -545,14 +553,29 @@ add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GList **list)
guint i = 0;
/* Dont free data, it's a gettext static message */
- board->answer = g_strdup(all_answer[i++]);
- board->question = g_strdup(all_answer[i++]);
+ if (uppercase_only)
+ board->answer = g_utf8_strup(all_answer[i++], -1);
+ else
+ board->answer = g_strdup(all_answer[i++]);
+
+ if (uppercase_only)
+ board->question = g_utf8_strup(all_answer[i++], -1);
+ else
+ board->question = g_strdup(all_answer[i++]);
+
board->solution = 0;
while(all_answer[i] && text_index < MAX_PROPOSAL + 2)
{
- board->text[text_index] = g_strdup(all_answer[i]);
- board->choices[text_index++] = g_strdup(all_answer[i++]);
+ if (uppercase_only)
+ board->text[text_index] = g_utf8_strup(all_answer[i], -1);
+ else
+ board->text[text_index] = g_strdup(all_answer[i]);
+
+ if (uppercase_only)
+ board->choices[text_index++] = g_utf8_strup(all_answer[i++], -1);
+ else
+ board->choices[text_index++] = g_strdup(all_answer[i++]);
}
g_strfreev(all_answer);
@@ -715,6 +738,15 @@ conf_ok(GHashTable *table)
gc_locale_set(g_hash_table_lookup( config, "locale"));
+ gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
+ if (up_init_str)
+ {
+ if(strcmp(up_init_str, "True")==0)
+ uppercase_only = TRUE;
+ else
+ uppercase_only = FALSE;
+ }
+
if (profile_conf)
g_hash_table_destroy(config);
@@ -764,7 +796,8 @@ config_start(GcomprisBoard *agcomprisBoard,
gchar *locale = g_hash_table_lookup( config, "locale");
gc_board_config_combo_locales(bconf, locale);
- config_missing_letter(bconf);
+ config_missing_letter(bconf, config);
+
}
diff --git a/src/missing_letter-activity/missingletter_config.c b/src/missing_letter-activity/missingletter_config.c
index 71c8589..9886f2d 100644
--- a/src/missing_letter-activity/missingletter_config.c
+++ b/src/missing_letter-activity/missingletter_config.c
@@ -441,7 +441,7 @@ static void configure_colummns(GtkTreeView *treeview)
#endif
}
-void config_missing_letter(GcomprisBoardConf *config)
+void config_missing_letter(GcomprisBoardConf *bconf, GHashTable *config)
{
GtkWidget *frame, *view, *pixmap, *question, *answer, *choice;
GtkWidget *level, *vbox, *hbox, *label;
@@ -455,7 +455,7 @@ void config_missing_letter(GcomprisBoardConf *config)
/* frame */
frame = gtk_frame_new("");
gtk_widget_show(frame);
- gtk_box_pack_start(GTK_BOX(config->main_conf_box), frame, TRUE, TRUE, 8);
+ gtk_box_pack_start(GTK_BOX(bconf->main_conf_box), frame, TRUE, TRUE, 8);
vbox = gtk_vbox_new(FALSE, 8);
gtk_widget_show(vbox);
@@ -482,6 +482,17 @@ void config_missing_letter(GcomprisBoardConf *config)
gtk_widget_show(level);
gtk_box_pack_start(GTK_BOX(hbox), level, FALSE, FALSE, 8);
+ /* upper case */
+ gboolean up_init = FALSE;
+ gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
+
+ if (up_init_str && (strcmp(up_init_str, "True")==0))
+ up_init = TRUE;
+
+ gc_board_config_boolean_box(bconf, _("Uppercase only text"),
+ "uppercase_only",
+ up_init);
+
/* list view */
GtkListStore *list = gtk_list_store_new(N_COLUMNS,
G_TYPE_STRING, /*Question */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]