[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. upstream_version_0_9_4-154-gbebec3d

Pierre Biava nobody at users.sourceforge.net
Mon Jan 2 21:26:45 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, grisbi-gtk3 has been updated
       via  bebec3d63e80f06d9259eeb5b6fcdf90928ed28f (commit)
       via  985de353d169eceae32525fda2af6bb586b8294f (commit)
       via  947796ab2183f80a0d0bff9a7d0f6b58499ec9a1 (commit)
       via  e728780b62c3329efe76c660ca732b1194129a83 (commit)
       via  39c480af7f297796caffba40a3f4c3c0e39bbb9f (commit)
      from  e63864b0c325f4e6ee39c7d262ed2aeecfdb9c91 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bebec3d63e80f06d9259eeb5b6fcdf90928ed28f
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Jan 2 21:25:44 2012 +0100

    WARNING unstable version: changes due to the simplification of the management of directories and other improvements

commit 985de353d169eceae32525fda2af6bb586b8294f
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Jan 2 21:01:09 2012 +0100

    changes due to the simplification of the management of directories

commit 947796ab2183f80a0d0bff9a7d0f6b58499ec9a1
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Jan 2 20:58:12 2012 +0100

    simplify the management of directories

commit e728780b62c3329efe76c660ca732b1194129a83
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Jan 2 20:56:14 2012 +0100

    Changing the management of configuration files and cleaning code

commit 39c480af7f297796caffba40a3f4c3c0e39bbb9f
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Jan 2 06:57:17 2012 +0100

    fix memory leak

-----------------------------------------------------------------------

Changes:
diff --git a/src/erreur.c b/src/erreur.c
index 847b740..7db9e30 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -78,7 +78,7 @@ static FILE *debug_file = NULL;
  */
 void traitement_sigsegv ( gint signal_nb )
 {
-    gchar *gsb_file_default_dir;
+    const gchar *gsb_file_default_dir;
     gchar *errmsg = g_strdup ( "" );
     gchar *old_errmsg;
     gchar *tmpstr;
@@ -92,56 +92,48 @@ void traitement_sigsegv ( gint signal_nb )
     /* soit on était en train de sauver un fichier, et là on peut rien faire */
     /* sinon on essaie de sauver le fichier sous le nom entouré de # */
 
-    if ( run.is_loading || 
-	 run.is_saving || 
-	 !gsb_file_get_modified ( ) )
+    if ( run.is_loading || run.is_saving || !gsb_file_get_modified ( ) )
     {
+        if ( run.is_loading )
+        {
+            old_errmsg = errmsg;
+            errmsg = g_strconcat ( errmsg, _("File is corrupted."), NULL );
+            g_free ( old_errmsg );
+        }
 
-	if ( run.is_loading )
-	{
-	    old_errmsg = errmsg;
-	    errmsg = g_strconcat ( errmsg, _("File is corrupted."), NULL );
-	    g_free ( old_errmsg );
-	}
-
-	if ( run.is_saving )
-	{
-	    old_errmsg = errmsg;
-	    errmsg = g_strconcat ( errmsg, _("Error occured saving file."), NULL );
-	    g_free ( old_errmsg );
-	}
+        if ( run.is_saving )
+        {
+            old_errmsg = errmsg;
+            errmsg = g_strconcat ( errmsg, _("Error occured saving file."), NULL );
+            g_free ( old_errmsg );
+        }
     }
-    else 
+    else
     {
-	/* c'est un bug pendant le fonctionnement de Grisbi s'il n'y a
-	   pas de nom de fichier, on le crée, sinon on rajoute #
-	   autour */
-
-        gsb_file_default_dir = (gchar *) my_get_gsb_file_default_dir();
-
-	if ( nom_fichier_comptes )
-	    /* set # around the filename */
-	    nom_fichier_comptes = g_path_get_basename (nom_fichier_comptes);
-	else
-	    /* no name for the file, create it */
-	    nom_fichier_comptes = g_strconcat ( gsb_file_default_dir,
-						"/#grisbi_crash_no_name#",
-						NULL );
+        /* c'est un bug pendant le fonctionnement de Grisbi s'il n'y a
+           pas de nom de fichier, on le crée, sinon on rajoute #
+           autour */
+        gsb_file_default_dir = gsb_dirs_get_home_dir ( );
+
+        if ( nom_fichier_comptes )
+            /* set # around the filename */
+            nom_fichier_comptes = g_path_get_basename ( nom_fichier_comptes );
+        else
+            /* no name for the file, create it */
+            nom_fichier_comptes = g_build_filename ( gsb_file_default_dir, "#grisbi_crash_no_name#", NULL );
 
-	gsb_status_message ( _("Save file") );
+        gsb_status_message ( _("Save file") );
 
-	gsb_file_save_save_file ( nom_fichier_comptes,
-				  conf.compress_file,
-				  FALSE );
+        gsb_file_save_save_file ( nom_fichier_comptes, conf.compress_file, FALSE );
 
-	gsb_status_clear();
+        gsb_status_clear ( );
 
-    old_errmsg = errmsg;
-	errmsg = g_strconcat ( errmsg, 
-			       g_strdup_printf ( _("Grisbi made a backup file at '%s'."),
-						 nom_fichier_comptes ),
-			       NULL );
-	g_free ( old_errmsg );
+        old_errmsg = errmsg;
+        errmsg = g_strconcat ( errmsg,
+                        g_strdup_printf ( _("Grisbi made a backup file at '%s'."),
+                        nom_fichier_comptes ),
+                        NULL );
+        g_free ( old_errmsg );
     }
 
     old_errmsg = errmsg;
@@ -455,7 +447,7 @@ gboolean gsb_debug_start_log ( void )
         complete_filename = g_strconcat ( base_filename, "-log.txt", NULL);
         basename = g_path_get_basename ( complete_filename );
 
-        debug_filename = g_build_filename ( my_get_gsb_file_default_dir (), basename, NULL);
+        debug_filename = g_build_filename ( gsb_dirs_get_home_dir (), basename, NULL);
 
         g_free ( basename);
         g_free ( complete_filename );
@@ -463,7 +455,7 @@ gboolean gsb_debug_start_log ( void )
     }
     else
     {
-        debug_filename = g_build_filename ( my_get_gsb_file_default_dir (), "No_name-log.txt", NULL);
+        debug_filename = g_build_filename ( gsb_dirs_get_home_dir (), "No_name-log.txt", NULL);
     }
 
 
diff --git a/src/file_obfuscate.c b/src/file_obfuscate.c
index a9873ab..9ab8162 100644
--- a/src/file_obfuscate.c
+++ b/src/file_obfuscate.c
@@ -346,7 +346,7 @@ gboolean file_obfuscate_run ( void )
 	    filename = g_strconcat ( nom_fichier_comptes, "-obfuscated.gsb", NULL);
 	}
 	else
-	    filename = g_strconcat ( my_get_gsb_file_default_dir (), "No_name-obfuscated.gsb", NULL);
+	    filename = g_build_filename ( gsb_dirs_get_home_dir ( ), "No_name-obfuscated.gsb", NULL);
 
 	if (gsb_file_save_save_file (filename, FALSE, FALSE))
 	    dialogue_hint ( g_strdup_printf ( _("Obfuscated file saved as\n'%s'"), filename ),
diff --git a/src/gsb_assistant_file.c b/src/gsb_assistant_file.c
index 59466bb..57bf2ef 100644
--- a/src/gsb_assistant_file.c
+++ b/src/gsb_assistant_file.c
@@ -291,11 +291,16 @@ static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant )
 
 	/* need to declare filename_entry first for the next callback,
 	 * if no filename, set the title.gsb as default name */
-	if (!nom_fichier_comptes)
-	nom_fichier_comptes = g_strconcat ( my_get_gsb_file_default_dir (),
-			G_DIR_SEPARATOR_S, titre_fichier, ".gsb", NULL );
-	filename_entry = gsb_automem_entry_new (&nom_fichier_comptes,
-			NULL, NULL);
+    if ( !nom_fichier_comptes )
+    {
+        gchar *tmp_str;
+
+        tmp_str = g_strconcat ( titre_fichier, ".gsb", NULL );
+        nom_fichier_comptes = g_build_filename ( gsb_dirs_get_home_dir ( ), tmp_str, NULL );
+        g_free ( tmp_str );
+    }
+
+    filename_entry = gsb_automem_entry_new ( &nom_fichier_comptes, NULL, NULL);
 
 	entry = gsb_automem_entry_new (&titre_fichier,
 			((GCallback)gsb_assistant_file_change_title), filename_entry);
