Commit 25bc47ed authored by Bruno Coudoin's avatar Bruno Coudoin

- 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
parent 7ec96c29
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>
......
......@@ -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)
......
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.
......
......@@ -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>
......@@ -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 {
......
......@@ -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()
/* 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);
}
}
}
......
......@@ -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);
/*------------------------------------------------------------*/
......
......@@ -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") */
......
/* 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: */
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment