diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | boards/geography/board4_0.xml.in | 4 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | docs/C/python.xml | 5 | ||||
-rw-r--r-- | gcompris-edit.desktop.in | 6 | ||||
-rw-r--r-- | src/boards/menu.c | 2 | ||||
-rw-r--r-- | src/boards/py-mod-gcompris.c | 19 | ||||
-rw-r--r-- | src/boards/python/Makefile.am | 3 | ||||
-rw-r--r-- | src/gcompris/gameutil.c | 2 | ||||
-rw-r--r-- | src/gcompris/gcompris-board.h | 2 | ||||
-rw-r--r-- | src/gcompris/gcompris.c | 26 | ||||
-rw-r--r-- | src/gcompris/gcompris.h | 4 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.c | 18 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.h | 2 | ||||
-rw-r--r-- | src/gcompris/profile.h | 4 | ||||
-rw-r--r-- | src/gcompris/properties.c | 2 | ||||
-rw-r--r-- | src/gcompris/properties.h | 7 |
17 files changed, 80 insertions, 32 deletions
@@ -1,3 +1,7 @@ +2005-06-27 Yves Combe <yves@ycombe.net> + + * administration module (gcompris -e). + 2005-06-22 Yves Combe <yves@ycombe.net> * fix broken Makefile.am diff --git a/boards/geography/board4_0.xml.in b/boards/geography/board4_0.xml.in index 0c03f36..7611c30 100644 --- a/boards/geography/board4_0.xml.in +++ b/boards/geography/board4_0.xml.in @@ -49,8 +49,8 @@ <tooltip>Gabon</tooltip> </Shape> -<Shape name="L" pixmapfile="geography/africa/ganbia.png" sound="africa/ganbia" x="101" y="290" position="0"> - <tooltip>Ganbia</tooltip> +<Shape name="L" pixmapfile="geography/africa/ganbia.png" sound="africa/gambia" x="101" y="290" position="0"> + <tooltip>Gambia</tooltip> </Shape> <Shape name="M" pixmapfile="geography/africa/ghana.png" sound="africa/ghana" x="237" y="355" position="0"> diff --git a/configure.in b/configure.in index c788ee3..b51bbe8 100644 --- a/configure.in +++ b/configure.in @@ -313,6 +313,7 @@ AC_MSG_RESULT($with_sqlite) if test x$with_sqlite = xyes; then PKG_CHECK_MODULES(SQLITE3, sqlite3,, AC_MSG_ERROR([*** SQLITE3 not found!])) AC_DEFINE([USE_SQLITE], 1,[SQLITE Database, Profiles are enabled]) + AM_CHECK_PYMOD(pysqlite2,,,AC_MSG_ERROR([*** pysqlite2 missing ])) fi AM_CONDITIONAL(USE_SQLITE, test x$with_sqlite = xyes) @@ -501,6 +502,7 @@ src/boards/python/gcompris/sound/Makefile src/boards/python/gcompris/timer/Makefile src/boards/python/gcompris/utils/Makefile src/boards/python/connect4p/Makefile +src/boards/python/admin/Makefile po/Makefile.in docs/Makefile docs/C/Makefile diff --git a/docs/C/python.xml b/docs/C/python.xml index ef20ba1..5edfa6c 100644 --- a/docs/C/python.xml +++ b/docs/C/python.xml @@ -299,6 +299,11 @@ attribute is readeable and/or writable.</para> <entry>void gcompris_file_selector_stop(void)</entry> <entry></entry> </row> + <row> + <entry>gcompris.get_database()</entry> + <entry>gchar* gcompris_get_database(void)</entry> + <entry>return the filename (string) of the database (fullpath)</entry> + </row> </tbody> </tgroup> </informaltable> diff --git a/gcompris-edit.desktop.in b/gcompris-edit.desktop.in index 896b153..23eaad2 100644 --- a/gcompris-edit.desktop.in +++ b/gcompris-edit.desktop.in @@ -1,8 +1,8 @@ [Desktop Entry] Encoding=UTF-8 -Name=GCompris Editor -_Comment=Editor for gcompris -Exec=gcompris_edit +Name=GCompris Administration +_Comment=Administration of gcompris +Exec=gcompris -e Icon=gcompris-edit.png Terminal=0 Type=Application diff --git a/src/boards/menu.c b/src/boards/menu.c index db2a568..2f99e2d 100644 --- a/src/boards/menu.c +++ b/src/boards/menu.c @@ -1,6 +1,6 @@ /* gcompris - menu.c * - * Time-stamp: <2005/06/20 22:44:45 yves> + * Time-stamp: <2005/06/22 10:34:21 yves> * * Copyright (C) 2000 Bruno Coudoin * diff --git a/src/boards/py-mod-gcompris.c b/src/boards/py-mod-gcompris.c index 16dccaf..b63f95a 100644 --- a/src/boards/py-mod-gcompris.c +++ b/src/boards/py-mod-gcompris.c @@ -586,6 +586,24 @@ py_gcompris_file_selector_stop(PyObject* self, PyObject* args) return Py_None; } +/* gchar *gcompris_get_database(void); */ +static PyObject* +py_gcompris_get_database(PyObject* self, PyObject* args) +{ + gchar* result; + /* Parse arguments */ + if(!PyArg_ParseTuple(args, ":gcompris_get_database")) + return NULL; + + /* Call the corresponding C function */ + result = (gchar*)gcompris_get_database(); + + /* Create and return the result */ + return Py_BuildValue("s", result); +} + + + static PyMethodDef PythonGcomprisModule[] = { { "end_board", py_gcompris_end_board, METH_VARARGS, "gcompris_end_board" }, @@ -617,6 +635,7 @@ static PyMethodDef PythonGcomprisModule[] = { METH_VARARGS, "gcompris_file_selector_save" }, { "file_selector_stop", py_gcompris_file_selector_stop, METH_VARARGS, "gcompris_file_selector_stop" }, + { "get_database", py_gcompris_get_database, METH_VARARGS, "gcompris_get_database" }, { NULL, NULL, 0, NULL} }; diff --git a/src/boards/python/Makefile.am b/src/boards/python/Makefile.am index 7039746..8a81a79 100644 --- a/src/boards/python/Makefile.am +++ b/src/boards/python/Makefile.am @@ -1,8 +1,9 @@ -SUBDIRS=gcompris connect4p +SUBDIRS=gcompris connect4p admin pythondir = $(PYTHON_PLUGIN_DIR) dist_python_DATA= \ + administration.py \ algorithm.py \ anim.py \ ballcatch.py \ diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c index 587cf33..f969502 100644 --- a/src/gcompris/gameutil.c +++ b/src/gcompris/gameutil.c @@ -1,6 +1,6 @@ /* gcompris - gameutil.c * - * Time-stamp: <2005/06/21 18:19:14 yves> + * Time-stamp: <2005/06/22 10:34:42 yves> * * Copyright (C) 2000 Bruno Coudoin * diff --git a/src/gcompris/gcompris-board.h b/src/gcompris/gcompris-board.h index 9139839..cdf9b4f 100644 --- a/src/gcompris/gcompris-board.h +++ b/src/gcompris/gcompris-board.h @@ -1,6 +1,6 @@ /* gcompris - gcompris-board.h * - * Time-stamp: <2005/06/20 22:30:56 yves> + * Time-stamp: <2005/06/22 10:35:17 yves> * * Copyright (C) 2000 Bruno Coudoin * diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c index 2423dc2..fa56989 100644 --- a/src/gcompris/gcompris.c +++ b/src/gcompris/gcompris.c @@ -1,6 +1,6 @@ /* gcompris - gcompris.c * - * Time-stamp: <2005/06/20 23:45:43 yves> + * Time-stamp: <2005/06/25 21:17:34 yves> * * Copyright (C) 2000-2003 Bruno Coudoin * @@ -619,7 +619,10 @@ static void setup_window () printf("gcompris_load_mime_types %f sec.\n", elapsed); /* Get and Run the root menu */ - gcomprisBoardMenu = gcompris_get_board_from_section(properties->root_menu); + if(properties->administration) + gcomprisBoardMenu = gcompris_get_board_from_section("/administration/administration"); + else + gcomprisBoardMenu = gcompris_get_board_from_section(properties->root_menu); if(!gcomprisBoardMenu) { g_warning("Couldn't find the board menu %s, or plugin execution error", properties->root_menu); @@ -719,6 +722,16 @@ GcomprisProperties *gcompris_get_properties () return (properties); } +/* Return the database file name + * Must be called after properties is initialised + */ +gchar *gcompris_get_database () +{ + g_assert(properties!=NULL); + + return (properties->database); +} + /* * This returns the locale for which text must be displayed * @@ -976,6 +989,9 @@ gcompris_init (int argc, char *argv[]) printf(_("Use -l activity to access directly to activity.\n")); printf(_("List of available activity is :\n")); properties->root_menu = "/"; + + gcompris_db_init(); + gcompris_load_menus(); GList *list = NULL; @@ -1009,10 +1025,6 @@ gcompris_init (int argc, char *argv[]) } } - if (popt_administration){ - g_warning("Running in administration mode"); - properties->administration = TRUE; - } if (popt_database){ if (g_file_test(popt_database, G_FILE_TEST_EXISTS)) { if (!access(popt_database,R_OK|W_OK)){ @@ -1029,10 +1041,12 @@ gcompris_init (int argc, char *argv[]) exit(0); } } + if (popt_administration){ g_warning("Running in administration mode"); properties->administration = TRUE; } + if (popt_reread_xml){ g_warning("Rebuild db from xml files"); properties->reread_xml = TRUE; diff --git a/src/gcompris/gcompris.h b/src/gcompris/gcompris.h index 6e927af..47f3ad1 100644 --- a/src/gcompris/gcompris.h +++ b/src/gcompris/gcompris.h @@ -1,6 +1,6 @@ /* gcompris - gcompris.h * - * Time-stamp: <2005/06/20 22:13:03 yves> + * Time-stamp: <2005/06/25 21:17:27 yves> * * Copyright (C) 2000,2001,2002 Bruno Coudoin * @@ -139,6 +139,8 @@ void gcompris_file_selector_stop (void); void gcompris_exit(); +gchar *gcompris_get_database(); + /* Trace Log */ #define GCOMPRIS_LOG_STATUS_PASSED "PASSED" #define GCOMPRIS_LOG_STATUS_FAILED "FAILED" diff --git a/src/gcompris/gcompris_db.c b/src/gcompris/gcompris_db.c index 45de027..1b39d8e 100644 --- a/src/gcompris/gcompris_db.c +++ b/src/gcompris/gcompris_db.c @@ -1,6 +1,6 @@ /* gcompris - gameutil.c * - * Time-stamp: <2005/06/22 22:46:45 yves> + * Time-stamp: <2005/06/25 21:25:41 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -29,7 +29,9 @@ static sqlite3 *gcompris_db_log=NULL; extern GnomeCanvas *canvas; #define CREATE_TABLE_USERS \ - "CREATE TABLE users (user_id INT UNIQUE, name TEXT, firstname TEXT, birth TEXT, class_id INT ); " + "CREATE TABLE users (user_id INT UNIQUE, login TEXT, name TEXT, firstname TEXT, birthdate TEXT, class_id INT ); " +#define CREATE_TABLE_CLASS \ + "CREATE TABLE class (class_id INT UNIQUE, name TEXT, teacher TEXT ); " #define CREATE_TABLE_GROUPS \ "CREATE TABLE groups (group_id INT UNIQUE, group_name TEXT, class_id INT, description TEXT ); " #define CREATE_TABLE_USERS_IN_GROUPS \ @@ -93,6 +95,10 @@ int gcompris_db_init() if( rc!=SQLITE_OK ){ g_error("SQL error: %s\n", zErrMsg); } + rc = sqlite3_exec(gcompris_db,CREATE_TABLE_CLASS, NULL, 0, &zErrMsg); + if( rc!=SQLITE_OK ){ + g_error("SQL error: %s\n", zErrMsg); + } rc = sqlite3_exec(gcompris_db,CREATE_TABLE_GROUPS, NULL, 0, &zErrMsg); if( rc!=SQLITE_OK ){ g_error("SQL error: %s\n", zErrMsg); @@ -517,8 +523,8 @@ GList *gcompris_load_menus_db(GList *boards_list) #endif } -#define SAVE_USER(user_id, login, name, firstname, birthday, class_id) \ - "INSERT OR REPLACE INTO users ( %d, \'%s\', \'%s\', \'%s\', %s)", user_id, login, name, firstname, birthday,class_id +#define SAVE_USER(user_id, login, name, firstname, birthdate, class_id) \ + "INSERT OR REPLACE INTO users ( %d, \'%s\', \'%s\', \'%s\', %s)", user_id, login, name, firstname, birthdate,class_id #define CHECK_USER(n) \ "SELECT user_id FROM users WHERE login=\'%s\';",n @@ -527,7 +533,7 @@ GList *gcompris_load_menus_db(GList *boards_list) #define MAX_USER_ID \ "SELECT MAX(user_id) FROM users;" -void gcompris_db_save_user(int *user_id, gchar *login, gchar *name, gchar *firstname, gchar *birthday, int class_id) +void gcompris_db_save_user(int *user_id, gchar *login, gchar *name, gchar *firstname, gchar *birthdate, int class_id) { #ifdef USE_SQLITE @@ -595,7 +601,7 @@ void gcompris_db_save_user(int *user_id, gchar *login, gchar *name, gchar *first login, name, firstname, - birthday, + birthdate, class_id)); rc = sqlite3_get_table(gcompris_db, diff --git a/src/gcompris/gcompris_db.h b/src/gcompris/gcompris_db.h index 6a6bee5..f5eb848 100644 --- a/src/gcompris/gcompris_db.h +++ b/src/gcompris/gcompris_db.h @@ -1,6 +1,6 @@ /* gcompris - gcompris_db.h * - * Time-stamp: <2005/06/22 22:46:07 yves> + * Time-stamp: <2005/06/23 17:03:21 yves> * * Copyright (C) 2005 Bruno Coudoin * diff --git a/src/gcompris/profile.h b/src/gcompris/profile.h index e79050d..d30f4e4 100644 --- a/src/gcompris/profile.h +++ b/src/gcompris/profile.h @@ -1,6 +1,6 @@ /* gcompris - profile.h * - * Time-stamp: <2005/06/14 22:16:19 yves> + * Time-stamp: <2005/06/25 14:15:53 yves> * * Copyright (C) 2005 Bruno Coudoin * @@ -22,7 +22,7 @@ /*****************************************************************************/ /* this files describes structures and fucntions for profile management. */ /* GcomprisClass is intended as school class, and defines a partition of */ -/* set uf all users. Each user is in a class and only one. */ +/* set of all users. Each user is in a class and only one. */ /* GcomprisGroup is a subset of class. It's not a partition of the class, */ /* user can be in 1 or more groups. */ /* There is at least one group in a class -- the whole class. */ diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c index 739e899..3772ae8 100644 --- a/src/gcompris/properties.c +++ b/src/gcompris/properties.c @@ -1,6 +1,6 @@ /* gcompris - properties.c * - * Time-stamp: <2005/06/20 23:45:59 yves> + * Time-stamp: <2005/06/22 10:36:03 yves> * * Copyright (C) 2000,2003 Bruno Coudoin * diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h index e9b4c1f..4a4a375 100644 --- a/src/gcompris/properties.h +++ b/src/gcompris/properties.h @@ -1,6 +1,6 @@ /* gcompris - properties.h * - * Time-stamp: <2005/06/20 12:56:57 yves> + * Time-stamp: <2005/06/25 21:08:21 yves> * * Copyright (C) 2000 Bruno Coudoin * @@ -51,11 +51,6 @@ GcomprisProperties *gcompris_properties_new (void); void gcompris_properties_destroy (GcomprisProperties *props); void gcompris_properties_save (GcomprisProperties *props); -void gcompris_properties_enable_board(gchar *boardName); -void gcompris_properties_disable_board(gchar *boardName); -gboolean gcompris_properties_get_board_status(gchar *boardName); -void gcompris_write_boards_status(); - #endif /* Local Variables: */ |