diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2009-02-16 23:32:03 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2009-02-16 23:32:03 (GMT) |
commit | fa51d68e7fde1ad8a9d0c3ba20762d6534c26ba2 (patch) | |
tree | 55cd7dc5687a18de9d79ed1fd7cc0b878fa6bd25 /src/gcompris | |
parent | 48c9a62bc18d8347f994f5d21688d2914c99d124 (diff) |
- Miquel DE IZARRA Added support for editing the content of the missing
- Miquel DE IZARRA Added support for editing the content
of the missing letter activity.
svn path=/trunk/; revision=3722
Diffstat (limited to 'src/gcompris')
-rw-r--r-- | src/gcompris/board_config_wordlist.c | 12 | ||||
-rw-r--r-- | src/gcompris/gc_net.c | 43 | ||||
-rw-r--r-- | src/gcompris/gc_net.h | 1 | ||||
-rw-r--r-- | src/gcompris/gcompris.c | 16 |
4 files changed, 61 insertions, 11 deletions
diff --git a/src/gcompris/board_config_wordlist.c b/src/gcompris/board_config_wordlist.c index b0609ba..a6364b2 100644 --- a/src/gcompris/board_config_wordlist.c +++ b/src/gcompris/board_config_wordlist.c @@ -49,7 +49,7 @@ static void _combo_level_changed(GtkComboBox *combo_level, gpointer user_data) } wordsArray = g_malloc0(sizeof(gpointer)*(g_slist_length(lw->words)+1)); - + for(i=0, list = lw->words; list; list=list->next) { wordsArray[i]=(gchar*)list->data; @@ -159,7 +159,7 @@ static void _button_clicked(GtkWidget *w, gpointer data) static void _destroy(GtkWidget *w, gpointer data) { user_param_type_wordlist *u = (user_param_type_wordlist*)data; - + gc_wordlist_free(u->wordlist); g_free(u); } @@ -177,7 +177,7 @@ GtkWidget *gc_board_config_wordlist(GcomprisBoardConf *config, const gchar *file const gchar *locale; /* frame */ - frame = gtk_frame_new("Change wordlist"); + frame = gtk_frame_new(_("Configure the list of words")); gtk_widget_show(frame); gtk_box_pack_start(GTK_BOX(config->main_conf_box), frame, FALSE, FALSE, 8); @@ -206,7 +206,7 @@ GtkWidget *gc_board_config_wordlist(GcomprisBoardConf *config, const gchar *file gtk_widget_show(combo_lang); hbox = gtk_hbox_new(FALSE, 8); - label = gtk_label_new(_("Choice language")); + label = gtk_label_new(_("Choice of the language")); gtk_widget_show(label); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8); @@ -218,7 +218,7 @@ GtkWidget *gc_board_config_wordlist(GcomprisBoardConf *config, const gchar *file gtk_widget_show(combo_level); hbox = gtk_hbox_new(FALSE, 8); - label = gtk_label_new(_("Choice level")); + label = gtk_label_new(_("Choice of the level")); gtk_widget_show(label); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8); @@ -243,7 +243,7 @@ GtkWidget *gc_board_config_wordlist(GcomprisBoardConf *config, const gchar *file gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 8); - GtkWidget * b_default = gtk_button_new_with_label(_("Return to default")); + GtkWidget * b_default = gtk_button_new_with_label(_("Back to default")); gtk_widget_show(b_default); gtk_box_pack_start(GTK_BOX(hbox), b_default, FALSE, FALSE, 8); diff --git a/src/gcompris/gc_net.c b/src/gcompris/gc_net.c index db840fb..e74a114 100644 --- a/src/gcompris/gc_net.c +++ b/src/gcompris/gc_net.c @@ -171,6 +171,11 @@ gc_net_get_url_from_file(const gchar *format, ...) g_file_set_contents(cache, buf, buflen, NULL); g_free(buf); } + else + { /* file is in content.txt but not in server */ + g_free(cache); + cache = NULL; + } } } g_free(file); @@ -257,6 +262,44 @@ void gc_cache_add(gchar *filename) g_hash_table_insert(cache_content, g_strdup(filename), g_strdup("0")); } +gchar* gc_cache_import_pixmap(gchar *filename, gchar *boarddir, gint width, gint height) +{ + GdkPixbuf *pixmap; + gchar *basename, *file, *ext, *name, *abs; + + if(!g_path_is_absolute(filename)) + return g_strdup(filename); + basename = g_path_get_basename(filename); + name = g_build_filename(boarddir, basename,NULL); + abs = gc_file_find_absolute(name); + if(abs && strcmp(abs,filename)==0) + { + g_free(basename); + g_free(abs); + return name; + } + pixmap = gdk_pixbuf_new_from_file_at_size(filename, width, height,NULL); + if(!pixmap) + { + g_free(abs); + g_free(basename); + g_free(name); + return NULL; + } + + file = gc_file_find_absolute_writeable(name); + ext = strchr(basename, '.')+1; + if(strcmp(ext, "jpg")==0) + ext ="jpeg"; + + gdk_pixbuf_save(pixmap, file, ext, NULL,NULL); + + g_free(abs); + g_free(basename); + g_free(file); + return name; +} + void gc_cache_remove(gchar *filename) { g_remove(filename); diff --git a/src/gcompris/gc_net.h b/src/gcompris/gc_net.h index 968af6e..af0117c 100644 --- a/src/gcompris/gc_net.h +++ b/src/gcompris/gc_net.h @@ -40,6 +40,7 @@ void gc_net_destroy(); void gc_cache_init(void); void gc_cache_add(gchar *filename); +gchar* gc_cache_import_pixmap(gchar *filename, gchar *boarddir, gint width, gint height); void gc_cache_remove(gchar *filename); void gc_cache_save(void); void gc_cache_destroy(void); diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c index b8355ff..c651358 100644 --- a/src/gcompris/gcompris.c +++ b/src/gcompris/gcompris.c @@ -1712,8 +1712,7 @@ main (int argc, char *argv[]) } } } - /* FIXME: Need to translate */ - printf("Number of activities: %d\n", board_count); + printf(_("Number of activities: %d\n"), board_count); exit(0); } @@ -1749,7 +1748,7 @@ main (int argc, char *argv[]) { if (g_access(properties->database, R_OK)==-1) { - printf("%s exists but is not readable or writable", properties->database); + printf(_("%s exists but is not readable or writable"), properties->database); exit(0); } } @@ -1808,8 +1807,10 @@ main (int argc, char *argv[]) if (popt_server){ #ifdef USE_GNET properties->server = g_strdup(popt_server); + printf(" Server '%s'\n", properties->server); #else - printf("The --server option cannot be used because GCompris has been compiled without network support!"); + printf(_("The --server option cannot be used because" + "GCompris has been compiled without network support!")); exit(1); #endif } @@ -1823,7 +1824,11 @@ main (int argc, char *argv[]) } if (popt_server){ + if(popt_cache_dir) properties->cache_dir = g_strdup(popt_cache_dir); + else + properties->cache_dir = g_build_filename(g_get_user_cache_dir(), "gcompris", NULL); + printf(" Cache dir '%s'\n",properties->cache_dir); } if (popt_drag_mode){ @@ -1855,7 +1860,8 @@ main (int argc, char *argv[]) if(properties->profile == NULL) { - printf("ERROR: Profile '%s' is not found. Run 'gcompris --profile-list' to list available ones\n", + printf(_("ERROR: Profile '%s' is not found." + " Run 'gcompris --profile-list' to list available ones\n"), popt_profile); exit(1); } |