diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | README.translators (renamed from po/TRANSLATORS.README) | 0 | ||||
-rw-r--r-- | README.windows | 2 | ||||
-rw-r--r-- | boards/geography.xml.in | 1 | ||||
-rw-r--r-- | src/boards/py-gcompris-board.c | 2 | ||||
-rw-r--r-- | src/boards/python/admin/module_boards.py | 3 | ||||
-rw-r--r-- | src/gcompris/gameutil.c | 20 | ||||
-rw-r--r-- | src/gcompris/gcompris.c | 12 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.c | 46 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.h | 4 | ||||
-rw-r--r-- | src/gcompris/skin.c | 8 |
12 files changed, 112 insertions, 11 deletions
@@ -1,3 +1,24 @@ +2006-07-10 Bruno coudoin <bruno.coudoin@free.fr> + + - added support for the --display-resource option (uncomplete yet) + + * Makefile.am: Moved po/TRANSLATORS.README in README.translators + * README.translators: + * README.windows: + * boards/geography.xml.in: added a resource (test) + * po/TRANSLATORS.README: moved up + * src/boards/py-gcompris-board.c: (pyGcomprisBoardType_getattr): replace a printf by a g_warning + * src/boards/python/admin/module_boards.py: now exit gcompris when closed. It avoids a crash when + quiting the admin mode. What happens is that since admin is the only activity, it is restarted + by the menu and it creates an sqlite assertion. + * src/gcompris/gameutil.c: (gcompris_add_xml_to_data): added support for the --display-resource + option + * src/gcompris/gcompris.c: (gcompris_init): - + * src/gcompris/gcompris_db.c: (gcompris_is_activity_in_profile): added function to support + --display-resource + * src/gcompris/gcompris_db.h: - + * src/gcompris/skin.c: (gcompris_skin_xml_load): fixed warnings + 2006-07-08 Bruno coudoin <bruno.coudoin@free.fr> diff --git a/Makefile.am b/Makefile.am index 15faf9f..569c28b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,9 @@ EXTRA_DIST = \ intltool-extract.in \ intltool-merge.in \ intltool-update.in \ - README.mingw config.h.mingw Makefile.mingw global_win32.mak gcompris.ico gcompris-installer.nsi + README.mingw README.translators README.windows \ + config.h.mingw Makefile.mingw global_win32.mak gcompris.ico gcompris-installer.nsi + distcore = $(PACKAGE)-core-$(VERSION) diff --git a/po/TRANSLATORS.README b/README.translators index f03a581..f03a581 100644 --- a/po/TRANSLATORS.README +++ b/README.translators diff --git a/README.windows b/README.windows index b0bd1ec..f3fd93e 100644 --- a/README.windows +++ b/README.windows @@ -1,5 +1,5 @@ - http://www.ofset.org/gcompris + http://gcompris.net has a full list of changes since the previous release. Information on building gcompris on Windows can be found in README.mingw. diff --git a/boards/geography.xml.in b/boards/geography.xml.in index fa3300b..9c190a0 100644 --- a/boards/geography.xml.in +++ b/boards/geography.xml.in @@ -13,5 +13,6 @@ <_description>Drag and Drop the items to redraw the whole map</_description> <_prerequisite>Mouse manipulation: movement, drag and drop</_prerequisite> <_credit>The map of Germany comes from Wikipedia and is released under the GNU Free Documentation License. Olaf Ronneberger and his children Lina and Julia Ronneberger created the German level.</_credit> + <resource>geography</resource> </Board> </GCompris> diff --git a/src/boards/py-gcompris-board.c b/src/boards/py-gcompris-board.c index 93b559f..2047c2e 100644 --- a/src/boards/py-gcompris-board.c +++ b/src/boards/py-gcompris-board.c @@ -107,7 +107,7 @@ pyGcomprisBoardType_getattr(pyGcomprisBoardObject *self, char *name) } if (self->cdata->plugin->config_start && self->cdata->plugin->config_stop){ - printf ("Board %s is configurable \n", self->cdata->name); + g_warning ("Board %s is configurable\n", self->cdata->name); Py_INCREF(Py_True); return Py_True; } else { diff --git a/src/boards/python/admin/module_boards.py b/src/boards/python/admin/module_boards.py index 7e64a87..b0b19f0 100644 --- a/src/boards/python/admin/module_boards.py +++ b/src/boards/python/admin/module_boards.py @@ -26,6 +26,7 @@ import gcompris.admin import gtk import gtk.gdk from gettext import gettext as _ +import sys; # Database from pysqlite2 import dbapi2 as sqlite @@ -82,3 +83,5 @@ class Boards(module.Module): # Remove the root item removes all the others inside it self.rootitem.destroy() + # For now, quitting admin is definitive + sys.exit() diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c index f11d3f3..c296ef0 100644 --- a/src/gcompris/gameutil.c +++ b/src/gcompris/gameutil.c @@ -1,6 +1,6 @@ /* gcompris - gameutil.c * - * Time-stamp: <2006/05/11 22:03:34 bruno> + * Time-stamp: <2006/07/10 01:24:04 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -277,9 +277,10 @@ gchar *reactivate_newline(char *str) */ static void -gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, GcomprisBoard *gcomprisBoard, gboolean db) +gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, + GcomprisBoard *gcomprisBoard, gboolean db) { - GcomprisProperties *properties = gcompris_get_properties(); + GcomprisProperties *properties = gcompris_get_properties(); gchar *title=NULL; gchar *description=NULL; gchar *prerequisite=NULL; @@ -388,6 +389,19 @@ gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, Gcomp credit =(char *) xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->credit = reactivate_newline(gettext(credit)); } + + /* Display the resource on stdout */ + if (properties->display_resource + && !strcmp((char *)xmlnode->name, "resource") + && gcompris_get_current_profile()) + { + if(gcompris_is_activity_in_profile(gcompris_get_current_profile(), gcomprisBoard->name)) + { + char *resource = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + printf("%s\n", resource); + } + } + } diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c index 26cbe5a..92939b3 100644 --- a/src/gcompris/gcompris.c +++ b/src/gcompris/gcompris.c @@ -119,6 +119,7 @@ static char *popt_users_dir = NULL; static int popt_experimental = FALSE; static int popt_no_quit = FALSE; static int popt_no_config = FALSE; +static int popt_display_resource = FALSE; static struct poptOption options[] = { {"fullscreen", 'f', POPT_ARG_NONE, &popt_fullscreen, 0, @@ -169,6 +170,8 @@ static struct poptOption options[] = { N_("Disable the quit button"), NULL}, {"disable-config",'\0', POPT_ARG_NONE, &popt_no_config, 0, N_("Disable the config button"), NULL}, + {"display_resource",'\0', POPT_ARG_NONE, &popt_display_resource, 0, + N_("Display the resources on stdout based on the selected activities"), NULL}, #ifndef WIN32 /* Not supported on windows */ POPT_AUTOHELP #endif @@ -1506,6 +1509,15 @@ gcompris_init (int argc, char *argv[]) exit(0); } + /* An alternate profile is requested, check it does exists */ + if (popt_display_resource){ + properties->display_resource = TRUE; + properties->reread_menu = TRUE; + printf("Resources for selected activities (as selected by gcompris --administration):\n"); + gcompris_load_menus(); + exit(0); + } + poptFreeContext(pctx); /*------------------------------------------------------------*/ diff --git a/src/gcompris/gcompris_db.c b/src/gcompris/gcompris_db.c index 2145c0b..bf4ef0c 100644 --- a/src/gcompris/gcompris_db.c +++ b/src/gcompris/gcompris_db.c @@ -1829,6 +1829,52 @@ GList *gcompris_get_classes_list() #endif } +/* Special request, return true if an activity name is disabled in the profile */ +#define DB_IS_ACTIVITY_IN_PROFILE_ID(profile_id, name) \ + "SELECT activities_out.board_id FROM activities_out, boards WHERE boards.name='%s' AND activities_out.out_id='%d' AND activities_out.board_id=boards.board_id;", name, profile_id + +int gcompris_is_activity_in_profile(GcomprisProfile *profile, char *activity_name) +{ +#ifdef USE_SQLITE + char *zErrMsg; + char **result; + int rc; + int nrow; + int ncolumn; + gchar *request; + + request = g_strdup_printf(DB_IS_ACTIVITY_IN_PROFILE_ID(profile->profile_id, activity_name)); + printf("request=%s\n", request); + + rc = sqlite3_get_table(gcompris_db, + request, + &result, + &nrow, + &ncolumn, + &zErrMsg + ); + + g_free(request); + + if( rc!=SQLITE_OK ){ + g_error("SQL error: %s\n", zErrMsg); + } + + if (nrow == 0){ + /* IS IN THE PROFILE */ + return TRUE; + } + + /* IS NOT IN THE PROFILE */ + return FALSE; + +#else + return TRUE; +#endif +} + + + /* Local Variables: */ /* mode:c */ /* eval:(load-library "time-stamp") */ diff --git a/src/gcompris/gcompris_db.h b/src/gcompris/gcompris_db.h index a68d60b..97b4b00 100644 --- a/src/gcompris/gcompris_db.h +++ b/src/gcompris/gcompris_db.h @@ -1,6 +1,6 @@ /* gcompris - gcompris_db.h * - * Time-stamp: <2006/03/02 00:19:19 bruno> + * Time-stamp: <2006/07/10 00:48:16 bruno> * * Copyright (C) 2005 Bruno Coudoin * @@ -118,6 +118,8 @@ GHashTable *gcompris_get_conf_with_table(int profile_id, int board_id, GHashTabl GcomprisBoard *gcompris_get_board_from_id(int board_id); +int gcompris_is_activity_in_profile(GcomprisProfile *profile, char *activity_name); + #endif /* Local Variables: */ diff --git a/src/gcompris/skin.c b/src/gcompris/skin.c index a31a44a..b076d8a 100644 --- a/src/gcompris/skin.c +++ b/src/gcompris/skin.c @@ -299,8 +299,8 @@ void gcompris_skin_xml_load (gchar* skin) while(node !=NULL) { if(g_strcasecmp((gchar *)node->name, "color")==0){ - key = xmlGetProp(node, BAD_CAST "id"); - data = xmlGetProp(node, BAD_CAST "rgba"); + key = (gchar *)xmlGetProp(node, BAD_CAST "id"); + data =(gchar *) xmlGetProp(node, BAD_CAST "rgba"); if((key!=NULL)&&(data!=NULL)){ if(gcompris_skin_str_to_color(data, &color)){ g_hash_table_insert(gcompris_skin_colors, key, GUINT_TO_POINTER(color)); @@ -311,8 +311,8 @@ void gcompris_skin_xml_load (gchar* skin) if(data!=NULL) g_free(data); } else if(g_strcasecmp((gchar *)node->name, "font")==0){ - key = xmlGetProp(node, BAD_CAST "id"); - data = xmlGetProp(node, BAD_CAST "name"); + key = (gchar *)xmlGetProp(node, BAD_CAST "id"); + data = (gchar *)xmlGetProp(node, BAD_CAST "name"); if((key!=NULL)&&(data!=NULL)){ g_hash_table_insert(gcompris_skin_fonts, key, data); } else { |