@@ -531,62 +536,53 @@ static GtkWidget *gsb_assistant_file_page_finish ( GtkWidget *assistant,
  * \return FALSE
  * */
 static gboolean gsb_assistant_file_change_title ( GtkWidget *title_entry,
-						  GtkWidget *filename_entry )
+                        GtkWidget *filename_entry )
 {
     gchar *new_filename;
     gchar *last_filename;
     gchar *last_title;
+    gchar *tmp_str;
 
     update_homepage_title (GTK_ENTRY (title_entry), NULL, 0, 0);
 
     /* first get the last content of the title to see if the filename
      * was automatically created, and in that case, we continue the automatic mode,
      * else we don't touch the filename entry */
-    last_title = g_object_get_data ( G_OBJECT (title_entry),
-				     "last_title");
-    last_filename = g_strconcat ( my_get_gsb_file_default_dir (),
-				  G_DIR_SEPARATOR_S,
-				  last_title,
-				  ".gsb",
-				  NULL );
+    last_title = g_object_get_data ( G_OBJECT (title_entry), "last_title");
+    tmp_str = g_strconcat ( last_title, ".gsb", NULL );
+
+    last_filename = g_build_filename ( gsb_dirs_get_home_dir ( ), tmp_str, NULL );
+    g_free ( tmp_str );
+
     /* set the new -last title- */
     g_free (last_title);
-    g_object_set_data ( G_OBJECT (title_entry),
-			"last_title", g_strdup (gtk_entry_get_text (GTK_ENTRY (title_entry))));
+    tmp_str = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( title_entry ) ) );
+    g_object_set_data ( G_OBJECT ( title_entry ), "last_title", tmp_str );
+    g_free ( tmp_str );
 
-    if ( strcmp ( last_filename,
-		  gtk_entry_get_text (GTK_ENTRY (filename_entry))))
+    if ( strcmp ( last_filename, gtk_entry_get_text ( GTK_ENTRY ( filename_entry ) ) ) )
     {
-	/* there is a difference between the last title and the filename,
-	 * so juste free the memory and do nothing */
-	g_free (last_filename);
-	return FALSE;
+        /* there is a difference between the last title and the filename,
+         * so juste free the memory and do nothing */
+        g_free ( last_filename );
+
+        return FALSE;
     }
 
-    /* ok, the filename is an automatic creation,
-     * so we change it */
-    g_free (last_filename);
+    /* ok, the filename is an automatic creation, so we change it */
+    g_free ( last_filename );
 
-    if ( strlen ( gtk_entry_get_text (GTK_ENTRY (title_entry) ) ) )
-    {
-	new_filename = g_strconcat ( my_get_gsb_file_default_dir (),
-				     G_DIR_SEPARATOR_S,
-				     gtk_entry_get_text (GTK_ENTRY (title_entry)),
-				     ".gsb",
-				     NULL );
-    }
+    if ( strlen ( gtk_entry_get_text (GTK_ENTRY ( title_entry ) ) ) )
+        tmp_str = g_strconcat ( gtk_entry_get_text ( GTK_ENTRY ( title_entry ) ), ".gsb", NULL );
     else
-    {
-	new_filename = g_strconcat ( my_get_gsb_file_default_dir (),
-				     G_DIR_SEPARATOR_S,
-				     _("My accounts"),
-				     ".gsb",
-				     NULL );
-    }
+        tmp_str = g_strconcat ( _("My accounts"), ".gsb", NULL );
+    new_filename = g_build_filename ( gsb_dirs_get_home_dir ( ), tmp_str, NULL );
+
+    g_free ( tmp_str );
+
+    gtk_entry_set_text ( GTK_ENTRY ( filename_entry ), new_filename );
 
-    gtk_entry_set_text ( GTK_ENTRY (filename_entry),
-			 new_filename );
-    g_free (new_filename);
+    g_free ( new_filename );
 
     return FALSE;
 }
diff --git a/src/gsb_assistant_first.c b/src/gsb_assistant_first.c
index 41b2c30..f08035a 100644
--- a/src/gsb_assistant_first.c
+++ b/src/gsb_assistant_first.c
@@ -305,7 +305,7 @@ static GtkWidget *gsb_assistant_first_page_2 ( GtkWidget *assistant )
                         _("Select/Create backup directory") );
     button = gtk_file_chooser_button_new_with_dialog (dialog);
     gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER (button),
-                        my_get_XDG_grisbi_data_dir () );
+                        gsb_dirs_get_user_data_dir () );
     g_signal_connect ( G_OBJECT (button),
                         "selection-changed",
                         G_CALLBACK (gsb_config_backup_dir_chosen),
diff --git a/src/gsb_dirs.c b/src/gsb_dirs.c
index 52acb62..23b1794 100644
--- a/src/gsb_dirs.c
+++ b/src/gsb_dirs.c
@@ -31,229 +31,216 @@
 #include "gsb_dirs.h"
 #include "structures.h"
 
+static gchar *categories_dir;
+static gchar *home_dir;
 static gchar *locale_dir;
 static gchar *pixmaps_dir;
 static gchar *plugins_dir;
-static gchar *categories_dir;
 static gchar *ui_dir;
-static gchar *_C_GRISBIRC;
-static gchar *_C_OLD_GRISBIRC;
-static gchar *_C_PATH_CONFIG;
-static gchar *_C_PATH_DATA_FILES;
-static gchar *_C_PATH_CONFIG_ACCELS;
-static gchar *_my_get_XDG_grisbi_data_dir;
-static gchar *_my_get_XDG_grisbirc_dir;
-static gchar *_my_get_grisbirc_dir;
-static gchar *_my_get_gsb_file_default_dir;
+static gchar *user_config_dir;
+static gchar *user_data_dir;
 
 
+/**
+ * Initialise les répertoires utilisés par Grisbi
+ *
+ * \param
+ *
+ * \return
+ */
 void gsb_dirs_init ( void )
 {
+#ifdef _WIN32
+    gchar *win32_dir;
+
+    win32_dir = g_win32_get_package_installation_directory_of_module (NULL);
+
+    categories_dir = g_build_filename ( win32_dir, "share/categories", NULL );
+    locale_dir = g_build_filename ( win32_dir, "share/locale", NULL );
+    pixmaps_dir = g_build_filename ( win32_dir, "pixmaps", NULL );
+    plugins_dir = g_build_filename ( win32_dir, "lib/grisbi", NULL );
+    ui_dir = g_build_filename ( win32_dir, "share/ui", NULL );
+
+    home_dir = g_strdup ( g_getenv ( CSIDL_MYDOCUMENTS ) );
+
+    user_config_dir = g_build_filename ( g_get_user_config_dir ( ),  "grisbi", NULL );
+    user_data_dir = g_build_filename ( g_get_user_data_dir ( ),  "grisbi", NULL );
+
+    g_free (win32_dir);
+#else /* !OS_WIN32 */
 #ifdef GTKOSXAPPLICATION
     if ( quartz_application_get_bundle_id ( ) )
     {
         gchar *res_path;
 
         res_path = quartz_application_get_resource_path ();
+
         categories_dir = g_build_filename ( res_path, "share/grisbi/categories", NULL );
         locale_dir = g_strconcat (res_path, "/share/locale", NULL );
         pixmaps_dir = g_strconcat (res_path, "/share/pixmaps/grisbi", NULL );
         plugins_dir = g_strconcat (res_path, "/lib/grisbi", NULL );
         ui_dir = g_strconcat (res_path, "/share/grisbi/ui", NULL );
 
+        home_dir = g_strdup ( g_getenv ( "HOME" ) );;
+
+        user_config_dir = g_build_filename ( g_get_home_dir ( ),
+                        "Library/Application Support/Grisbi/config",
+                        NULL);
+        user_data_dir = g_build_filename ( g_get_home_dir ( ),
+                        "Library/Application Support/Grisbi/data",
+                        NULL );
+
         g_free ( res_path );
     }
     else
-#endif
+#endif /* !GTKOSXAPPLICATION */
     {
         categories_dir = g_build_filename ( DATA_PATH, "categories", NULL );
         locale_dir = g_strdup ( LOCALEDIR );
         pixmaps_dir = g_strdup ( PIXMAPS_DIR );
         plugins_dir = g_strdup ( PLUGINS_DIR );
         ui_dir = g_strdup ( UI_DIR );
-    }
 
-    /*
-     * FIXME: code from gsb_file_config.h
-     */
-#if IS_DEVELOPMENT_VERSION == 1
-    _C_GRISBIRC = g_strconcat ( PACKAGE, "dev.conf", NULL);
-#else
-    _C_GRISBIRC = g_strconcat ( PACKAGE, ".conf", NULL);
-#endif
+        home_dir = g_strdup ( g_getenv ( "HOME" ) );
 
-    _C_OLD_GRISBIRC = g_strconcat ( ".", PACKAGE, "rc", NULL);
-
-#ifndef _WIN32
-
-#ifdef OS_OSX
-    _C_PATH_CONFIG = g_strconcat (g_get_home_dir ( ), G_DIR_SEPARATOR_S,
-                        "Library/Application Support/Grisbi/config", NULL);
-    _C_PATH_DATA_FILES = g_strconcat (g_get_home_dir ( ), G_DIR_SEPARATOR_S,
-                        "Library/Application Support/Grisbi/data", NULL);
-#else /* OS_OSX */
-    _C_PATH_CONFIG = g_strconcat (g_get_user_config_dir ( ), G_DIR_SEPARATOR_S,
-                        "grisbi", NULL);
-    _C_PATH_DATA_FILES = g_strconcat (g_get_user_data_dir ( ), G_DIR_SEPARATOR_S,
-                        "grisbi", NULL);
-#endif /* OS_OSX */
-
-#else /* _WIN32 */
-
-/* Some old Windows version have difficulties with dat starting file names */
-    _C_PATH_CONFIG = win32_get_grisbirc_folder_path( );
-    _C_PATH_DATA_FILES = g_strdup ( g_get_home_dir ( ) );
-
-#endif /* _WIN32 */
-
-    _C_PATH_CONFIG_ACCELS = g_strconcat ( _C_PATH_CONFIG, G_DIR_SEPARATOR_S,
-                        "grisbi-accels", NULL );
-
-    /*
-     * FIXME: code from utils_files.c
-     */
-#ifndef _WIN32
-    _my_get_XDG_grisbirc_dir = g_strdup ( _C_PATH_CONFIG );
-    _my_get_XDG_grisbi_data_dir = g_strdup ( _C_PATH_DATA_FILES );
-    _my_get_grisbirc_dir = g_strdup ( g_get_home_dir () );
-    _my_get_gsb_file_default_dir = g_strdup ( g_get_home_dir() );
-#else
-    _my_get_XDG_grisbirc_dir = g_strdup ( win32_get_grisbirc_folder_path() );
-    _my_get_XDG_grisbi_data_dir = g_strdup ( g_get_home_dir () );
-    _my_get_grisbirc_dir = g_strdup ( win32_get_grisbirc_folder_path() );
-    _my_get_gsb_file_default_dir = g_strdup ( win32_get_my_documents_folder_path() );
-#endif
+        user_config_dir = g_build_filename ( g_get_user_config_dir ( ),  "grisbi", NULL );
+        user_data_dir = g_build_filename ( g_get_user_data_dir ( ),  "grisbi", NULL );
+    }
+#endif /* !OS_WIN32 */
 }
 
 
+/**
+ * Libère la mémoire utilisée par les nom des répertoires utiles
+ *
+ * \param
+ *
+ * \return
+ */
 void gsb_dirs_shutdown ( void )
 {
     g_free ( categories_dir );
+    g_free ( home_dir );
     g_free ( locale_dir );
     g_free ( pixmaps_dir );
     g_free ( plugins_dir );
     g_free ( ui_dir );
-    g_free ( _C_GRISBIRC );
-    g_free ( _C_OLD_GRISBIRC );
-    g_free ( _C_PATH_CONFIG );
-    g_free ( _C_PATH_DATA_FILES );
-    g_free ( _C_PATH_CONFIG_ACCELS );
-    g_free ( _my_get_XDG_grisbi_data_dir );
-    g_free ( _my_get_XDG_grisbirc_dir );
-    g_free ( _my_get_grisbirc_dir );
-    g_free ( _my_get_gsb_file_default_dir );
+    g_free ( user_config_dir );
+    g_free ( user_data_dir );
 }
 
 
+/**
+ * Renvoie le répertoire pour les catégories
+ *
+ * \param
+ *
+ * \return the absolute path of the directory
+ */
 const gchar *gsb_dirs_get_categories_dir ( void )
 {
     return categories_dir;
 }
 
 
+/**
+ *  Renvoie le répertoire pour la locale
+ *
+ * \param
+ *
+ * \return the absolute path of the directory
+ */
 const gchar *gsb_dirs_get_locale_dir ( void )
 {
     return locale_dir;
 }
 
 
+/**
+ * Renvoie le répertoire pour les images
+ *
+ * \param
+ *
+ * \return the absolute path of the directory
+ */
 const gchar *gsb_dirs_get_pixmaps_dir ( void )
 {
     return pixmaps_dir;
 }
 
 
+/**
+ * Renvoie le répertoire pour les plugins
+ *
+ * \param
+ *
+ * \return the absolute path of the directory
+ */
 const gchar *gsb_dirs_get_plugins_dir ( void )
 {
     return plugins_dir;
 }
 
 
+/**
+ * Renvoie le répertoire pour fichiers d'IHM
+ *
+ * \param
+ *
+ * \return the absolute path of the directory
+ */
 const gchar *gsb_dirs_get_ui_dir ( void )
 {
     return ui_dir;
 }
 
 
-const gchar *C_GRISBIRC ( void )
-{
-    return _C_GRISBIRC;
-}
-
-
-const gchar *C_OLD_GRISBIRC ( void )
-{
-    return _C_OLD_GRISBIRC;
-}
-
-
-const gchar *C_PATH_CONFIG ( void )
-{
-    return _C_PATH_CONFIG;
-}
-
-
-const gchar *C_PATH_DATA_FILES ( void )
-{
-    return _C_PATH_DATA_FILES;
-}
-
-
-const gchar *C_PATH_CONFIG_ACCELS ( void )
-{
-    return _C_PATH_CONFIG_ACCELS;
-}
-
-
 /**
  * return the absolute path of where the configuration file should be located
  * On UNIX platforms this is determined using the mechanisms described 
  * in the  XDG Base Directory Specification
  * on Windows based systems return APPDATA\Grisbi
+ *
+ * \param
  * 
- * \return the absolute path of the configuration file directory
+ * \return the absolute path of the configuration directory
  */
-const gchar *my_get_XDG_grisbirc_dir ( void )
+const gchar *gsb_dirs_get_user_config_dir ( void )
 {
-    return _my_get_XDG_grisbirc_dir;
+    return user_config_dir;
 }
 
 
 /**
  * return the absolute path of where the data files should be located
- * On UNIX platforms this is determined using the mechanisms described 
+ * On UNIX platforms this is determined using the mechanisms described
  * in the  XDG Base Directory Specification
  * on Windows based systems return APPDATA\Grisbi
- * 
- * \return the absolute path of the home directory
- */
-const gchar *my_get_XDG_grisbi_data_dir ( void )
-{
-    return _my_get_XDG_grisbi_data_dir;
-}
-
-
-/**
- * return the absolute path of where the configuration file should be located
- * on Un*x based system return $HOME
- * on Windows based systems return APPDATA\Grisbi
- * 
- * \return the absolute path of the configuration file directory
+ *
+ * \param
+ *
+ * \return the absolute path of the user data directory
  */
-const gchar *my_get_grisbirc_dir ( void )
+const gchar *gsb_dirs_get_user_data_dir ( void )
 {
-    return _my_get_grisbirc_dir;
+    return user_data_dir;
 }
 
-
 /**
  * return the absolute path of the default accounts files location
  * on Un*x based system return $HOME
  * on Windows based systems return "My Documents"
  * 
- * \return the absolute path of the configuration file directory
+ * \param
+ *
+ * \return the absolute path of home directory
  */
-const gchar *my_get_gsb_file_default_dir ( void )
+const gchar *gsb_dirs_get_home_dir ( void )
 {
-    return _my_get_gsb_file_default_dir;
+    return home_dir;
 }
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
diff --git a/src/gsb_dirs.h b/src/gsb_dirs.h
index 3c430df..ffb779a 100644
--- a/src/gsb_dirs.h
+++ b/src/gsb_dirs.h
@@ -3,21 +3,20 @@
 
 #include <glib.h>
 
+/* START_INCLUDE_H */
+/* END_INCLUDE_H */
+
+
+/* START_DECLARATION */
 void gsb_dirs_init ( void );
 void gsb_dirs_shutdown ( void );
 const gchar *gsb_dirs_get_categories_dir ( void );
+const gchar *gsb_dirs_get_home_dir ( void );
 const gchar *gsb_dirs_get_locale_dir ( void );
 const gchar *gsb_dirs_get_pixmaps_dir ( void );
 const gchar *gsb_dirs_get_plugins_dir ( void );
 const gchar *gsb_dirs_get_ui_dir ( void );
-const gchar *C_GRISBIRC ( void );
-const gchar *C_OLD_GRISBIRC ( void );
-const gchar *C_PATH_CONFIG ( void );
-const gchar *C_PATH_DATA_FILES ( void );
-const gchar *C_PATH_CONFIG_ACCELS ( void );
-const gchar *my_get_XDG_grisbi_data_dir ( void );
-const gchar *my_get_XDG_grisbirc_dir ( void );
-const gchar *my_get_grisbirc_dir ( void );
-const gchar *my_get_gsb_file_default_dir ( void );
-
+const gchar *gsb_dirs_get_user_config_dir ( void );
+const gchar *gsb_dirs_get_user_data_dir ( void );
+/* END_DECLARATION */
 #endif
diff --git a/src/gsb_file.c b/src/gsb_file.c
index 29061f0..9a8ebc8 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -316,7 +316,7 @@ const gchar *gsb_file_get_backup_path ( void )
 void gsb_file_set_backup_path ( const gchar *path )
 {
     if ( path == NULL || strlen ( path ) == 0 )
-        backup_path = my_strdup ( C_PATH_DATA_FILES ( ) );
+        backup_path = my_strdup ( gsb_dirs_get_user_config_dir ( ) );
     else
         backup_path = my_strdup ( path );
 
diff --git a/src/gsb_file_config.c b/src/gsb_file_config.c
index 55d7b7d..f4c4ffc 100644
--- a/src/gsb_file_config.c
+++ b/src/gsb_file_config.c
@@ -43,7 +43,6 @@
 #include "fenetre_principale.h"
 #include "gsb_dirs.h"
 #include "gsb_file.h"
-#include "main.h"
 #include "structures.h"
 #include "utils_buttons.h"
 #include "utils_files.h"
@@ -52,15 +51,7 @@
 /*END_INCLUDE*/
 
 /*START_STATIC*/
-static gchar *gsb_config_get_old_conf_name ( void );
 static void gsb_file_config_clean_config ( void );
-static void gsb_file_config_get_xml_text_element ( GMarkupParseContext *context,
-                        const gchar *text,
-                        gsize text_len,  
-                        gpointer user_data,
-                        GError **error);
-static gboolean gsb_file_config_load_last_xml_config ( gchar *filename );
-static void gsb_file_config_remove_old_config_file ( gchar *filename );
 /*END_STATIC*/
 
 
@@ -75,15 +66,21 @@ extern gchar *nom_fichier_comptes;
 /* global variable, see structures.h */
 struct gsb_conf_t conf;
 
-
+/* liste des derniers fichiers ouverts */
 gchar **tab_noms_derniers_fichiers_ouverts = NULL;
 
+/* nom du fichier de configuration */
+static gchar *conf_filename;
+
 #if IS_DEVELOPMENT_VERSION == 1
-/* flag de chargement du fichier modèle */
-static gboolean used_model = FALSE;
+    /* flag de chargement du fichier modèle */
+    static gboolean used_model = FALSE;
+    /* partie variable du nom du fichier de configuration */
+    #define GRISBIRC "dev.conf"
+#else
+    #define GRISBIRC  ".conf"
 #endif
 
-
 /**
  * load the config file
  * it uses the glib config utils after 0.6.0
@@ -97,7 +94,6 @@ gboolean gsb_file_config_load_config ( void )
 {
     GKeyFile *config;
     gboolean result;
-    gchar *filename;
     gchar *name;
     gint i;
     gint int_ret;
@@ -105,58 +101,18 @@ gboolean gsb_file_config_load_config ( void )
 
     gsb_file_config_clean_config ();
 
-    filename = g_build_filename ( my_get_XDG_grisbirc_dir(), C_GRISBIRC ( ), NULL );
-#if IS_DEVELOPMENT_VERSION == 1
-    if ( !g_file_test (filename, G_FILE_TEST_EXISTS) )
-    {
-        g_free ( filename );
-        filename = g_strconcat ( my_get_XDG_grisbirc_dir(), G_DIR_SEPARATOR_S,
-                                 PACKAGE, ".conf", NULL );
-        used_model = FALSE;
-    }
-#endif
+    if ( !g_file_test ( conf_filename, G_FILE_TEST_EXISTS ) )
+        return FALSE;
 
     config = g_key_file_new ();
     
     result = g_key_file_load_from_file ( config,
-                        filename,
+                        conf_filename,
                         G_KEY_FILE_KEEP_COMMENTS,
                         NULL );
-    /* if key_file couldn't load the conf, it's because it's the last
-     * conf (HOME or xml) or no conf... try the HOME conf and the xml conf */
-    if (!result)
+    if ( !result )
     {
-        /* On recherche le fichier dans HOME */
-        g_free ( filename );
-#ifndef _WIN32
-        /* On recherche les fichiers possibles seulement sous linux */
-        filename = gsb_config_get_old_conf_name ( );
-        devel_debug (filename);
-        if ( ! filename || strlen ( filename ) == 0 )
-            return FALSE;
-#else
-        filename = g_build_filename ( my_get_grisbirc_dir(), C_OLD_GRISBIRC ( ), NULL );
-#endif
-        
-        g_key_file_free ( config );
-        config = g_key_file_new ();
-        
-        result = g_key_file_load_from_file ( config,
-                        filename,
-                        G_KEY_FILE_KEEP_COMMENTS,
-                        NULL );
-        /* si on ne le trouve pas on recherche le fichier au format xml */
-        if (!result)
-        {
-            result = gsb_file_config_load_last_xml_config ( filename );
-            if ( result )
-                gsb_file_config_remove_old_config_file ( filename );
-            g_free (filename);
-            g_key_file_free ( config );
-            return result;
-        }
-        else
-            g_unlink ( filename );
+        return FALSE;
     }
 
 #if IS_DEVELOPMENT_VERSION == 1
@@ -168,19 +124,18 @@ gboolean gsb_file_config_load_config ( void )
     if ( conf.stable_config_file_model )
     {
         used_model = TRUE;
-        g_free ( filename );
-        filename = g_strconcat ( my_get_XDG_grisbirc_dir(), G_DIR_SEPARATOR_S,
-                                 PACKAGE, ".conf", NULL );
-        if ( !g_file_test (filename, G_FILE_TEST_EXISTS) )
+        g_free ( conf_filename );
+        conf_filename = g_build_filename ( gsb_dirs_get_user_config_dir (), PACKAGE, ".conf", NULL );
+        if ( !g_file_test ( conf_filename, G_FILE_TEST_EXISTS ) )
         {
             g_key_file_free ( config );
             return FALSE;
         }
 
-        g_key_file_free (config);
-        config = g_key_file_new ();
+        g_key_file_free ( config );
+        config = g_key_file_new ( );
         result = g_key_file_load_from_file ( config,
-                        filename,
+                        conf_filename,
                         G_KEY_FILE_KEEP_COMMENTS,
                         NULL );
     }
@@ -294,8 +249,8 @@ gboolean gsb_file_config_load_config ( void )
 
     /* exec gsb_file_automatic_backup_start ( ) if necessary */
     if ( conf.make_backup_every_minutes
-	&&
-	conf.make_backup_nb_minutes )
+     &&
+     conf.make_backup_nb_minutes )
         gsb_file_automatic_backup_start ( NULL, NULL );
 
     conf.compress_backup = g_key_file_get_integer ( config,
@@ -495,8 +450,8 @@ gboolean gsb_file_config_load_config ( void )
                         "Show tip",
                         NULL );
 
-    g_free (filename);
-    g_key_file_free (config);
+    g_key_file_free ( config );
+
     return TRUE;
 }
 
@@ -516,6 +471,7 @@ gboolean gsb_file_config_save_config ( void )
     gchar *filename;
     gchar *file_content;
     gchar *name;
+    gchar *tmp_str;
     gsize length;
     FILE *conf_file;
     gint i;
@@ -523,7 +479,10 @@ gboolean gsb_file_config_save_config ( void )
     
     devel_debug (NULL);
 
-    filename = g_build_filename ( my_get_XDG_grisbirc_dir(), C_GRISBIRC ( ), NULL );
+    tmp_str = g_strconcat ( PACKAGE, GRISBIRC, NULL );
+    filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), tmp_str, NULL );
+    g_free ( tmp_str );
+
     config = g_key_file_new ();
 
 #if IS_DEVELOPMENT_VERSION == 1
