Commit 886ca282 authored by Bruno Coudoin's avatar Bruno Coudoin

Rework of the way we manage the config and user data directory.

	Now we respect the freedesktop and save our config file in
	$XDG_CONFIG_HOME (~/.config/gcompris)
	In this directory we save the files:
	gcompris.conf  gcompris.log  gcompris_sqlite.db

	The data file are now in a directory ~/My GCompris
	This contains the Images directory. The children can put image in
	them, they will be selectable in the anim and drawing activity.
	The directories 'anim2  draw2 wordprocessor' contains the children
	creation for each of these activities.

	It is possible to change the base of these directory with the command line
	switch --config-dir and --user-dir
	(Does not work yet).

svn path=/trunk/; revision=2467
parent 654a4479
2007-02-04 Bruno coudoin <bruno.coudoin@free.fr>
Rework of the way we manage the config and user data directory.
Now we respect the freedesktop and save our config file in
$XDG_CONFIG_HOME (~/.config/gcompris)
In this directory we save the files:
gcompris.conf gcompris.log gcompris_sqlite.db
The data file are now in a directory ~/My GCompris
This contains the Images directory. The children can put image in
them, they will be selectable in the anim and drawing activity.
The directories 'anim2 draw2 wordprocessor' contains the children
creation for each of these activities.
It is possible to change the base of these directory with the command line
switch --config-dir and --user-dir
(Does not work yet).
* src/boards/gtans.c: (tanloadfigtab), (taninitstart), (tanend):
* src/boards/menu2.c: (menu_start), (item_event):
* src/boards/py-gcompris-properties.c:
(pyGcomprisPropertiesType_getattr):
* src/boards/py-mod-gcompris.c:
* src/boards/python/pythontest.py:
* src/gcompris/Makefile.am:
* src/gcompris/file_selector.c: (display_file_selector):
* src/gcompris/gameutil.c: (gc_file_find_absolute),
(gc_util_create_rootdir):
* src/gcompris/gcompris.c: (load_properties), (main):
* src/gcompris/gcompris_db.c: (gc_db_init):
* src/gcompris/main.c:
* src/gcompris/properties.c:
(gc_prop_default_config_directory_get),
(gc_prop_default_user_directory_get), (gc_prop_config_file_get),
(gc_prop_new), (old_config_migration), (gc_prop_load),
(gc_prop_activate), (gc_prop_destroy), (gc_prop_save):
* src/gcompris/properties.h:
* src/gcompris/soundutil.c:
2007-01-30 Bruno coudoin <bruno.coudoin@free.fr>
* src/boards/memory.c: (start_board): Fixed bug#401817
......
......@@ -241,7 +241,6 @@ gboolean editmode;
static gboolean dumtabpxpixmode[3],*tabpxpixmode=dumtabpxpixmode-PXSTART; /* mode VOULU */
static gboolean tabcolalloc[GCNBR]; /* couleur allouee ? */
static gchar *userconf=NULL; /* nom complet du fichier de config local */
static gchar *usergtdir=NULL; /* nom du home directory local */
static tanflfig flfigpetite;
static tanfpnt fpntspetite[FLPNTMAX];
......@@ -1010,51 +1009,6 @@ void tanunselect (void){
}
/********************************/
void tanloadfigstatus (char *name, tanfigure *nfigtab, int nfigsize){
int i;
FILE *hand=NULL;
gchar *statusfilename;
statusfilename = g_strconcat(usergtdir, G_DIR_SEPARATOR_S, g_basename(name), ".status", NULL);
if ( (hand = g_fopen(statusfilename, "r"))!=NULL ){
for (i=0; i<nfigsize; i++)
if ( fgetc(hand)=='y' )
(nfigtab+i)->reussi = TRUE;
fclose(hand);
}
g_free(statusfilename);
}
/********************************/
void tansavefigstatus (char *name, tanfigure *nfigtab, int nfigsize){
int i;
FILE *hand=NULL;
gchar *statusfilename;
if(figtabsize){
statusfilename = g_strconcat(usergtdir, G_DIR_SEPARATOR_S, g_basename(name), ".status", NULL);
if ( (hand = g_fopen(statusfilename, "w"))!=NULL ){
for (i=0; i<nfigsize; i++)
if ( (nfigtab+i)->reussi )
fputc ('y', hand);
else
fputc ('n', hand);
fclose(hand);
}
g_free(statusfilename);
}
}
/********************************/
gdouble tanreadfloat(FILE *fhd, int *lres)
{
......@@ -1119,13 +1073,9 @@ gboolean tanloadfigtab (char *name){
if (lres==1){
succes=TRUE;
tansavefigstatus(figfilename, figtab, figtabsize);
if(figtab!=NULL)
g_free(figtab);
tanloadfigstatus(name, newfigtab, newfigtabsize);
figtab=newfigtab;
figtabsize=newfigtabsize;
......@@ -1821,8 +1771,6 @@ void taninitstart(void){
int i;
char* accurstr;
usergtdir = gc_prop_current_board_dirname_get();
for (i = PXSTART; i<PXNBR+PXSTART; i++){
tabpxnam[i] = NULL;
tabpxpx[i] = NULL;
......@@ -1879,11 +1827,6 @@ void tanend(void){
syscmap = gdk_colormap_get_system();
tansavefigstatus(figfilename, figtab, figtabsize);
if (usergtdir!=NULL)
g_free(usergtdir);
if (userconf!=NULL)
g_free(userconf);
......
......@@ -47,6 +47,8 @@ static MenuItems *menuitems;
static GcomprisBoard *gcomprisBoard = NULL;
static gboolean board_paused = TRUE;
static gchar *menu_position = NULL;
/* We don't wan't the callback on boards to be accepted until the menu is fully displayed */
static gboolean menu_displayed = FALSE;
......@@ -175,8 +177,6 @@ static void menu_pause (gboolean pause)
static void menu_start (GcomprisBoard *agcomprisBoard)
{
GcomprisProperties *properties = gc_prop_get();
current_x = 0.0;
current_y = 0.0;
......@@ -242,8 +242,8 @@ static void menu_start (GcomprisBoard *agcomprisBoard)
create_panel(boardRootItem);
if (properties->menu_position){
display_section(properties->menu_position);
if (menu_position){
display_section(menu_position);
}
else
display_welcome();
......@@ -656,14 +656,13 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MenuItems *menuitems)
if (strcmp(board->type,"menu")==0){
gchar *path = g_strdup_printf("%s/%s",board->section, board->name);
GcomprisProperties *properties = gc_prop_get();
display_section(path);
if (properties->menu_position)
g_free(properties->menu_position);
if (menu_position)
g_free(menu_position);
properties->menu_position = path;
menu_position = path;
}
else
......
......@@ -101,8 +101,8 @@ pyGcomprisPropertiesType_getattr(pyGcomprisPropertiesObject *self, char *name)
if(strcmp(name,"package_python_plugin_dir")==0) return Py_BuildValue("s", self->cdata->package_python_plugin_dir);
if(strcmp(name,"locale")==0) return Py_BuildValue("s", self->cdata->locale);
if(strcmp(name,"skin")==0) return Py_BuildValue("s", self->cdata->skin);
if(strcmp(name,"shared_dir")==0) return Py_BuildValue("s", self->cdata->shared_dir);
if(strcmp(name,"users_dir")==0) return Py_BuildValue("s", self->cdata->users_dir);
if(strcmp(name,"config_dir")==0) return Py_BuildValue("s", self->cdata->config_dir);
if(strcmp(name,"user_dir")==0) return Py_BuildValue("s", self->cdata->user_dir);
if(strcmp(name,"profile")==0){
if (self->cdata->profile)
......
......@@ -1450,70 +1450,6 @@ py_gc_board_config_textview(PyObject* self, PyObject* args){
}
static PyObject*
py_gc_prop_user_dirname_get (PyObject* self, PyObject* args)
{
PyObject* pyUser;
pyGcomprisUserObject* pyGcomprisUser;
GcomprisUser* cGcomprisUser;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "O:gcompris.get_user_dirname", &pyUser))
return NULL;
pyGcomprisUser = (pyGcomprisUserObject *) pyUser;
cGcomprisUser = pyGcomprisUser->cdata;
/* Call the corresponding C function */
return PyString_FromString(gc_prop_user_dirname_get(cGcomprisUser));
}
static PyObject*
py_gc_prop_board_dirname_get (PyObject* self, PyObject* args)
{
PyObject* pyBoard;
pyGcomprisBoardObject* pyGcomprisBoard;
GcomprisBoard* cGcomprisBoard;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "O:gcompris.get_board_dirname", &pyBoard))
return NULL;
pyGcomprisBoard = (pyGcomprisBoardObject *) pyBoard;
cGcomprisBoard = pyGcomprisBoard->cdata;
/* Call the corresponding C function */
return PyString_FromString(gc_prop_board_dirname_get(cGcomprisBoard));
}
static PyObject*
py_gc_prop_current_user_dirname_get (PyObject* self, PyObject* args)
{
/* Parse arguments */
if(!PyArg_ParseTuple(args, ":gcompris.get_current_user_dirname"))
return NULL;
/* Call the corresponding C function */
return PyString_FromString(gc_prop_current_user_dirname_get());
}
static PyObject*
py_gc_prop_current_board_dirname_get (PyObject* self, PyObject* args)
{
/* Parse arguments */
if(!PyArg_ParseTuple(args, ":gcompris.get_current_board_dirname"))
return NULL;
/* Call the corresponding C function */
return PyString_FromString(gc_prop_current_board_dirname_get());
}
static PyObject*
py_gcompris_wordlist_get_from_file (PyObject* self, PyObject* args)
{
......@@ -1602,10 +1538,6 @@ static PyMethodDef PythonGcomprisModule[] = {
{ "combo_locales_asset", py_gc_board_config_combo_locales_asset, METH_VARARGS, "gc_board_config_combo_locales_asset" },
{ "get_locales_asset_list", py_gc_locale_gets_asset_list, METH_VARARGS, "gc_locale_gets_asset_list" },
{ "textview", py_gc_board_config_textview, METH_VARARGS, "gc_board_config_textview" },
{ "get_user_dirname", py_gc_prop_user_dirname_get, METH_VARARGS, "gc_prop_user_dirname_get" },
{ "get_current_user_dirname", py_gc_prop_current_user_dirname_get, METH_VARARGS, "gc_prop_current_user_dirname_get" },
{ "get_board_dirname", py_gc_prop_board_dirname_get, METH_VARARGS, "gc_prop_board_dirname_get" },
{ "get_current_board_dirname", py_gc_prop_current_board_dirname_get, METH_VARARGS, "gc_prop_current_board_dirname_get" },
{ "get_wordlist", py_gcompris_wordlist_get_from_file, METH_VARARGS, "gcompris_wordlist_get_from_file" },
{ "im_reset", py_gc_im_reset, METH_VARARGS, "gc_im_reset" },
{ NULL, NULL, 0, NULL}
......
......@@ -56,9 +56,6 @@ class Gcompris_pythontest:
# print wordlist.words
print gcompris.get_current_user_dirname()
print gcompris.get_current_board_dirname()
if logged:
print "User Logged in:"
print " ", logged.login, logged.firstname, logged.lastname
......
......@@ -89,7 +89,6 @@ gcompris_SOURCES = \
help.c \
images_selector.c \
log.c \
main.c \
menu.c \
pixbuf_util.c \
pixbuf_util.h \
......
......@@ -382,7 +382,7 @@ display_file_selector(int the_mode,
file_selector_displayed = TRUE;
full_rootdir = g_strconcat(gc_prop_current_user_dirname_get(), "/", rootdir, NULL);
full_rootdir = g_strconcat(gc_prop_get()->user_dir, "/", rootdir, NULL);
gc_util_create_rootdir(full_rootdir);
current_rootdir = full_rootdir;
......
......@@ -530,7 +530,6 @@ gc_file_find_absolute(const gchar *format, ...)
*/
dir_to_search[i++] = properties->package_data_dir;
dir_to_search[i++] = properties->user_data_dir;
dir_to_search[i++] = NULL;
absolute_filename = g_strdup(filename);
......@@ -619,7 +618,6 @@ gc_file_find_absolute(const gchar *format, ...)
}
/** Create a directory if needed.
* If a file is given, it is removed and a directory is created instead.
*
* \param rootdir: the directory to create
*
......@@ -629,15 +627,9 @@ int
gc_util_create_rootdir (gchar *rootdir)
{
/* Case where ~/.gcompris already exist as a file. We remove it */
if(g_file_test(rootdir, G_FILE_TEST_IS_REGULAR)) {
g_unlink(rootdir);
}
if(g_file_test(rootdir, G_FILE_TEST_IS_DIR)) {
return 0;
}
return(g_mkdir(rootdir, 0755));
}
......@@ -25,6 +25,8 @@
#include <time.h>
#include <string.h>
#include <glib/gstdio.h>
#include "gcompris.h"
#include "gc_core.h"
#include "gcompris_config.h"
......@@ -105,8 +107,8 @@ static gint popt_create_db = FALSE;
static gint popt_reread_menu = FALSE;
static gchar *popt_profile = NULL;
static gint *popt_profile_list = FALSE;
static gchar *popt_shared_dir = NULL;
static gchar *popt_users_dir = NULL;
static gchar *popt_config_dir = NULL;
static gchar *popt_user_dir = NULL;
static gint popt_experimental = FALSE;
static gint popt_no_quit = FALSE;
static gint popt_no_config = FALSE;
......@@ -174,11 +176,11 @@ static GOptionEntry options[] = {
{"profile-list",'\0', 0, G_OPTION_ARG_NONE, &popt_profile_list,
N_("List all available profiles. Use 'gcompris -a' to create profiles"), NULL},
{"shared-dir",'\0', 0, G_OPTION_ARG_STRING, &popt_shared_dir,
N_("Shared directory location, for profiles and board-configuration data: [$HOME/.gcompris/shared]"), NULL},
{"config-dir",'\0', 0, G_OPTION_ARG_STRING, &popt_config_dir,
N_("Config directory location: [$HOME/.config/gcompris]"), NULL},
{"users-dir",'\0', 0, G_OPTION_ARG_STRING, &popt_users_dir,
N_("The location of user directories: [$HOME/.gcompris/users]"), NULL},
{"users-dir",'\0', 0, G_OPTION_ARG_STRING, &popt_user_dir,
N_("The location of user directories: [$HOME/My GCompris]"), NULL},
{"experimental",'\0', 0, G_OPTION_ARG_NONE, &popt_experimental,
N_("Run the experimental activities"), NULL},
......@@ -1099,12 +1101,11 @@ static void load_properties ()
g_free(prefix_dir);
/* Display the directory and database value we have */
/* Display the directory value we have */
printf("package_data_dir = %s\n", properties->package_data_dir);
printf("package_locale_dir = %s\n", properties->package_locale_dir);
printf("package_plugin_dir = %s\n", properties->package_plugin_dir);
printf("package_python_plugin_dir= %s\n", properties->package_python_plugin_dir);
printf("database = %s\n", properties->database);
}
GcomprisProperties *gc_prop_get ()
......@@ -1354,7 +1355,7 @@ static gint xf86_focus_changed(GtkWindow *window,
*/
int
gc_init (int argc, char *argv[])
main (int argc, char *argv[])
{
GError *error = NULL;
GOptionContext *context;
......@@ -1427,6 +1428,21 @@ gc_init (int argc, char *argv[])
gc_debug = TRUE;
}
if (popt_config_dir){
if ((!g_file_test(popt_config_dir, G_FILE_TEST_IS_DIR)) ||
(g_access(popt_config_dir, popt_administration? W_OK : R_OK ) == -1)){
printf("%s does not exists or is not %s", popt_config_dir,
popt_administration? "writable" : "readable" );
exit(0);
}
else {
g_warning("Using %s as config directory.", popt_config_dir);
properties->config_dir = g_strdup(popt_config_dir);
}
}
/* Now we know where our config file is, load the saved config */
gc_prop_load(properties);
if (popt_fullscreen)
{
properties->fullscreen = TRUE;
......@@ -1507,7 +1523,6 @@ gc_init (int argc, char *argv[])
/* check the list of possible values for -l, then exit */
printf(_("Use -l to access an activity directly.\n"));
printf(_("The list of available activities is :\n"));
properties->root_menu = "/";
gc_db_init();
......@@ -1545,66 +1560,49 @@ gc_init (int argc, char *argv[])
}
else {
g_warning("Using menu %s as root.", popt_root_menu);
g_free(properties->root_menu);
properties->root_menu = g_strdup(popt_root_menu);
properties->menu_position = g_strdup(popt_root_menu);
}
}
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,
if (popt_user_dir){
if ((!g_file_test(popt_user_dir, G_FILE_TEST_IS_DIR)) ||
(g_access(popt_user_dir, popt_administration? R_OK : W_OK ) == -1)){
g_warning("%s does not exists or is not %s ", popt_user_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);
g_warning("Using %s as users directory.", popt_user_dir);
g_free(properties->user_dir);
properties->user_dir = g_strdup(popt_user_dir);
}
}
/* shared_dir initialised, now we can set the default */
g_free(properties->database);
properties->database = gc_prop_default_database_name_get ( properties->shared_dir );
g_warning( "Infos:\n Shared dir '%s'\n Users dir '%s'\n Database '%s'\n",
properties->shared_dir,
properties->users_dir,
properties->database);
if (popt_database)
{
g_free(properties->database);
properties->database = g_strdup(popt_database);
if (g_file_test(properties->database, G_FILE_TEST_EXISTS))
{
if (access(properties->database, R_OK)==-1)
if (g_access(properties->database, R_OK)==-1)
{
g_warning("%s exists but is not readable or writable", properties->database);
printf("%s exists but is not readable or writable", properties->database);
exit(0);
}
else
{
g_warning("Using %s as database", properties->database);
}
}
}
/* config_dir initialised, now we can set the default */
printf("Infos:\n Config dir '%s'\n Users dir '%s'\n Database '%s'\n",
properties->config_dir,
properties->user_dir,
properties->database);
if (popt_create_db)
{
gchar *dirname = g_path_get_dirname (properties->database);
if (access(dirname, W_OK)==-1)
if (g_access(dirname, W_OK)==-1)
{
g_warning("Cannot create %s : %s is not writable !", properties->database, dirname);
exit (0);
......@@ -1616,7 +1614,7 @@ gc_init (int argc, char *argv[])
if (popt_administration){
if (popt_database){
if (access(popt_database,R_OK|W_OK)==-1){
if (g_access(popt_database,R_OK|W_OK)==-1){
g_warning("%s exists but is not writable", popt_database);
exit(0);
}
......@@ -1631,7 +1629,7 @@ gc_init (int argc, char *argv[])
if (popt_reread_menu){
g_warning("Rebuild db from xml files");
if (access(properties->database, W_OK)==-1)
if (g_access(properties->database, W_OK)==-1)
g_warning("Cannot reread menu when database is read-only !");
else
properties->reread_menu = TRUE;
......@@ -1672,6 +1670,8 @@ gc_init (int argc, char *argv[])
}
}
gc_prop_activate(properties);
/*
* Database init MUST BE after properties
* And after a possible alternate database as been provided
......
......@@ -149,7 +149,7 @@ int gc_db_init()
rc = sqlite3_open(properties->database, &gcompris_db);
if( rc ){
g_error("Can't open database %s : %s\n", properties->database, sqlite3_errmsg(gcompris_db));
g_warning("Can't open database %s : %s\n", properties->database, sqlite3_errmsg(gcompris_db));
sqlite3_close(gcompris_db);
exit(1);
}
......
/* gcompris - main.c
*
* Time-stamp: <2002/06/02 00:25:49 bruno>
*
* Copyright (C) 2000,2001 Bruno Coudoin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <signal.h>
#include "gcompris.h"
int
gc_init (int argc, char *argv[]);
int
main (int argc, char *argv[])
{
gc_init(argc, argv);
return(0);
}
......@@ -34,7 +34,8 @@
# include <windows.h>
#endif
static gchar *config_file = NULL;
/* get the default database name */
#define DEFAULT_DATABASE "gcompris_sqlite.db"
/*
* return 1 if parsing OK, 0 otherwise
......@@ -69,74 +70,81 @@ scan_get_string(GScanner *scanner) {
}
/* get the gcompris user directory name */
/* Architecture dependant: "gcompris" in Win9x, */
/* "/.gcompris" in POSIX compliant systems */
gchar *
gc_prop_user_root_directory_get ()
/* get the gcompris config directory name
*
* \return a newly allocated string
*
* \warning Architecture dependant: "gcompris" in Win9x,
* "/.gcompris" in POSIX compliant systems
*/
static gchar *
gc_prop_default_config_directory_get ()
{
G_CONST_RETURN gchar *home_dir = g_get_home_dir();
#ifdef WIN32
if ( ! G_WIN32_IS_NT_BASED() ) /* Win9x */
return g_strdup("../gcompris");
else
#endif
return g_strconcat(home_dir, "/.gcompris", NULL);
{
const gchar *home_dir = g_get_home_dir();
const gchar *xdg_config_home = g_getenv("XDG_CONFIG_HOME");
if(xdg_config_home)
return g_strconcat(xdg_config_home, "/.gcompris", NULL);
return g_strconcat(home_dir, "/.config/gcompris", NULL);
}
}
/* get the gcompris data directory name
*
* \return a newly allocated string
*
* \warning Architecture dependant: "gcompris" in Win9x,
* "/MyGCompris" in POSIX compliant systems
*/
static gchar *
gc_prop_default_user_directory_get ()
{
char *name = "My GCompris";
#ifdef WIN32
if ( ! G_WIN32_IS_NT_BASED() ) /* Win9x */
return g_strconcat("../", name, NULL);
else
#endif
{
const gchar *home_dir = g_get_home_dir();
return g_strconcat(home_dir, "/", name, NULL);
}
}
/** return the name of the configuration file used.
* the name has the full path and is platform dependant
* must not be freed by the caller.
* must not be freed.
*
*/
gchar *
static const gchar *
gc_prop_config_file_get()
{
gchar *dir;
if(config_file)
return(config_file);
dir = gc_prop_user_root_directory_get();
/* Was never called, must calculate it */
#ifdef WIN32
if (! G_WIN32_IS_NT_BASED() ) {
config_file = g_strconcat(dir, "/gcompris.cfg", NULL);
return("gcompris.cfg");
} else
#endif
config_file = g_strconcat(dir, "/gcompris.conf", NULL);
g_free(dir);
return(config_file);
}
/* get the default database name */
#define DEFAULT_DATABASE "gcompris_sqlite.db"
#define PROFILES_ROOT "profiles"
gchar *
gc_prop_default_database_name_get (gchar *shared_dir)
{
gchar *dir_base = g_strconcat( shared_dir, "/", PROFILES_ROOT, NULL);
gc_util_create_rootdir(dir_base);
g_free(dir_base);
return g_strconcat( shared_dir, "/", PROFILES_ROOT, "/", DEFAULT_DATABASE, NULL);
return("gcompris.conf");
}
/** Create a new GcomprisProperties struct with it's default values
*
*
* \return a newly allocated GcomprisProperties
*/
GcomprisProperties *
gc_prop_new ()
{
GcomprisProperties *tmp;
char *config_file = gc_prop_config_file_get();
GScanner *scanner;
gchar *content;
gsize length;
gchar *full_rootdir;
#ifndef WIN32
const gchar *locale;
#endif
gchar *user_dir;
tmp = (GcomprisProperties *) malloc (sizeof (GcomprisProperties));
tmp->music = 1;
......@@ -154,7 +162,7 @@ gc_prop_new ()
tmp->disable_quit = 0; /* Used to remove the quit button from the bar. Use it for kiosk mode */
tmp->disable_config = 0; /* Used to remove the config button from the bar. Use it for kiosk mode */
tmp->display_resource = 0;
tmp->root_menu = "/";
tmp->root_menu = g_strdup("/");
tmp->local_directory = NULL;
tmp->profile = NULL;
tmp->logged_user = NULL;
......@@ -162,7 +170,6 @@ gc_prop_new ()
tmp->administration = FALSE;
tmp->reread_menu = FALSE;
tmp->experimental = FALSE;
tmp->menu_position = NULL;
tmp->server = NULL;
......@@ -174,42 +181,182 @@ gc_prop_new ()
tmp->cache_dir = NULL;
tmp->drag_mode = GC_DRAG_MODE_GRAB;
user_dir = gc_prop_user_root_directory_get() ;
gc_util_create_rootdir( user_dir );
tmp->shared_dir = g_strconcat(user_dir, "/shared", NULL);
gc_util_create_rootdir( tmp->shared_dir );
tmp->users_dir = g_strconcat(user_dir, "/users", NULL);