Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--config.h.mingw.in6
-rw-r--r--configure.in15
-rw-r--r--src/gcompris/about.c2
-rw-r--r--src/gcompris/gcompris.c13
-rw-r--r--src/gcompris/properties.c16
-rw-r--r--src/gcompris/properties.h10
7 files changed, 70 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 02f508b..1c76570 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2007-06-09 Bruno coudoin <bruno.coudoin@free.fr>
+ - Added the support for a system configuration file which is
+ under /etc/gcompris.conf on GNU/Linux and in it's root installation
+ directory on Windows.
+ This file if present is loaded after the user one so it overwrite the user
+ properties.
+
+ * config.h.mingw.in:
+ * configure.in:
+ * src/gcompris/about.c: (gc_about_start):
+ * src/gcompris/gcompris.c: (gc_activation_check), (main):
+ * src/gcompris/properties.c: (gc_prop_old_config_migration),
+ (gc_prop_load):
+ * src/gcompris/properties.h:
+
+2007-06-09 Bruno coudoin <bruno.coudoin@free.fr>
+
* boards/sounds/wahoo.wav: removed this sound, suspect origin
* src/boards/paratrooper.c: (next_state):
diff --git a/config.h.mingw.in b/config.h.mingw.in
index 8f5f627..dd4a60a 100644
--- a/config.h.mingw.in
+++ b/config.h.mingw.in
@@ -109,6 +109,9 @@
/* Gcompris locale directory */
#define PACKAGE_LOCALE_DIR "share/locale"
+/* System GCompris config directory */
+#define SYSTEM_CONFIG_DIR .
+
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
@@ -133,3 +136,6 @@
/* SQLITE Database, Profiles are enabled */
#define USE_SQLITE 1
+/* Activation code is disabled */
+/* #define DISABLE_ACTIVATION_CODE 1 */
+
diff --git a/configure.in b/configure.in
index 41d4311..f26ece8 100644
--- a/configure.in
+++ b/configure.in
@@ -322,6 +322,9 @@ if test "x$platform_win32" = "xno" ; then
PYTHON_PLUGIN_DIR="${myprefix}/${DATADIRNAME}/${PACKAGE}/python"
AC_SUBST(PYTHON_PLUGIN_DIR)
+ dnl System GCompris config directory
+ AC_DEFINE_UNQUOTED(SYSTEM_CONFIG_DIR, "/etc", [System GCompris config directory])
+
else
DATADIRNAME="share"
@@ -537,6 +540,18 @@ fi
AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
+dnl disable activation code
+AC_ARG_ENABLE(activation-code,
+ AC_HELP_STRING(
+ [--disable-activation-code],
+ [For Windows version, disable the activation code]),
+ activation_code="$enableval", activation_code="yes")
+
+if test x$activation_code = xno; then
+ AC_DEFINE([DISABLE_ACTIVATION_CODE], 1,[Activation code is disabled])
+fi
+
+
#mypaint
#PKG_CHECK_MODULES(MYPAINT,[
# glib-2.0 >= 2.6.0
diff --git a/src/gcompris/about.c b/src/gcompris/about.c
index 8e308df..9428683 100644
--- a/src/gcompris/about.c
+++ b/src/gcompris/about.c
@@ -201,7 +201,7 @@ void gc_about_start ()
// Copyright
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
- "text", "Copyright 2000-2005 Bruno Coudoin",
+ "text", "Copyright 2000-2007 Bruno Coudoin and Others",
"font", gc_skin_font_content,
"x", (double) BOARDWIDTH/2,
"y", (double) y - 95,
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 51233db..c65cfc7 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -857,6 +857,9 @@ display_activation_dialog()
*/
int gc_activation_check(char *code)
{
+#ifdef DISABLE_ACTIVATION_CODE
+ return 1
+#else
int value = 0;
int i;
char crc1 = 0;
@@ -898,6 +901,7 @@ int gc_activation_check(char *code)
return(1);
else
return(0);
+#endif
}
/* Check the activation code
@@ -1483,7 +1487,14 @@ main (int argc, char *argv[])
}
/* Now we know where our config file is, load the saved config */
- gc_prop_load(properties);
+ gc_prop_old_config_migration(properties);
+ gc_prop_load(properties, GC_PROP_FROM_USER_CONF);
+
+ /* We overwrite the user config with the administrator system config
+ It let the sysadmin to specify a certain set of value that are restaured
+ whatever the user saved
+ */
+ gc_prop_load(properties, GC_PROP_FROM_SYSTEM_CONF);
/* Single instance Check */
lock_file = g_strdup_printf("%s/%s", properties->config_dir, GC_LOCK_FILE);
diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c
index 1d43dce..9b309ae 100644
--- a/src/gcompris/properties.c
+++ b/src/gcompris/properties.c
@@ -188,7 +188,7 @@ gc_prop_new ()
return (tmp);
}
-void old_config_migration(GcomprisProperties *props)
+void gc_prop_old_config_migration(GcomprisProperties *props)
{
char *old;
char *new;
@@ -336,7 +336,7 @@ void old_config_migration(GcomprisProperties *props)
void
-gc_prop_load (GcomprisProperties *props)
+gc_prop_load (GcomprisProperties *props, GCPropSourceConf source_conf)
{
char *config_file;
GScanner *scanner;
@@ -346,9 +346,15 @@ gc_prop_load (GcomprisProperties *props)
const gchar *locale;
#endif
- config_file = g_strconcat(props->config_dir, "/", gc_prop_config_file_get(), NULL);
-
- old_config_migration(props);
+ switch(source_conf)
+ {
+ case GC_PROP_FROM_SYSTEM_CONF:
+ config_file = g_strconcat(SYSTEM_CONFIG_DIR, "/", gc_prop_config_file_get(), NULL);
+ break;
+ case GC_PROP_FROM_USER_CONF:
+ config_file = g_strconcat(props->config_dir, "/", gc_prop_config_file_get(), NULL);
+ break;
+ }
if(g_file_get_contents(config_file,
&content,
diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h
index 390da9a..6be8d70 100644
--- a/src/gcompris/properties.h
+++ b/src/gcompris/properties.h
@@ -24,6 +24,12 @@
#include "profile.h"
+/** Source config file for initialization */
+typedef enum {
+ GC_PROP_FROM_SYSTEM_CONF,
+ GC_PROP_FROM_USER_CONF
+} GCPropSourceConf;
+
typedef struct {
gint music;
gint fx;
@@ -68,10 +74,12 @@ typedef struct {
GcomprisProperties *gc_prop_get (void);
GcomprisProperties *gc_prop_new (void);
void gc_prop_destroy (GcomprisProperties *props);
-void gc_prop_load (GcomprisProperties *props);
+void gc_prop_load (GcomprisProperties *props, GCPropSourceConf);
void gc_prop_save (GcomprisProperties *props);
void gc_prop_activate (GcomprisProperties *props);
gchar *gc_prop_default_database_name_get (gchar *config_dir);
int gc_setenv (const char * name, const char * value);
+
+void gc_prop_old_config_migration(GcomprisProperties *props);
#endif