@@ -881,334 +840,13 @@ gboolean gsb_file_config_save_config ( void )
 
 
 /**
- * load the xml file config for grisbi before 0.6.0
- * try to find it, if not, return FALSE
- * */
-gboolean gsb_file_config_load_last_xml_config ( gchar *filename )
-{
-    gchar *file_content;
-    gsize length;
-
-    devel_debug (filename);
-
-    /* check if the file exists */
-    if ( !g_file_test ( filename,
-			G_FILE_TEST_EXISTS ))
-	return FALSE;
-
-    /* check here if it's not a regular file */
-    if ( !g_file_test ( filename,
-			G_FILE_TEST_IS_REGULAR ))
-    {
-        gchar* tmpstr = g_strdup_printf ( _("%s doesn't seem to be a regular config file,\nplease check it."),
-					   filename );
-	dialogue_error ( tmpstr);
-        g_free ( tmpstr );
-	return ( FALSE );
-    }
-
-    /* load the file */
-
-    if ( g_file_get_contents ( filename,
-			       &file_content,
-			       &length,
-			       NULL ))
-    {
-	GMarkupParser *markup_parser = g_malloc0 (sizeof (GMarkupParser));
-	GMarkupParseContext *context;
-
-	/* fill the GMarkupParser for the xml structure */
-	
-	markup_parser -> text = (void *) gsb_file_config_get_xml_text_element;
-
-	context = g_markup_parse_context_new ( markup_parser,
-					       0,
-					       NULL,
-					       NULL );
-
-	g_markup_parse_context_parse ( context,
-				       file_content,
-				       strlen (file_content),
-				       NULL );
-
-	g_markup_parse_context_free (context);
-	g_free (markup_parser);
-	g_free (file_content);
-    }
-    else
-    {
-	gchar* tmpstr = g_strdup_printf (_("Cannot open config file '%s': %s"),
-					 filename,
-					 g_strerror(errno));
-	dialogue_error ( tmpstr );
-	g_free ( tmpstr );
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-
-/**
- * called for each new element in the last xml config file
- * see the g_lib doc for the description of param
- *
- * \param context
- * \param text
- * \param text_len
- * \param user_data
- * \param error
- *
- * \return
- * */
-void gsb_file_config_get_xml_text_element ( GMarkupParseContext *context,
-                        const gchar *text,
-                        gsize text_len,  
-                        gpointer user_data,
-                        GError **error)
-{
-    const gchar *element_name;
-    gint i;
-
-    element_name = g_markup_parse_context_get_element ( context );
-
-    if ( !strcmp ( element_name,
-		   "Width" ))
-    {
-	conf.main_width = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Height" ))
-    {
-	conf.main_height = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Modification_operations_rapprochees" ))
-    {
-	conf.r_modifiable = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Dernier_chemin_de_travail" ))
-    {
-	gsb_file_update_last_path (text);
-
-	if ( !gsb_file_get_last_path ()
-	     ||
-	     !strlen (gsb_file_get_last_path ()))
-	    gsb_file_update_last_path (g_get_home_dir ());
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Affichage_alerte_permission" ))
-    {
-	 conf.alerte_permission = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Force_enregistrement" ))
-    {
-	conf.force_enregistrement = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Fonction_touche_entree" ))
-    {
-	conf.entree = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Affichage_messages_alertes" ))
-    {
-	conf.alerte_mini = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Utilise_fonte_des_listes" ))
-    {
-	conf.utilise_fonte_listes = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Fonte_des_listes" ))
-    {
-	conf.font_string = my_strdup (text);
-	return;
-    }
-     if ( !strcmp ( element_name,
-		   "Navigateur_web" ))
-    {
-        if ( conf.browser_command )
-            g_free ( conf.browser_command );
-	conf.browser_command = my_strdelimit (text,
-					      "\\e",
-					      "&" );
-	return;
-    }
- 
-    if ( !strcmp ( element_name,
-		   "Largeur_colonne_echeancier" ))
-    {
-	etat.largeur_colonne_echeancier = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Largeur_colonne_comptes_comptes" ))
-    {
-	etat.largeur_colonne_comptes_comptes = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Largeur_colonne_etats" ))
-    {
-	etat.largeur_colonne_etat = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Chargement_auto_dernier_fichier" ))
-    {
-	conf.dernier_fichier_auto = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Nom_dernier_fichier" ))
-    {
-	nom_fichier_comptes = my_strdup (text);
-	return;
-    }
-  
-    if ( !strcmp ( element_name,
-		   "Enregistrement_automatique" ))
-    {
-	conf.sauvegarde_auto = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Enregistrement_au_demarrage" ))
-    {
-	conf.sauvegarde_demarrage = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Nb_max_derniers_fichiers_ouverts" ))
-    {
-	conf.nb_max_derniers_fichiers_ouverts = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Compression_fichier" ))
-    {
-	conf.compress_file = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Compression_backup" ))
-    {
-	conf.compress_backup = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "fichier" ))
-    {
-	if (!tab_noms_derniers_fichiers_ouverts)
-	    tab_noms_derniers_fichiers_ouverts = g_malloc0 ( conf.nb_max_derniers_fichiers_ouverts * sizeof(gchar *) );
-
-	tab_noms_derniers_fichiers_ouverts[conf.nb_derniers_fichiers_ouverts] = my_strdup (text);
-	conf.nb_derniers_fichiers_ouverts++;
-	return;
-    }
- 
-    if ( !strcmp ( element_name,
-		   "Delai_rappel_echeances" ))
-    {
-	nb_days_before_scheduled = utils_str_atoi (text);
-	execute_scheduled_of_month = FALSE;
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Affichage_formulaire" ))
-    {
-	etat.formulaire_toujours_affiche = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Largeur_auto_colonnes" ))
-    {
-	etat.largeur_auto_colonnes = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "Affichage_exercice_automatique" ))
-    {
-	etat.affichage_exercice_automatique = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "display_toolbar" ))
-    {
-	etat.display_toolbar = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "show_closed_accounts" ))
-    {
-	etat.show_closed_accounts = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "show_tip" ))
-    {
-	etat.show_tip = utils_str_atoi (text);
-	return;
-    }
-
-    if ( !strcmp ( element_name,
-		   "last_tip" ))
-    {
-	etat.last_tip = utils_str_atoi (text);
-	return;
-    }
-
-    for ( i = 0; messages[i].name; i++ )
-    {
-	if ( !strcmp ( element_name, messages[i].name ) )
-	{
-	    messages[i].hidden = utils_str_atoi (text);
-	}
-    }
-}
-
-
-/**
  * Set all the config variables to their default values.
  * called before loading the config
  * or for a new opening
+ *
+ * \param
+ *
+ * \return
  */
 void gsb_file_config_clean_config ( void )
 {
@@ -1253,7 +891,7 @@ void gsb_file_config_clean_config ( void )
     
     conf.force_enregistrement = 1;     /* par défaut, on force l'enregistrement */
     gsb_file_update_last_path (g_get_home_dir ());
-    gsb_file_set_backup_path (my_get_XDG_grisbi_data_dir ());
+    gsb_file_set_backup_path ( gsb_dirs_get_user_data_dir ( ) );
     conf.make_backup = 1;
     conf.make_backup_every_minutes = FALSE;
     conf.make_backup_nb_minutes = 0;
@@ -1291,178 +929,60 @@ void gsb_file_config_clean_config ( void )
 }
 
 
-static void gsb_file_config_remove_old_config_file ( gchar *filename )
+/**
+ * renvoie le nom du fichier de configuration
+ *
+ * \param
+ *
+ * \return conf_filename
+ */
+const gchar *gsb_config_get_conf_filename ( void )
 {
-    GtkWidget *dialog;
-    GtkWidget *content_area;
-    GtkWidget *hbox;
-    GtkWidget *image;
-    GtkWidget *label;
-    gint resultat;
-	gchar *tmpstr;
-
-    dialog = gtk_dialog_new_with_buttons ( _("Delete config file from a previous version"),
-                        GTK_WINDOW ( run.window ),
-                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                        GTK_STOCK_NO, GTK_RESPONSE_CANCEL,
-                        GTK_STOCK_YES, GTK_RESPONSE_OK,
-                        NULL );
-
-    gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
-    gtk_window_set_resizable ( GTK_WINDOW ( dialog ), FALSE );
-
-    content_area = GTK_DIALOG(dialog) -> vbox;
-    hbox = gtk_hbox_new ( FALSE, 5);
-	gtk_container_set_border_width ( GTK_CONTAINER( hbox ), 6 );
-    gtk_box_pack_start ( GTK_BOX ( content_area ), hbox, FALSE, FALSE, 5 );
-
-    image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, 
-                        GTK_ICON_SIZE_DIALOG );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), image, FALSE, FALSE, 5 );
-
-    tmpstr = g_strconcat ( 
-                        _("Caution, you are about to delete the\n"
-                        "configuration file of a previous version of Grisbi.\n"
-                        "\n<b>Do you want to delete this file?</b>"),
-                        NULL );
-
-    label = gtk_label_new ( tmpstr );
-    gtk_label_set_use_markup ( GTK_LABEL( label ), TRUE );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 5 );
-    g_free ( tmpstr );
-
-    gtk_widget_show_all ( dialog );
-
-    resultat = gtk_dialog_run ( GTK_DIALOG ( dialog ));
-
-    if ( resultat == GTK_RESPONSE_OK )
-        g_unlink ( filename );
-    if ( GTK_IS_DIALOG ( dialog ) )
-        gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
+    return conf_filename;
 }
 
 
-gchar *gsb_config_get_old_conf_name ( void )
+/**
+ * initialise le nom du fichier de configuration
+ *
+ * \param
+ *
+ * \return
+ */
+void gsb_config_initialise_conf_filename ( void )
 {
-    GtkWidget *dialog;
-    GtkWidget *hbox;
-    GtkWidget *image;
-    GtkWidget *label;
-    GtkWidget *combo;
-    GtkWidget *content_area;
-    GDir *dir;
-    gchar *filename = NULL;
-    GSList *liste = NULL;
-    GtkListStore *store;
-    GtkTreeIter iter;
-    GtkCellRenderer *renderer;
-    GError *error = NULL;
-    gint resultat;
-    gint i = 0, j = 0;
-	gchar *tmpstr;
-    
-    dir = g_dir_open ( my_get_grisbirc_dir ( ), 0, &error );
-    if ( dir )
-    {
-        const gchar *name = NULL;
-        
-        while ( (name = g_dir_read_name ( dir ) ) )
-        {
-            if ( g_strstr_len ( name, -1, ".grisbi" ) &&
-                        g_str_has_suffix ( name, "rc" ) )
-                liste = g_slist_append ( liste, g_strdup ( name ) );
-        }
-    }
-    else
-    {
-        dialogue_error ( error -> message );
-        g_error_free ( error );
-    }
-
-    if ( g_slist_length ( liste ) == 0 )
-        return NULL;
-
-    if ( g_slist_length ( liste ) == 1 )
-        return g_strconcat ( my_get_grisbirc_dir ( ),
-                            G_DIR_SEPARATOR_S,
-                            g_slist_nth_data ( liste, 0 ), 
-                            NULL );
-
-    dialog = gtk_dialog_new_with_buttons ( _("Choose a file"),
-                        GTK_WINDOW ( run.window ),
-                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                        GTK_STOCK_OK, GTK_RESPONSE_OK,
-                        NULL );
-
-    gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
-    gtk_window_set_resizable ( GTK_WINDOW ( dialog ), FALSE );
-    gtk_window_set_position ( GTK_WINDOW ( dialog ), 
-                        GTK_WIN_POS_CENTER_ON_PARENT );
+    gchar *tmp_str;
 
-    content_area = GTK_DIALOG(dialog) -> vbox;
+    tmp_str = g_strconcat ( PACKAGE, GRISBIRC, NULL );
+    conf_filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), tmp_str, NULL );
+    g_free ( tmp_str );
 
-    hbox = gtk_hbox_new ( FALSE, 5);
-	gtk_container_set_border_width ( GTK_CONTAINER( hbox ), 6 );
-    gtk_box_pack_start ( GTK_BOX ( content_area ), hbox, FALSE, FALSE, 5 );
-
-    image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, 
-                        GTK_ICON_SIZE_DIALOG );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), image, FALSE, FALSE, 5 );
-
-    tmpstr = g_strconcat ( 
-                        _("Please Choose the name of file\n"
-                        "of configuration.\n\n"
-                        "and press the 'OK' button."),
-                        NULL );
-
-    label = gtk_label_new ( tmpstr );
-    gtk_label_set_use_markup ( GTK_LABEL( label ), TRUE );
-    gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 5 );
-    g_free ( tmpstr );
-
-    store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT );
-    while ( liste )
+#if IS_DEVELOPMENT_VERSION == 1
+    if ( !g_file_test ( conf_filename, G_FILE_TEST_EXISTS ) )
     {
-        gtk_list_store_append ( store, &iter );
-        gtk_list_store_set (store, &iter, 
-                        0, (gchar *) liste -> data,
-                        -1);
-        if ( g_strcmp0 ( (gchar *) liste -> data, C_OLD_GRISBIRC ( ) ) == 0 )
-            j = i;
-        liste = liste -> next;
-        i++;
+        g_free ( conf_filename );
+        tmp_str = g_strconcat ( PACKAGE, ".conf", NULL );
+        conf_filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), tmp_str, NULL );
+        g_free ( tmp_str );
     }
+#endif
+}
 
-    combo = gtk_combo_box_new_with_model ( GTK_TREE_MODEL ( store ) );
-    renderer = gtk_cell_renderer_text_new ();
-    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
-    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
-                                "text", 0,
-                                NULL);
-    gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo ), j );
-    gtk_box_pack_start ( GTK_BOX ( content_area ), combo, FALSE, FALSE, 5 );
 
