Commit 65cfab5d authored by Yves Combe's avatar Yves Combe
Browse files

divide gcompris user's files into .gcompris/shared and ./gcompris/users

mv db default name to .gcompris/shared/profils/gcompris_sqlite.db
add commend line options with all that.
parent 15224ee0
2005-08-25 Yves Combe,,, <yves@ycombe.net>
divide gcompris user's files into .gcompris/shared and ./gcompris/users
mv db default name to .gcompris/shared/profils/gcompris_sqlite.db
add commend line options with all that.
* po/Makefile.in.in:
* src/gcompris/gcompris.c: (gcompris_init):
* src/gcompris/properties.c: (get_default_database_name),
(gcompris_properties_new):
* src/gcompris/properties.h:
2005-08-24 bruno coudoin,,, <set EMAIL_ADDRESS environment variable>
* boards/fifteen.xml.in: Changed the difficulty from 1 to 5
......
......@@ -11,6 +11,11 @@
#
# - Modified by jacob berkman <jacob@ximian.com> to install
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
#
# - Modified by Rodney Dawes <dobey@novell.com> for use with intltool
#
# We have the following line for use by intltoolize:
# INTLTOOL_MAKEFILE
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
......@@ -27,13 +32,13 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
subdir = po
install_sh = @install_sh@
mkdir_p = @mkdir_p@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
INSTALL = @INSTALL@
......@@ -61,7 +66,8 @@ SOURCES =
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
$(POFILES) $(GMOFILES) $(SOURCES)
$(POFILES) $(SOURCES)
EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
POTFILES = \
......@@ -77,7 +83,7 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(top_builddir)/po/$(GETTEXT_PACKAGE).pot -o $*pox
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
......@@ -174,7 +180,7 @@ uninstall:
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
check: all
check: all $(GETTEXT_PACKAGE).pot
dvi info tags TAGS ID:
......@@ -186,16 +192,21 @@ mostlyclean:
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
rm -f Makefile Makefile.in POTFILES
rm -f *.mo *.msg *.cat *.cat.m $(GMOFILES)
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
rm -f Makefile.in.in
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
dist distdir: $(DISTFILES) $(GETTEXT_PACKAGE).pot
dist distdir: $(DISTFILES)
dists="$(DISTFILES)"; \
extra_dists="$(EXTRA_DISTFILES)"; \
for file in $$extra_dists; do \
test -f $$file && dists="$$dists $$file"; \
done; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
......@@ -232,17 +243,13 @@ update-po: Makefile
# and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
( posrcprefix='$(top_srcdir)/'; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' \
-e "s/^\[.*\] +//" \
-e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& (sed -e '/^#/d' \
-e 's/^[[].*] *//' \
-e '/^[ ]*$$/d' \
-e "s@^@ $$posrcprefix@" $(srcdir)/$@.in \
| sed -e '$$!s/$$/ \\/') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
......
......@@ -90,6 +90,8 @@ static int popt_create_db = FALSE;
static int popt_reread_menu = FALSE;
static char *popt_profile = NULL;
static int *popt_profile_list = FALSE;
static char *popt_shared_dir = NULL;
static char *popt_users_dir = NULL;
GTimer *chronometer;
......@@ -132,6 +134,10 @@ static struct poptOption options[] = {
N_("Set the profile to use. Use 'gcompris -a' to create profiles"), NULL},
{"profile-list",'\0', POPT_ARG_NONE, &popt_profile_list, 0,
N_("List all availaible profiles. Use 'gcompris -a' to create profiles"), NULL},
{"shared-dir",'\0', POPT_ARG_STRING, &popt_shared_dir, 0,
N_("SHDIR Shared directory emplacement. For profiles and boards configuration data. [$HOME/.gcompris/shared]"), NULL},
{"users-dir",'\0', POPT_ARG_STRING, &popt_users_dir, 0,
N_("USERSDIR Users directory emplacement. [$HOME/.gcompris/users] "), NULL},
#ifndef WIN32 /* Not supported on windows */
POPT_AUTOHELP
#endif
......@@ -1065,6 +1071,38 @@ gcompris_init (int argc, char *argv[])
}
}
if (popt_users_dir){
if ((!g_file_test(popt_users_dir, G_FILE_TEST_IS_DIR)) ||
(access(popt_users_dir, popt_administration? R_OK : W_OK ) == -1)){
g_warning("%s does not exists or is not %s ", popt_users_dir,
popt_administration? "readable" : "writable");
exit(0);
} else {
g_warning("Using %s as users directory.", popt_users_dir);
properties->users_dir = g_strdup(popt_users_dir);
}
}
if (popt_shared_dir){
if ((!g_file_test(popt_shared_dir, G_FILE_TEST_IS_DIR)) ||
(access(popt_shared_dir, popt_administration? W_OK : R_OK ) == -1)){
g_warning("%s does not exists or is not %s", popt_shared_dir,
popt_administration? "writable" : "readable" );
exit(0);
}
else {
g_warning("Using %s as shared directory.", popt_shared_dir);
properties->shared_dir = g_strdup(popt_shared_dir);
}
}
/* shared_dir initialised, now we can set the default */
properties->database = get_default_database_name ( properties->shared_dir );
printf( " Infos: %s %s %s \n",
properties->shared_dir,
properties->users_dir,
properties->database);
if (popt_database){
if (g_file_test(popt_database, G_FILE_TEST_EXISTS)) {
if (access(popt_database,R_OK)==-1){
......@@ -1072,7 +1110,7 @@ gcompris_init (int argc, char *argv[])
exit(0);
} else {
g_warning("Using %s as database", popt_database);
properties->database = g_strdup(popt_database);
properties->database = g_strdup(popt_database);
}
} else if (popt_create_db) {
gchar *dirname = g_path_get_dirname (popt_database);
......@@ -1176,6 +1214,7 @@ gcompris_init (int argc, char *argv[])
gtk_main ();
return 0;
}
/* Local Variables: */
......
/* gcompris - properties.c
*
* Time-stamp: <2005/08/02 20:41:57 bruno>
* Time-stamp: <2005/08/25 12:47:50 yves>
*
* Copyright (C) 2000,2003 Bruno Coudoin
*
......@@ -122,9 +122,13 @@ gchar *get_gcompris_conf_name()
#define DEFAULT_DATABASE "gcompris_sqlite.db"
#define PROFILES_ROOT "profiles"
gchar *get_default_database_name ()
gchar *get_default_database_name (gchar *shared_dir)
{
return g_strconcat(get_gcompris_user_root_directory(), "/", PROFILES_ROOT, "/", DEFAULT_DATABASE, NULL);
gchar *dir_base = g_strconcat( shared_dir, "/", PROFILES_ROOT, NULL);
create_rootdir(dir_base);
g_free(dir_base);
return g_strconcat( shared_dir, "/", PROFILES_ROOT, "/", DEFAULT_DATABASE, NULL);
}
GcomprisProperties *gcompris_properties_new ()
......@@ -155,14 +159,22 @@ GcomprisProperties *gcompris_properties_new ()
tmp->package_data_dir = PACKAGE_DATA_DIR;
tmp->profile = NULL;
tmp->logged_user = NULL;
tmp->database = get_default_database_name();
tmp->administration = FALSE;
tmp->reread_menu = FALSE;
gcompris_user_dir = get_gcompris_user_root_directory() ;
create_rootdir( gcompris_user_dir );
tmp->shared_dir = g_strconcat(gcompris_user_dir, "/shared", NULL);
create_rootdir( tmp->shared_dir );
tmp->users_dir = g_strconcat(gcompris_user_dir, "/users", NULL);
create_rootdir( tmp->users_dir );
/* Needs to be set after command line parsing */
tmp->database = NULL;
full_rootdir = g_strconcat(gcompris_user_dir, "/user_data", NULL);
create_rootdir(full_rootdir);
g_free(full_rootdir);
......
/* gcompris - properties.h
*
* Time-stamp: <2005/08/16 11:55:07 brunoa>
* Time-stamp: <2005/08/25 07:55:12 yves>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -48,6 +48,8 @@ typedef struct {
gchar *database;
gint administration;
gint reread_menu;
gchar *shared_dir;
gchar *users_dir;
} GcomprisProperties;
GcomprisProperties *gcompris_get_properties (void);
......@@ -55,6 +57,8 @@ GcomprisProperties *gcompris_properties_new (void);
void gcompris_properties_destroy (GcomprisProperties *props);
void gcompris_properties_save (GcomprisProperties *props);
gchar *get_default_database_name (gchar *shared_dir);
#endif
/* Local Variables: */
......
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