Commit 2cba2a20 authored by Bruno Coudoin's avatar Bruno Coudoin

- Added support for relocation using http://autopackage.org/docs/binreloc/

	  (Needed to create an autopackage installer)
	  Now GCompris will detect at runtime where it is installed and find it's data.
	  As a fallback, default set at compile time are used (like before).
	  To disable is, use sh configure --disable-binreloc
	  Very usefull for developers, you can now run gcompris from within it's source
	  code without even installing it !. The new code detect that and set the data
	  dir accordingly.
	  Warning, developers must no more use the PACKAGE_DATA_DIR define but must get the
	  data dir always from the property object like this:
	  GcomprisProperties *properties = gcompris_get_properties();
	  properties->package_xxx_dir contains the root data directory, like:
	  package_data_dir         = /usr/local/share/gcompris/boards
	  package_locale_dir       = /usr/local/share/locale
	  package_plugin_dir       = /usr/local/lib/gcompris
	  package_python_plugin_dir= /usr/local/share/gcompris/python
parent 83d9f62c
2006-08-13 Bruno coudoin <bruno.coudoin@free.fr>
- Added support for relocation using http://autopackage.org/docs/binreloc/
(Needed to create an autopackage installer)
Now GCompris will detect at runtime where it is installed and find it's data.
As a fallback, default set at compile time are used (like before).
To disable is, use sh configure --disable-binreloc
Very usefull for developers, you can now run gcompris from within it's source
code without even installing it !. The new code detect that and set the data
dir accordingly.
Warning, developers must no more use the PACKAGE_DATA_DIR define but must get the
data dir always from the property object like this:
GcomprisProperties *properties = gcompris_get_properties();
properties->package_xxx_dir contains the root data directory, like:
package_data_dir = /usr/local/share/gcompris/boards
package_locale_dir = /usr/local/share/locale
package_plugin_dir = /usr/local/lib/gcompris
package_python_plugin_dir= /usr/local/share/gcompris/python
* acinclude.m4:
* config.h.mingw:
* configure.in:
* docs/C/Makefile.am:
* gcompris.desktop.in:
* gcompris.spec.in:
* po/lt.po:
* src/boards/advanced_colors.c: (init_xml):
* src/boards/clickgame.c: (clickgame_start), (load_random_pixmap):
* src/boards/draw.c: (tool_event):
* src/boards/gtans.c:
* src/boards/imageid.c: (init_xml):
* src/boards/missingletter.c: (init_xml):
* src/boards/py-mod-gcompris.c: (python_gcompris_module_init):
* src/boards/python.c: (pythonboard_init), (pythonboard_start),
(pythonboard_config_start):
* src/boards/python/administration.py:
* src/boards/python/ballcatch.py:
* src/boards/read_colors.c: (init_xml):
* src/boards/reading.c: (get_wordfile):
* src/boards/shapegame.c: (start_board), (shapegame_next_level):
* src/boards/wordsgame.c: (get_wordfile):
* src/gcompris/Makefile.am:
* src/gcompris/binreloc.c: (_br_find_exe),
(_br_find_exe_for_symbol), (gbr_init), (gbr_init_lib),
(set_gerror), (gbr_find_exe), (gbr_find_exe_dir),
(gbr_find_prefix), (gbr_find_bin_dir), (gbr_find_sbin_dir),
(gbr_find_data_dir), (gbr_find_locale_dir), (gbr_find_lib_dir),
(gbr_find_libexec_dir), (gbr_find_etc_dir):
* src/gcompris/binreloc.h:
* src/gcompris/board.c: (board_check_file):
* src/gcompris/board_config.c: (gcompris_get_locales_list):
* src/gcompris/config.c: (gcompris_config_start):
* src/gcompris/file_selector.c: (gcompris_load_mime_types):
* src/gcompris/gameutil.c: (gcompris_read_xml_file):
* src/gcompris/gcompris.c: (setup_window), (load_properties),
(gcompris_init):
* src/gcompris/images_selector.c: (parseImage):
* src/gcompris/properties.c: (get_gcompris_conf_name),
(gcompris_properties_new):
* src/gcompris/properties.h:
* src/gcompris/skin.c: (gcompris_image_to_skin), (skin_xml_load),
(gcompris_skin_load):
* src/gcompris/soundutil.c: (scheduler_bgnd):
* src/gcompris/timer.c: (gcompris_timer_display),
(timer_increment):
2006-08-12 Bruno coudoin <bruno.coudoin@free.fr>
- changed transformation of xml.in files to xml files. Now the translations
......
......@@ -4,7 +4,7 @@
# Description: Top Makefile for win32 (mingw) port of GCompris
#
VERSION = "8.0BETA2"
VERSION = "8.0BETA3"
pkgdatadir = gcompris
......
......@@ -92,3 +92,81 @@ case " $CFLAGS " in
fi
;;
esac])
# Check for binary relocation support.
# Written by Hongli Lai
# http://autopackage.org/
AC_DEFUN([AM_BINRELOC],
[
AC_ARG_ENABLE(binreloc,
[ --enable-binreloc compile with binary relocation support
(default=enable when available)],
enable_binreloc=$enableval,enable_binreloc=auto)
AC_ARG_ENABLE(binreloc-threads,
[ --enable-binreloc-threads compile binary relocation with threads support
(default=yes)],
enable_binreloc_threads=$enableval,enable_binreloc_threads=yes)
BINRELOC_CFLAGS=
BINRELOC_LIBS=
if test "x$enable_binreloc" = "xauto"; then
AC_CHECK_FILE([/proc/self/maps])
AC_CACHE_CHECK([whether everything is installed to the same prefix],
[br_cv_valid_prefixes], [
if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
"$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
"$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
then
br_cv_valid_prefixes=yes
else
br_cv_valid_prefixes=no
fi
])
fi
AC_CACHE_CHECK([whether binary relocation support should be enabled],
[br_cv_binreloc],
[if test "x$enable_binreloc" = "xyes"; then
br_cv_binreloc=yes
elif test "x$enable_binreloc" = "xauto"; then
if test "x$br_cv_valid_prefixes" = "xyes" -a \
"x$ac_cv_file__proc_self_maps" = "xyes"; then
br_cv_binreloc=yes
else
br_cv_binreloc=no
fi
else
br_cv_binreloc=no
fi])
if test "x$br_cv_binreloc" = "xyes"; then
BINRELOC_CFLAGS="-DENABLE_BINRELOC"
AC_DEFINE(ENABLE_BINRELOC,,[Use binary relocation?])
if test "x$enable_binreloc_threads" = "xyes"; then
AC_CHECK_LIB([pthread], [pthread_getspecific])
fi
AC_CACHE_CHECK([whether binary relocation should use threads],
[br_cv_binreloc_threads],
[if test "x$enable_binreloc_threads" = "xyes"; then
if test "x$ac_cv_lib_pthread_pthread_getspecific" = "xyes"; then
br_cv_binreloc_threads=yes
else
br_cv_binreloc_threads=no
fi
else
br_cv_binreloc_threads=no
fi])
if test "x$br_cv_binreloc_threads" = "xyes"; then
BINRELOC_LIBS="-lpthread"
AC_DEFINE(BR_PTHREAD,1,[Include pthread support for binary relocation?])
else
BINRELOC_CFLAGS="$BINRELOC_CFLAGS -DBR_PTHREADS=0"
AC_DEFINE(BR_PTHREAD,0,[Include pthread support for binary relocation?])
fi
fi
AC_SUBST(BINRELOC_CFLAGS)
AC_SUBST(BINRELOC_LIBS)
])
......@@ -5,13 +5,12 @@ ShortName: gcompris
SoftwareVersion: @VERSION@
DisplayName: GCompris Educational software
RootName: @gcompris.net/gcompris:$SOFTWAREVERSION
Summary: GCompris is an educational software which propose different activities to children from 2 to 10 years old.
Summary: GCompris Educational suite for kids
Maintainer: Bruno Coudoin <bruno.coudoin@free.fr>
Packager: Bruno Coudoin <bruno.coudoin@free.fr>
PackageVersion: 1
CPUArchitectures: x86
AutopackageTarget: 1.0
Type: Application
License: GNU General Public License (GPL)
[Description]
......@@ -50,6 +49,7 @@ echo '*' | import
# See http://www.autopackage.org/api/ for details
installExe bin/*
installLib lib/*.so.*
copyFiles lib/gcompris/* "$PREFIX/lib/gcompris"
installMan 6 man/man6/*
installData share/gcompris
installIcon share/pixmaps/gcompris.*
......
......@@ -16,8 +16,8 @@
/* Gettext package name */
#define GETTEXT_PACKAGE "gcompris"
/* Gnome icons directory */
#define GNOME_ICONDIR "share/pixmaps"
/* System icons directory */
#define SYSTEM_ICONDIR "share/pixmaps"
/* Defines where GNU Chess resides on the system */
#define GNUCHESS "gnuchess.exe"
......
......@@ -2,10 +2,14 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gcompris/gcompris.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(gcompris, 8.0BETA2)
AM_INIT_AUTOMAKE(gcompris, 8.0BETA3)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
# Provide relocatable API from autopackage
# From http://autopackage.org/docs/binreloc/
AM_BINRELOC
# Making releases:
# LIBGCOMPRIS_MICRO_VERSION += 1;
# LIBGCOMPRIS_INTERFACE_AGE += 1;
......@@ -206,38 +210,31 @@ if test x"$native_win32" = xyes; then
fi
fi
dnl Set PACKAGE_LOCALE_DIR in config.h.
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${myprefix}/${DATADIRNAME}/locale", [Gcompris locale directory])
dnl
dnl === DIRECTORY DEFINITIONS ===
dnl
dnl Set PACKAGE_SOUNDS_DIR
PACKAGE_SOUNDS_DIR="sounds"
AC_SUBST(PACKAGE_SOUNDS_DIR)
AC_DEFINE_UNQUOTED(PACKAGE_SOUNDS_DIR, "${myprefix}/${DATADIRNAME}/${PACKAGE}/sounds", [Gcompris sounds directory])
dnl Set PACKAGE_LOCALE_DIR in config.h.
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${myprefix}/${DATADIRNAME}/locale", [GCompris locale directory])
dnl Set PACKAGE_DATA_DIR
PACKAGE_DATA_DIR="boards"
AC_SUBST(PACKAGE_DATA_DIR)
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${myprefix}/${DATADIRNAME}/${PACKAGE}/boards", [Gcompris data directory])
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${myprefix}/${DATADIRNAME}", [GCompris data directory])
dnl Set PACKAGE_HELP_DIR
AC_DEFINE_UNQUOTED(PACKAGE_HELP_DIR, "${myprefix}/${DATADIRNAME}/gnome/help/${PACKAGE}", [Gcompris help directory])
PACKAGE_HELP_DIR="${myprefix}/${DATADIRNAME}/gnome/help/${PACKAGE}"
PACKAGE_HELP_DIR="${myprefix}/${DATADIRNAME}/${PACKAGE}/help"
AC_SUBST(PACKAGE_HELP_DIR)
dnl Plugin Directory
my_libdir=`eval echo "${libdir}/gcompris"`
AC_DEFINE_UNQUOTED(PLUGIN_DIR, "${my_libdir}", [Gcompris plugins directory])
plugindir=$libdir/gcompris
AC_SUBST(plugindir)
dnl Python plugin Directory
AC_DEFINE_UNQUOTED(PYTHON_PLUGIN_DIR, "${myprefix}/${DATADIRNAME}/${PACKAGE}/python", [Gcompris python plugins directory])
PYTHON_PLUGIN_DIR="${myprefix}/${DATADIRNAME}/${PACKAGE}/python"
AC_SUBST(PYTHON_PLUGIN_DIR)
AC_DEFINE_UNQUOTED(GNOME_ICONDIR, "${myprefix}/${DATADIRNAME}/pixmaps", [Gnome icons directory])
dnl Test for gnuchess
AC_PATH_PROG(GNUCHESS, gnuchess,no,[/usr/bin:/usr/games:/usr/local/bin:$PATH])
......
......@@ -16,11 +16,12 @@ all: $(doc)
info_TEXINFOS = gcompris.texi
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(gcompris_helpdir)
$(INSTALL_DATA) gcompris.html $(DESTDIR)$(gcompris_helpdir)
$(INSTALL_DATA) $(srcdir)/overview.jpg $(DESTDIR)$(gcompris_helpdir)
$(INSTALL_DATA) $(srcdir)/topic.dat $(DESTDIR)$(gcompris_helpdir)
# No more install the documentation, it's not accurate enough
#install-data-local:
# $(mkinstalldirs) $(DESTDIR)$(gcompris_helpdir)
# $(INSTALL_DATA) gcompris.html $(DESTDIR)$(gcompris_helpdir)
# $(INSTALL_DATA) $(srcdir)/overview.jpg $(DESTDIR)$(gcompris_helpdir)
# $(INSTALL_DATA) $(srcdir)/topic.dat $(DESTDIR)$(gcompris_helpdir)
%.html: %.texi
texi2html -monolithic $<
......
[Desktop Entry]
Encoding=UTF-8
_Name=Educational suite gcompris
_GenericName=Multiple activities for kids
_Name=Educational suite GCompris
_GenericName=Multi-activity educational game
_Comment=Educational game for ages 2 to 10
Exec=gcompris
Icon=gcompris.png
......
......@@ -278,7 +278,6 @@ rm -rf $RPM_BUILD_ROOT
%dir %{prefix}/share/gcompris/python
%{prefix}/share/gcompris/python/*
%{prefix}/share/applications/*
%{prefix}/share/gnome/help/*
%{prefix}/share/locale/*/*/*
%{prefix}/share/pixmaps/*.png
%_infodir/*
......
......@@ -445,10 +445,16 @@ static void highlight_selected(int c) {
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
filename = g_strdup_printf("%s/%s/board%d.xml", PACKAGE_DATA_DIR, gcomprisBoard->boarddir,
filename = g_strdup_printf("%s/%s/board%d.xml",
properties->package_data_dir,
gcomprisBoard->boarddir,
gcomprisBoard->level);
g_warning("filename = %s %s %s\n", filename,PACKAGE_DATA_DIR,gcomprisBoard->boarddir);
g_debug("filename = %s %s %s\n",
properties->package_data_dir,
filename,
gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
......
/* gcompris - clickgame.c
*
* Time-stamp: <2006/08/12 03:08:39 bruno>
* Time-stamp: <2006/08/13 17:56:34 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -167,10 +167,11 @@ static void clickgame_start (GcomprisBoard *agcomprisBoard)
if(agcomprisBoard!=NULL)
{
GcomprisProperties *properties = gcompris_get_properties();
gcomprisBoard = agcomprisBoard;
/* Load the Pixpmaps directory file names */
filename = g_strdup_printf("%s/%s", PACKAGE_DATA_DIR, gcomprisBoard->boarddir);
filename = g_strdup_printf("%s/%s", properties->package_data_dir, gcomprisBoard->boarddir);
dir = g_dir_open(filename, 0, NULL);
if (!dir)
......@@ -709,6 +710,7 @@ setup_item(FishItem *fishitem)
*/
static void load_random_pixmap()
{
GcomprisProperties *properties = gcompris_get_properties();
GdkPixbuf *pixmap;
int i, j;
gchar *str = NULL;
......@@ -734,7 +736,7 @@ static void load_random_pixmap()
sprintf(numstr, "%d", j++);
str[strlen(str)-5]=numstr[0];
filename = g_strdup_printf("%s/%s", PACKAGE_DATA_DIR, str);
filename = g_strdup_printf("%s/%s", properties->package_data_dir, str);
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
......
......@@ -30,7 +30,6 @@
#include "gcompris/pixbuf_util.h"
#define SOUNDLISTFILE PACKAGE
#define IMG_DATA_SET PACKAGE_DATA_DIR "/dataset"
#define FILE_SELECTOR_ROOT "drawings"
/* Represent the drawing area */
......@@ -888,7 +887,12 @@ tool_event(GnomeCanvasItem *item, GdkEvent *event, gint tool)
return TRUE;
break;
case TOOL_IMAGE:
gcompris_images_selector_start(gcomprisBoard, IMG_DATA_SET, image_selected);
{
GcomprisProperties *properties = gcompris_get_properties();
gchar *dir = g_strconcat(properties->package_data_dir, "/dataset", NULL);
gcompris_images_selector_start(gcomprisBoard, dir, image_selected);
g_free(dir);
}
break;
case TOOL_RAISE:
case TOOL_LOWER:
......
......@@ -40,26 +40,6 @@
void taninitstart(void);
/********************************/
/* int main (int argc, char *argv[]) */
/* { */
/* textdomain ("gtans"); */
/* gtk_set_locale (); */
/* gtk_init (&argc, &argv); */
/* /\* */
/* add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps"); */
/* add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); */
/* *\/ */
/* taninitstart(); */
/* gtk_main (); */
/* return 0; */
/* } */
/* GCompris */
static void start_board (GcomprisBoard *agcomprisBoard);
......
......@@ -540,9 +540,10 @@ static void highlight_selected(GnomeCanvasItem * item) {
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", PACKAGE_DATA_DIR, gcomprisBoard->boarddir);
g_warning("filename = %s %s %s\n", filename,PACKAGE_DATA_DIR,gcomprisBoard->boarddir);
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
g_debug("filename = %s %s %s\n", filename, properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
......
......@@ -567,8 +567,9 @@ static void dump_xml() {
/* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", PACKAGE_DATA_DIR, gcomprisBoard->boarddir);
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
g_free(filename);
......
......@@ -1740,6 +1740,7 @@ void python_gcompris_module_init(void)
/* Some non gcompris.h constants. */
GcomprisProperties *properties = gcompris_get_properties();
PyModule_AddStringConstant(gcomprisModule, "DATA_DIR", properties->package_data_dir);
PyModule_AddStringConstant(gcomprisModule, "PYTHON_PLUGIN_DIR", properties->package_python_plugin_dir);
/* GetText constants. */
PyModule_AddStringConstant(gcomprisModule, "GETTEXT_PACKAGE", GETTEXT_PACKAGE);
......
......@@ -125,7 +125,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
PyObject* module_dict;
PyObject* py_boardclass;
GcomprisProperties *properties = gcompris_get_properties();
GcomprisProperties *properties = gcompris_get_properties();
if (pythonboard_is_ready)
return ;
......@@ -146,14 +146,14 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
pythonboard_is_ready = FALSE;
} else {
/* Add the python plugins dir to the python's search path */
execstr = g_strdup_printf("import sys; sys.path.append('%s')",PYTHON_PLUGIN_DIR);
execstr = g_strdup_printf("import sys; sys.path.append('%s')",properties->package_python_plugin_dir);
#ifndef DISABLE_USER_PLUGIN_DIR
userplugindir = g_strconcat(g_get_home_dir(), "/.gcompris/Plugins/", NULL);
execstr = g_strdup_printf("import sys; sys.path.append('%s/python'); sys.path.append('%s')",
userplugindir, PYTHON_PLUGIN_DIR);
userplugindir, properties->package_python_plugin_dir);
g_free(userplugindir);
#else
execstr = g_strdup_printf("import sys; sys.path.append('%s')",PYTHON_PLUGIN_DIR );
execstr = g_strdup_printf("import sys; sys.path.append('%s')",properties->package_python_plugin_dir );
#endif
if(PyRun_SimpleString(execstr)!=0){
pythonboard_is_ready = FALSE;
......@@ -207,10 +207,10 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
g_warning("board_dir: %s package_data_dir %s",
board->board_dir,
properties->package_data_dir);
properties->package_python_plugin_dir);
if (strcmp(board->board_dir, properties->package_data_dir)!=0){
boarddir = g_strdup_printf("sys.path.append('%s/../python/')", board->board_dir);
if (strcmp(board->board_dir, properties->package_python_plugin_dir)!=0){
boarddir = g_strdup_printf("sys.path.append('%s/')", board->board_dir);
PyRun_SimpleString(boarddir);
g_free(boarddir);
......@@ -303,9 +303,9 @@ pythonboard_start (GcomprisBoard *agcomprisBoard){
userplugindir = g_strconcat(g_get_home_dir(), "/.gcompris/Plugins/", NULL);
boarddir = g_strdup_printf("import sys; sys.path.append('%s/python'); sys.path.append('%s')",
userplugindir,
PYTHON_PLUGIN_DIR);
properties->package_python_plugin_dir);
#else
boarddir = g_strdup_printf("import sys; sys.path.append('%s')",PYTHON_PLUGIN_DIR );
boarddir = g_strdup_printf("import sys; sys.path.append('%s')",properties->package_python_plugin_dir );
#endif
PyRun_SimpleString(boarddir);
......@@ -556,7 +556,9 @@ static gboolean python_run_by_config = FALSE;
static void
pythonboard_config_start (GcomprisBoard *agcomprisBoard,
GcomprisProfile *aProfile
){
)
{
GcomprisProperties *properties = gcompris_get_properties();
PyObject* py_function_result;
PyObject* module_dict;
PyObject* py_boardclass;
......@@ -596,10 +598,10 @@ pythonboard_config_start (GcomprisBoard *agcomprisBoard,
userplugindir = g_strconcat(g_get_home_dir(), "/.gcompris/Plugins/", NULL);
boarddir = g_strdup_printf("import sys; sys.path.append('%s/python'); sys.path.append('%s'); sys.path.append('%s')",
userplugindir,
PYTHON_PLUGIN_DIR,
properties->package_python_plugin_dir,
gcomprisBoard_config->board_dir);
#else
boarddir = g_strdup_printf("import sys; sys.path.append('%s')",PYTHON_PLUGIN_DIR );
boarddir = g_strdup_printf("import sys; sys.path.append('%s')", properties->package_python_plugin_dir );
#endif
PyRun_SimpleString(boarddir);
......
......@@ -78,7 +78,7 @@ class Gcompris_administration:
import glob
m_list = glob.glob('admin/module_*.py')
if m_list == []:
m_list = glob.glob(gcompris.DATA_DIR+'/../python/admin/module_*.py')
m_list = glob.glob(gcompris.PYTHON_PLUGIN_DIR+'/admin/module_*.py')
for file in m_list:
m_name = file.split('/')[-1].split('.')[0].split('_')[1]
list_modules.append(m_name)
......
......@@ -109,14 +109,14 @@ class Gcompris_ballcatch:
# The basic tick for object moves
self.timerinc = 1000
self.timer_inc = gtk.timeout_add(self.timerinc, self.timer_inc_display)
self.counter_left = 0
self.counter_right = 0
self.left_continue = True
self.right_continue = True
self.counter_left = 0
self.counter_right = 0
self.timer_inc = gtk.timeout_add(self.timerinc, self.timer_inc_display)
print("Gcompris_ballcatch start.")
......
......@@ -407,9 +407,10 @@ static void highlight_selected(int c) {
* ==================================== */
static void init_xml()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
filename = g_strdup_printf("%s/%s/board1.xml", PACKAGE_DATA_DIR, gcomprisBoard->boarddir);
g_warning("filename = %s %s %s\n", filename,PACKAGE_DATA_DIR,gcomprisBoard->boarddir);
filename = g_strdup_printf("%s/%s/board1.xml", properties->package_data_dir, gcomprisBoard->boarddir);
g_warning("filename = %s %s %s\n", filename, properties->package_data_dir, gcomprisBoard->boarddir);
assert(g_file_test(filename, G_FILE_TEST_EXISTS));
assert(read_xml_file(filename)== TRUE);
......
/* gcompris - reading.c
*
* Time-stamp: <2006/08/11 18:29:19 bruno>
* Time-stamp: <2006/08/13 18:03:47 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -728,24 +728,24 @@ item_event_valid(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
static FILE *get_wordfile(const char *locale)
{
GcomprisProperties *properties = gcompris_get_properties();
gchar *filename;
FILE *wordsfd = NULL;
/* First Try to find a file matching the level and the locale */
filename = g_strdup_printf("%s%s%d.%.2s",
PACKAGE_DATA_DIR, "/wordsgame/wordslevel",
properties->package_data_dir, "/wordsgame/wordslevel",
gcomprisBoard->level, locale);
// g_message("Trying to open file %s ", filename);
wordsfd = fopen (filename, "r");
if(wordsfd==NULL)
{
GcomprisProperties *properties = gcompris_get_properties();
g_free(filename);
/* Second Try to find a file matching the 'max' and the locale */
filename = g_strdup_printf("%s%s%.2s",
PACKAGE_DATA_DIR, "/wordsgame/wordslevelmax.",
properties->package_data_dir, "/wordsgame/wordslevelmax.",
locale);
// g_message("Trying to open file %s ", filename);
wordsfd = fopen (filename, "r");
}
......
/* gcompris - shapegame.c
*
* Time-stamp: <2006/08/12 03:05:15 bruno>
* Time-stamp: <2006/08/13 18:11:02 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -235,7 +235,8 @@ static void start_board (GcomprisBoard *agcomprisBoard)
if(agcomprisBoard!=NULL)
{
gcomprisBoard=agcomprisBoard;
GcomprisProperties *properties = gcompris_get_properties();
gcomprisBoard = agcomprisBoard;
/* disable im_context */
gcomprisBoard->disable_im_context = TRUE;
......@@ -246,14 +247,14 @@ static void start_board (GcomprisBoard *agcomprisBoard)
/* Calculate the maxlevel based on the available data file for this board */
gcomprisBoard->maxlevel=1;
filename = g_strdup_printf("%s/%s/board%d_0.xml",
PACKAGE_DATA_DIR, gcomprisBoard->boarddir,
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->maxlevel);
while(g_file_test(filename, G_FILE_TEST_EXISTS))
{
gcomprisBoard->maxlevel++;
filename = g_strdup_printf("%s/%s/board%d_0.xml",
PACKAGE_DATA_DIR, gcomprisBoard->boarddir,
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->maxlevel);
}
gcomprisBoard->maxlevel--;
......@@ -508,6 +509,7 @@ static gboolean increment_sublevel()
/* set initial values for the next level */
static void shapegame_next_level()
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
gamewon = FALSE;
......@@ -519,10 +521,8 @@ static void shapegame_next_level()
shapegame_init_canvas(gnome_canvas_root(gcomprisBoard->canvas));
// gcompris_set_background(GNOME_CANVAS_GROUP(shape_background_item), "gcompris/gcompris-shapebg.jpg");
filename = g_strdup_printf("%s/%s/board%d_%d.xml",
PACKAGE_DATA_DIR, gcomprisBoard->boarddir,
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->level, gcomprisBoard->sublevel);
......@@ -536,7 +536,7 @@ static void shapegame_next_level()
g_free(filename);
filename = g_strdup_printf("%s/%s/board%d_%d.xml",
PACKAGE_DATA_DIR, gcomprisBoard->boarddir,
properties->package_data_dir, gcomprisBoard->boarddir,
gcomprisBoard->level, gcomprisBoard->sublevel);
}
read_xml_file(filename);
......
/* gcompris - wordsgame.c
*
* Time-stamp: <2006/08/12 03:12:06 bruno>
* Time-stamp: <2006/08/13 18:06:23 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -726,12 +726,13 @@ static void player_loose()
static FILE *get_wordfile(const char *locale)
{
GcomprisProperties *properties = gcompris_get_properties();
char *filename;
FILE *wordsfd = NULL;
/* First Try to find a file matching the level and the locale */
filename = g_strdup_printf("%s%s%d.%.2s",
PACKAGE_DATA_DIR, "/wordsgame/wordslevel",
properties->package_data_dir, "/wordsgame/wordslevel",
gcomprisBoard->level, locale);
g_message("Trying to open file %s ", filename);
wordsfd = fopen (filename, "r");
......@@ -741,7 +742,7 @@ static FILE *get_wordfile(const char *locale)
g_free(filename);
/* Second Try to find a file matching the 'max' and the locale */
filename = g_strdup_printf("%s%s%.2s",
PACKAGE_DATA_DIR, "/wordsgame/wordslevelmax.",
properties->package_data_dir, "/wordsgame/wordslevelmax.",
locale);
g_message("Trying to open file %s ", filename);
......
......@@ -87,6 +87,7 @@ libgcomprisincludedir = $(includedir)/libgcompris-1.0/libgcompris
libgcomprisinclude_HEADERS = \
about.h \
anim.h \
binreloc.h \
bonus.h \
cursor.h \
gameutil.h \
......@@ -114,6 +115,7 @@ libgcompris_1_la_SOURCES = \
$(libgcomprisinclude_HEADERS) \
gcompris.c \
gameutil.c \
binreloc.c \
gc_net.c \
properties.c \
bar.c \
......
/*
* BinReloc - a library for creating relocatable executables
* Written by: Hongli Lai <h.lai@chello.nl>
* http://autopackage.org/
*
* This source code is public domain. You can relicense this code
* under whatever license you want.
*
* See http://autopackage.org/docs/binreloc/ for
* more information and how to use this.
*/
#ifndef __BINRELOC_C__
#define __BINRELOC_C__
#include <config.h>
#ifdef ENABLE_BINRELOC
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif /* ENABLE_BINRELOC */
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include "binreloc.h"
G_BEGIN_DECLS
/** @internal
* Find the canonical filename of the executable. Returns the filename
* (which must be freed) or NULL on error. If the parameter 'error' is
* not NULL, the error code will be stored there, if an error occured.
*/
static char *
_br_find_exe (GbrInitError *error)
{
#ifndef ENABLE_BINRELOC
if (error)
*error = GBR_INIT_ERROR_DISABLED;
return NULL;
#else
char *path, *path2, *line, *result;
size_t buf_size;