-    gtk_widget_show_all ( dialog );
+/**
+ * libère la mémoire occupée par le nom du fichier de configuration
+ *
+ * \param
+ *
+ * \return
+ */
+void gsb_config_free_conf_filename ( void )
+{
+    if ( conf_filename )
+        g_free ( conf_filename );
+}
 
-    resultat = gtk_dialog_run ( GTK_DIALOG ( dialog ));
-    if ( resultat == GTK_RESPONSE_OK )
-    {
-        gtk_combo_box_get_active_iter ( GTK_COMBO_BOX ( combo ), &iter );
-        gtk_tree_model_get ( GTK_TREE_MODEL ( store ),
-                        &iter,
-                        0, &filename,
-                        -1 );
-        filename = g_strconcat ( my_get_grisbirc_dir ( ),
-                            G_DIR_SEPARATOR_S,
-                            filename, 
-                            NULL );
-    }
-    if ( GTK_IS_DIALOG ( dialog ) )
-        gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
 
-    return filename;
-}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/gsb_file_config.h b/src/gsb_file_config.h
index dcd15ae..68fd8e0 100644
--- a/src/gsb_file_config.h
+++ b/src/gsb_file_config.h
@@ -8,6 +8,9 @@
 /* START_DECLARATION */
 gboolean gsb_file_config_load_config ( void );
 gboolean gsb_file_config_save_config ( void );
+const gchar *gsb_config_get_conf_filename ( void );
+void gsb_config_free_conf_filename ( void );
+void gsb_config_initialise_conf_filename ( void );
 /* END_DECLARATION */
 
 #endif
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index 407edf9..48f0bfb 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -8999,7 +8999,7 @@ void gsb_file_load_copy_old_file ( gchar *filename, gchar *file_content)
         copy_old_filename = gsb_string_remplace_string ( copy_old_filename, ".gsb",
                         "-old-version.gsb" );
         copy_old_filename = g_build_filename (
-                        my_get_XDG_grisbi_data_dir (),
+                        gsb_dirs_get_user_data_dir ( ),
                         copy_old_filename, NULL );
 
         file_ori = g_file_new_for_path ( filename );
diff --git a/src/main.c b/src/main.c
index 25aa095..fe30c24 100644
--- a/src/main.c
+++ b/src/main.c
@@ -94,7 +94,9 @@ static gboolean gsb_grisbi_change_state_window ( GtkWidget *window,
                         gpointer null );
 static GtkWidget *gsb_grisbi_create_main_menu ( GtkWidget *vbox );
 static GtkWidget *gsb_main_create_main_window ( void );
+static void gsb_main_grisbi_shutdown ( void );
 static gint gsb_main_set_debug_level ( void );
+static gint gsb_main_setup_command_line_options ( int argc, char **argv );
 static void gsb_main_show_version ( void );
 static gboolean gsb_grisbi_init_app ( void );
 static void gsb_main_load_file_if_necessary ( gchar *filename );
@@ -115,7 +117,6 @@ static GtkWidget *main_window = NULL;
 static gint debug_level = -1;
 static gchar *file = NULL;
 
-
 static const GOptionEntry options [] =
 {
     { "version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
@@ -172,10 +173,9 @@ int main ( int argc, char **argv )
  * */
 void main_linux ( int argc, char **argv )
 {
-    GOptionContext *context;
     GtkWidget *vbox;
+    gint return_value;
     gboolean first_use = FALSE;
-    GError *error = NULL;
 
     /* Init type system */
     g_type_init ();
@@ -184,37 +184,22 @@ void main_linux ( int argc, char **argv )
     gsb_dirs_init ( );
 
     /* Setup locale/gettext */
-    setlocale (LC_ALL, "");
+    setlocale ( LC_ALL, "" );
     bindtextdomain ( PACKAGE, gsb_dirs_get_locale_dir ( ) );
     bind_textdomain_codeset ( PACKAGE, "UTF-8" );
     textdomain ( PACKAGE );
 
     /* Setup command line options */
-    context = g_option_context_new ( _("- Personnal finances manager") );
-
-    g_option_context_set_summary ( context,
-                        N_("Grisbi can manage the accounts of a family or a small association.") );
-    g_option_context_set_translation_domain ( context, PACKAGE );
-
-    g_option_context_add_main_entries ( context, options, PACKAGE );
-    g_option_context_add_group ( context, gtk_get_option_group ( FALSE ));
-    g_option_context_set_translation_domain ( context, PACKAGE );
-
-    if ( !g_option_context_parse ( context, &argc, &argv, &error ) )
-    {
-        g_option_context_free ( context );
-        if (error)
-        {
-            g_print ("option parsing failed: %s\n", error->message);
-            g_error_free ( error );
-        }
-
-      exit (1);
-    }
+    return_value = gsb_main_setup_command_line_options ( argc, argv );
+    if ( return_value )
+        exit ( return_value );
 
     /* initialisation de la variable locale pour les devises */
     gsb_locale_init ( );
 
+    /* initialisation du nom du fichier de configuration */
+    gsb_config_initialise_conf_filename ( );
+
     /* initialisation du mode de débogage */
     if ( gsb_main_set_debug_level ( ) )
     {
@@ -256,19 +241,7 @@ void main_linux ( int argc, char **argv )
 
     gtk_main ();
 
-    /* sauvegarde les raccourcis claviers */
-    gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
-
-    /* libération de mémoire */
-    gsb_locale_shutdown ( );
-    gsb_dirs_shutdown ( );
-
-    /* liberation libgoffice */
-    libgoffice_shutdown ( );
-
-#if GSB_GMEMPROFILE
-    g_mem_profile();
-#endif
+    gsb_main_grisbi_shutdown ( );
 
     exit ( 0 );
 }
@@ -381,20 +354,9 @@ void main_mac_osx ( int argc, char **argv )
 
     gtk_main ();
 
-    /* sauvegarde les raccourcis claviers */
-    gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
-
     g_object_unref ( theApp );
 
-    gsb_locale_shutdown ( );
-    gsb_dirs_shutdown ( );
-
-    /* liberation libgoffice */
-    libgoffice_shutdown ( );
-
-#if GSB_GMEMPROFILE
-    g_mem_profile();
-#endif
+    gsb_main_grisbi_shutdown ( );
 
     exit ( 0 );
 
@@ -413,44 +375,49 @@ void main_win_32 (  int argc, char **argv )
 #ifdef _WIN32
     GtkWidget *vbox;
     gboolean first_use = FALSE;
-    cmdline_options  opt;
-    gint status = CMDLINE_SYNTAX_OK;    /* be optimistic ;-) */
 
     /* Retrieve exception information and store them under grisbi.rpt file!
      * see http://jrfonseca.dyndns.org/projects/gnu-win32/software/drmingw/index.html for more information */
     LoadLibrary("exchndl.dll");
 
     /* we store the path of the running file to use it for pixmaps, help and locales .... */
-    win32_set_app_path(argv[0]);
+/*     win32_set_app_path ( argv[0] );  */
 
      /* needed to be able to use the "common" installation of GTK libraries */
     win32_make_sure_the_gtk2_dlls_path_is_in_PATH();
 
+    /* Init type system */
+    g_type_init ();
+
     /* initialisation des différents répertoires */
     gsb_dirs_init ( );
 
+    /* Setup locale/gettext */
+    setlocale ( LC_ALL, "" );
     bindtextdomain ( PACKAGE, gsb_dirs_get_locale_dir ( ) );
     bind_textdomain_codeset ( PACKAGE, "UTF-8" );
     textdomain ( PACKAGE );
 
-    /* Setup locale/gettext */
-    setlocale( LC_ALL, NULL );
+    /* Setup command line options */
+    return_value = gsb_main_setup_command_line_options ( argc, argv );
+    if ( return_value )
+        exit ( return_value );
 
+    /* initialisation de la variable locale pour les devises */
     gsb_locale_init ( );
 
+    /* initialisation du nom du fichier de configuration */
+    gsb_config_initialise_conf_filename ( );
+
+    /* initialisation de gtk. arguments à NULL car traités au dessus */
+    gtk_init ( NULL, NULL );
+/*     win32_parse_gtkrc ( "gtkrc" );  */
+
     /* initialisation libgoffice */
     libgoffice_init ( );
-    /* Initialize plugins manager */
+    /* Initialize plugins manager pour goffice */
     go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
 
-    gtk_init ( &argc, &argv );
-
-    win32_parse_gtkrc ( "gtkrc" );
-
-    /* parse command line parameter, exit with correct error code when needed */
-    if ( !parse_options (argc, argv, &opt, &status ) )
-        exit ( status );
-
     /* initialise les données de l'application */
     first_use = gsb_grisbi_init_app ( );
 
@@ -465,7 +432,8 @@ void main_win_32 (  int argc, char **argv )
     dialog_message ( "development-version", VERSION );
 #endif
 
-    gsb_grisbi_load_file_if_necessary ( &opt );
+    /* check the command line, if there is something to open */
+    gsb_main_load_file_if_necessary ( file );
 
     if ( first_use && !nom_fichier_comptes )
         gsb_assistant_first_run ();
@@ -474,18 +442,7 @@ void main_win_32 (  int argc, char **argv )
 
     gtk_main ();
 
-    /* sauvegarde les raccourcis claviers */
-    gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
-
-    gsb_locale_shutdown ( );
-    gsb_dirs_shutdown ( );
-
-    /* liberation libgoffice */
-    libgoffice_shutdown ( );
-
-#if GSB_GMEMPROFILE
-    g_mem_profile();
-#endif
+    gsb_main_grisbi_shutdown ( );
 
     exit ( 0 );
 
@@ -504,7 +461,9 @@ gboolean gsb_grisbi_print_environment_var ( void )
 {
     gchar *tmp_str;
 
-    g_printf ("Variables d'environnement :\n\n" );
+    g_print ("\nGrisbi version %s\n\n", VERSION );
+
+    g_printf ("Variables d'environnement :\n" );
 
     tmp_str = gsb_main_get_print_locale_var ( );
     g_printf ("%s", tmp_str);
@@ -615,6 +574,7 @@ GtkWidget *gsb_main_create_main_window ( void )
 GtkWidget *gsb_grisbi_create_main_menu ( GtkWidget *vbox )
 {
     GtkWidget *menu_bar;
+    gchar *accel_filename;
 
     /* create the menus */
     menu_bar = init_menus ( vbox );
@@ -623,7 +583,9 @@ GtkWidget *gsb_grisbi_create_main_menu ( GtkWidget *vbox )
     menus_sensitifs ( FALSE );
 
     /* charge les raccourcis claviers */
-    gtk_accel_map_load ( C_PATH_CONFIG_ACCELS ( ) );
+    accel_filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), "grisbi-accels", NULL );
+    gtk_accel_map_load ( accel_filename );
+    g_free ( accel_filename );
 
     /* set the last opened files */
     affiche_derniers_fichiers_ouverts ( );
@@ -875,37 +837,32 @@ gchar *gsb_main_get_print_locale_var ( void )
 {
     struct lconv *conv;
     gchar *locale_str = NULL;
-    gchar *mon_thousands_sep;
-    gchar *mon_decimal_point;
     gchar *positive_sign;
     gchar *negative_sign;
 
     /* test local pour les nombres */
-    conv = localeconv();
-
-    mon_thousands_sep = g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL );
-    mon_decimal_point = g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL );
-    positive_sign = g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL );
-    negative_sign = g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL );
+    conv = gsb_locale_get_locale ( );
+    positive_sign = g_strdup ( conv->positive_sign );
+    negative_sign = g_strdup ( conv->negative_sign );
 
-    locale_str = g_strdup_printf ( "LANG = %s\n\n"
+    locale_str = g_strdup_printf ( "LANG = %s\n"
                         "Currency\n"
                         "\tcurrency_symbol   = %s\n"
                         "\tmon_thousands_sep = \"%s\"\n"
                         "\tmon_decimal_point = %s\n"
                         "\tpositive_sign     = \"%s\"\n"
                         "\tnegative_sign     = \"%s\"\n"
+                        "\tp_cs_precedes     = \"%d\"\n"
                         "\tfrac_digits       = \"%d\"\n\n",
                         g_getenv ( "LANG"),
                         conv->currency_symbol,
-                        mon_thousands_sep,
-                        mon_decimal_point,
+                        gsb_locale_get_mon_thousands_sep ( ),
+                        gsb_locale_get_mon_decimal_point ( ),
                         positive_sign,
                         negative_sign,
+                        conv->p_cs_precedes,
                         conv->frac_digits );
 
-    g_free ( mon_thousands_sep );
-    g_free ( mon_decimal_point );
     g_free ( positive_sign );
     g_free ( negative_sign );
 
@@ -921,26 +878,29 @@ gchar *gsb_main_get_print_locale_var ( void )
 gchar *gsb_main_get_print_dir_var ( void )
 {
     gchar *path_str = NULL;
+    const gchar *conf_filename;
+    gchar *accel_filename;
+
+    conf_filename = gsb_config_get_conf_filename ( );
+    accel_filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), "grisbi-accels", NULL );
 
     path_str = g_strdup_printf ( "Paths\n"
-                        "\tXDG_DATA_HOME                    = %s\n"
-                        "\tXDG_CONFIG_HOME                  = %s\n\n"
-                        "\tC_GRISBIRC                       = %s\n"
-                        "\tC_PATH_CONFIG                    = %s\n"
-                        "\tC_PATH_CONFIG_ACCELS             = %s\n"
-                        "\tC_PATH_DATA_FILES                = %s\n\n"
-                        "\tDATA_PATH                        = %s\n\n"
+                        "\thome_dir                         = %s\n"
+                        "\tuser_config_dir                  = %s\n"
+                        "\tuser_config_filename             = %s\n"
+                        "\tuser_accels_filename             = %s\n"
+                        "\tuser_data_pathname               = %s\n\n"
+                        "\tsys_data_pathname                = %s\n\n"
                         "\tgsb_dirs_get_categories_dir ( )  = %s\n"
                         "\tgsb_dirs_get_locale_dir ( )      = %s\n"
                         "\tgsb_dirs_get_plugins_dir ( )     = %s\n"
                         "\tgsb_dirs_get_pixmaps_dir ( )     = %s\n"
                         "\tgsb_dirs_get_ui_dir ( )          = %s\n\n",
-                        g_get_user_data_dir ( ),
-                        g_get_user_config_dir ( ),
-                        C_GRISBIRC ( ),
-                        C_PATH_CONFIG ( ),
-                        C_PATH_CONFIG_ACCELS ( ),
-                        C_PATH_DATA_FILES ( ),
+                        gsb_dirs_get_home_dir ( ),
+                        gsb_dirs_get_user_config_dir ( ),
+                        conf_filename,
+                        accel_filename,
+                        gsb_dirs_get_user_data_dir ( ),
                         DATA_PATH,
                         gsb_dirs_get_categories_dir ( ),
                         gsb_dirs_get_locale_dir ( ),
@@ -948,6 +908,8 @@ gchar *gsb_main_get_print_dir_var ( void )
                         gsb_dirs_get_pixmaps_dir ( ),
                         gsb_dirs_get_ui_dir ( ) );
 
+    g_free ( accel_filename );
+
     return path_str;
 }
 
@@ -982,11 +944,11 @@ g_print ( N_("Grisbi version %s, %s\n"), VERSION, gsb_plugin_get_list ( ) );
 
 
 /**
- * renvoie la version mineure de Grisbi
+ * renvoie le niveau de débug
  *
  * \param
  *
- * \return TRUE if minor number is an odd number
+ * \return debug_level
  */
 gint gsb_main_get_debug_level ( void )
 {
@@ -1028,6 +990,87 @@ gint gsb_main_set_debug_level ( void )
 }
 
 
+/**
+ * traite les arguments de la ligne de commande
+ *
+ * \param
+ *
+ * \return code de sortie 1 si erreur de traitement
+ */
+gint gsb_main_setup_command_line_options ( int argc, char **argv )
+{
+    GOptionContext *context;
+    gint return_value = 0;
+    GError *error = NULL;
+
+    context = g_option_context_new ( _("- Personnal finances manager") );
+
+    g_option_context_set_summary ( context,
+                        N_("Grisbi can manage the accounts of a family or a small association.") );
+    g_option_context_set_translation_domain ( context, PACKAGE );
+
+    g_option_context_add_main_entries ( context, options, PACKAGE );
+    g_option_context_add_group ( context, gtk_get_option_group ( FALSE ));
+    g_option_context_set_translation_domain ( context, PACKAGE );
+
+    if ( !g_option_context_parse ( context, &argc, &argv, &error ) )
+    {
+        g_option_context_free ( context );
+        if (error)
+        {
+            g_print ("option parsing failed: %s\n", error->message);
+            g_error_free ( error );
+        }
+
+      return_value = 1;
+    }
+
+    g_option_context_free ( context );
+
+    return return_value;
+}
+
+
+/**
+ *  procédure appelée après gtk_main_quit termine Grisbi
+ *
+ * \param
+ *
+ * \return
+ */
+void gsb_main_grisbi_shutdown ( void )
+{
+    gchar *filename;
+
+    /* sauvegarde les raccourcis claviers */
+    filename = g_build_filename ( gsb_dirs_get_user_config_dir ( ), "grisbi-accels", NULL );
+    gtk_accel_map_save ( filename );
+    g_free ( filename );
+
+    /* libération de mémoire */
+    gsb_locale_shutdown ( );
+    gsb_dirs_shutdown ( );
+
+    /* liberation libgoffice */
+    libgoffice_shutdown ( );
+
+#if GSB_GMEMPROFILE
+    g_mem_profile();
+#endif
+
+
+}
+
+
+/**
+ *
+ *
+ * \param
+ *
+ * \return
+ */
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/parametres.c b/src/parametres.c
index 5d979f6..4feebdc 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -967,7 +967,7 @@ GtkWidget *onglet_fichier ( void )
                         gsb_file_get_backup_path ());
     else
         gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER (button),
-                        my_get_XDG_grisbi_data_dir () );
+                        gsb_dirs_get_user_data_dir ( ) );
     g_signal_connect ( G_OBJECT (button),
                         "selection-changed",
                         G_CALLBACK ( gsb_config_backup_dir_chosen ),
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index 81360ea..2e88724 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -64,6 +64,7 @@
 #include "gsb_data_report_text_comparison.h"
 #include "gsb_data_scheduled.h"
 #include "gsb_data_transaction.h"
+#include "gsb_file_config.h"
 #include "gsb_form_scheduler.h"
 #include "gsb_form_widget.h"
 #include "gsb_fyear.h"
@@ -327,6 +328,7 @@ void free_variables ( void )
     gsb_gui_navigation_free_pages_list ( );
     gsb_regex_destroy ( );
     struct_free_bet_graph_prefs ( );
+    gsb_config_free_conf_filename ( );
 }
 
 
diff --git a/src/utils_files.c b/src/utils_files.c
index 66de5f5..487b599 100644
--- a/src/utils_files.c
+++ b/src/utils_files.c
@@ -380,8 +380,8 @@ gboolean utils_files_create_XDG_dir ( void )
 #else
     int mode = S_IRUSR | S_IWUSR | S_IXUSR;
 #endif /*_MSC_VER */
-    if ( g_mkdir_with_parents ( C_PATH_CONFIG ( ), mode ) == 0 &&
-         g_mkdir_with_parents ( C_PATH_DATA_FILES ( ), mode ) == 0 )
+    if ( g_mkdir_with_parents ( gsb_dirs_get_user_config_dir ( ), mode ) == 0 &&
+         g_mkdir_with_parents ( gsb_dirs_get_user_data_dir ( ), mode ) == 0 )
         return TRUE;
     else
         return FALSE;


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list