[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. grisbi_gtk3_1_3_0-157-ga08c03b

Pierre Biava nobody at users.sourceforge.net
Sat Feb 18 12:48:11 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  a08c03b3c7d2d74872efe615f29cacdcf1ed46dc (commit)
       via  4ca89b0bee5e8962cc1b3cba32b6551ab19ea7a2 (commit)
       via  ba71ca12cf42d30535b455912bd40c3967ef1c39 (commit)
       via  cfae1b8376f53e2762e58625b68faa9987ab5859 (commit)
       via  c3cb678d730a0857359ee64226dee6270c8abd71 (commit)
       via  cab786965daec088b8116d25203cb46a84f7ff2b (commit)
      from  230f5661a03bcca4e141d18183d2170c974ed316 (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 a08c03b3c7d2d74872efe615f29cacdcf1ed46dc
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 18 12:44:20 2012 +0100

    main.c: clean up code

commit 4ca89b0bee5e8962cc1b3cba32b6551ab19ea7a2
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 18 12:31:27 2012 +0100

    transferring functions in gsb_locale.c and erreur.c

commit ba71ca12cf42d30535b455912bd40c3967ef1c39
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 18 08:38:22 2012 +0100

    transferring of the gsb_main_get_print_dir_var () function in gsb_dirs.c

commit cfae1b8376f53e2762e58625b68faa9987ab5859
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 18 08:21:46 2012 +0100

    transferring of the gsb_main_set_grisbi_title () function in grisbi_app.c

commit c3cb678d730a0857359ee64226dee6270c8abd71
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 18 07:36:08 2012 +0100

    main.c: clean up code

commit cab786965daec088b8116d25203cb46a84f7ff2b
Author: pbiava <pierre.biava at nerim.net>
Date:   Fri Feb 17 22:45:00 2012 +0100

    main.c: minor change

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

Changes:
diff --git a/configure.in b/configure.in
index f677bae..8943f20 100644
--- a/configure.in
+++ b/configure.in
@@ -64,6 +64,14 @@ PKG_CHECK_MODULES(GRISBI, [gtk+-2.0 >= 2.2.24 glib-2.0 >= 2.28 gmodule-2.0 >= 2.
 # </hack>
 
 dnl ================================================================
+dnl Defined if Grisbi is a development version
+dnl ================================================================
+
+if expr ${GRISBI_MINOR_VERSION} % 2 > /dev/null; then
+	AC_DEFINE(IS_DEVELOPMENT_VERSION,1,[Defined if Grisbi is a developmeent version])
+fi
+
+dnl ================================================================
 dnl Plugin support using glib's GModule
 dnl ================================================================
 
diff --git a/src/accueil.c b/src/accueil.c
index 2512811..de52433 100644
--- a/src/accueil.c
+++ b/src/accueil.c
@@ -48,7 +48,6 @@
 #include "gsb_scheduler_list.h"
 #include "gsb_select_icon.h"
 #include "gsb_transactions_list.h"
-#include "main.h"
 #include "navigation.h"
 #include "structures.h"
 #include "utils.h"
diff --git a/src/affichage.c b/src/affichage.c
index b41e968..9dd4007 100644
--- a/src/affichage.c
+++ b/src/affichage.c
@@ -41,7 +41,6 @@
 #include "gsb_file.h"
 #include "gsb_scheduler_list.h"
 #include "gsb_select_icon.h"
-#include "main.h"
 #include "navigation.h"
 #include "parametres.h"
 #include "structures.h"
@@ -651,7 +650,7 @@ gboolean update_homepage_title (GtkEntry *entry,
     grisbi_app_set_active_file_title ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
 
     /* set Grisbi title */
-    gsb_main_set_grisbi_title ( -1 );
+    grisbi_app_set_active_title ( -1 );
 
     /* Mark file as modified */
     gsb_file_set_modified ( TRUE );
@@ -978,7 +977,7 @@ gboolean change_grisbi_title_type ( GtkRadioButton *button, GtkWidget *entry )
     }
 
     /* set Grisbi title */
-    gsb_main_set_grisbi_title ( gsb_gui_navigation_get_current_account ( ) );
+    grisbi_app_set_active_title ( gsb_gui_navigation_get_current_account ( ) );
 
     return FALSE;
 }
diff --git a/src/categories_onglet.c b/src/categories_onglet.c
index 8da6a90..07a785a 100644
--- a/src/categories_onglet.c
+++ b/src/categories_onglet.c
@@ -40,7 +40,6 @@
 #include "gsb_file.h"
 #include "gsb_file_others.h"
 #include "gsb_transactions_list.h"
-#include "main.h"
 #include "meta_categories.h"
 #include "metatree.h"
 #include "mouse.h"
diff --git a/src/erreur.c b/src/erreur.c
index 0e93d7b..c795859 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -36,19 +36,14 @@
 #include "erreur.h"
 #include "dialog.h"
 #include "grisbi_app.h"
-#include "grisbi_window.h"
 #include "gsb_dirs.h"
 #include "gsb_file.h"
 #include "gsb_file_save.h"
 #include "gsb_file_util.h"
-#include "gsb_plugins.h"
-#include "gsb_real.h"
 #include "gsb_status.h"
 #include "import.h"
-#include "main.h"
-#include "utils.h"
+#include "gsb_locale.h"
 #include "utils_str.h"
-#include "menu.h"
 /*END_INCLUDE*/
 
 #ifdef HAVE_BACKTRACE
@@ -234,20 +229,38 @@ void traitement_sigsegv ( gint signal_nb )
 }
 
 /**
- * initialise show_grisbi_debug a TRUE si on souhaite le debug
+ * initialise le niveau de debug de grisbi
  *
- * \param
+ * \param niveau de débug entré en ligne de commande
  *
  * \return
  */
-void initialize_debugging ( void )
+void initialize_debugging ( gint cde_line_debug_level )
 {
     /* un int pour stocker le level de debug et une chaine qui contient sa version texte */
+    gint number = 0;
     gchar *debug_level = "";
     gchar *tmpstr1;
     gchar *tmpstr2;
 
-    if ( ( debugging_grisbi = gsb_main_get_debug_level ( ) ) )
+    if ( IS_DEVELOPMENT_VERSION )
+        number = 1;
+
+    /* on garde le niveau mini de débogage si $DEBUG_GRISBI n'existe pas */
+    if ( number )
+    {
+        if ( getenv ( "DEBUG_GRISBI" ) )
+            number = utils_str_atoi ( getenv ( "DEBUG_GRISBI" ) );
+    }
+    if ( cde_line_debug_level == -1 )
+        debugging_grisbi = number;
+    else
+        debugging_grisbi = cde_line_debug_level;
+
+    if ( debugging_grisbi > MAX_DEBUG_LEVEL )
+        debugging_grisbi = MAX_DEBUG_LEVEL;
+
+    if ( debugging_grisbi )
     {
         /* on renseigne le texte du level de debug */
         switch ( debugging_grisbi )
@@ -272,6 +285,20 @@ void initialize_debugging ( void )
     }
 }
 
+
+/**
+ * renvoie le niveau de débug
+ *
+ * \param
+ *
+ * \return debug_level
+ */
+gint gsb_debug_get_debug_level ( void )
+{
+    return debugging_grisbi;
+}
+
+
 /**
  * return a string with the current time
  * use to debug lines
@@ -446,7 +473,7 @@ void debug_message_real ( gchar *prefixe,
 /**
  * Print the backtrace upon segfault.
  */
-GtkWidget * print_backtrace ( void )
+GtkWidget *print_backtrace ( void )
 {
 #ifdef HAVE_BACKTRACE
     void *backtrace_content[15];
@@ -558,7 +585,7 @@ gboolean gsb_debug_start_log ( void )
         g_free ( tmp_str );
 
         /* write locales */
-        tmp_str = gsb_main_get_print_locale_var ( );
+        tmp_str = gsb_locale_get_print_locale_var ( );
 
         fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
         fflush ( debug_file );
@@ -575,7 +602,7 @@ gboolean gsb_debug_start_log ( void )
 
         g_free ( tmp_str );
 
-        tmp_str = gsb_main_get_print_dir_var ( );
+        tmp_str = gsb_dirs_get_print_dir_var ( );
 
         fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
         fflush ( debug_file );
@@ -652,6 +679,7 @@ void debug_print_log_string ( gchar *prefixe,
     g_free ( message );
 }
 
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/erreur.h b/src/erreur.h
index f7a0ef3..e34afea 100644
--- a/src/erreur.h
+++ b/src/erreur.h
@@ -57,9 +57,10 @@ void debug_print_log_string ( gchar *prefixe,
                         gint line,
                         const char *function,
                         const gchar *msg );
-gboolean gsb_debug_start_log ( void );
 void gsb_debug_finish_log ( void );
-void initialize_debugging ( void );
+gint gsb_debug_get_debug_level ( void );
+gboolean gsb_debug_start_log ( void );
+void initialize_debugging ( gint cde_line_debug_level );
 void traitement_sigsegv ( gint signal_nb );
 /* END_DECLARATION */
 #endif
diff --git a/src/export_csv.c b/src/export_csv.c
index 88775f5..c5c0d3b 100644
--- a/src/export_csv.c
+++ b/src/export_csv.c
@@ -50,7 +50,6 @@
 #include "gsb_data_transaction.h"
 #include "gsb_file_util.h"
 #include "gsb_real.h"
-#include "main.h"
 #include "utils_real.h"
 #include "utils_str.h"
 #include "utils_files.h"
diff --git a/src/fenetre_principale.c b/src/fenetre_principale.c
index f330c84..c68248a 100644
--- a/src/fenetre_principale.c
+++ b/src/fenetre_principale.c
@@ -46,7 +46,6 @@
 #include "gsb_scheduler_list.h"
 #include "gsb_transactions_list.h"
 #include "imputation_budgetaire.h"
-#include "main.h"
 #include "navigation.h"
 #include "structures.h"
 #include "tiers_onglet.h"
diff --git a/src/grisbi_app.c b/src/grisbi_app.c
index 01ba5bc..6d37e08 100644
--- a/src/grisbi_app.c
+++ b/src/grisbi_app.c
@@ -32,7 +32,9 @@
 
 /*START_INCLUDE*/
 #include "grisbi_app.h"
+#include "accueil.h"
 #include "gsb_color.h"
+#include "gsb_data_account.h"
 #include "gsb_dirs.h"
 #include "gsb_file.h"
 #include "gsb_file_config.h"
@@ -681,17 +683,92 @@ gboolean grisbi_app_set_active_file_title ( const gchar *file_title )
  *
  * \return TRUE
  **/
-gboolean grisbi_app_set_active_title ( const gchar *title )
+gboolean grisbi_app_set_active_title ( gint account_number )
 {
     GrisbiApp *app;
     GrisbiWindow *window;
+    GrisbiAppConf *conf;
+    gchar *nom_fichier_comptes;
+    const gchar *titre_fichier;
+    gchar *titre_grisbi = NULL;
+    gchar *titre = NULL;
+    gint tmp_number;
+    gboolean return_value;
+
+    devel_debug_int ( account_number );
 
     app = grisbi_app_get_default ( );
     window = grisbi_app_get_active_window ( app );
+    conf = app->priv->conf;
 
-    grisbi_window_set_window_title ( window, title );
+    titre_fichier = grisbi_app_get_active_file_title ();
+    nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+    if ( nom_fichier_comptes == NULL )
+    {
+        titre_grisbi = g_strdup ( _("Grisbi") );
+        return_value = TRUE;
+    }
+    else
+    {
+        switch ( conf->display_grisbi_title )
+        {
+            case GSB_ACCOUNTS_TITLE:
+            {
+                if ( titre_fichier && strlen ( titre_fichier ) )
+                    titre = g_strdup ( titre_fichier );
+            }
+            break;
+            case GSB_ACCOUNT_HOLDER:
+            {
+                if ( account_number == -1 )
+                    tmp_number = gsb_data_account_first_number ( );
+                else
+                    tmp_number = account_number;
+
+                if ( tmp_number == -1 )
+                {
+                    if ( titre_fichier && strlen ( titre_fichier ) )
+                        titre = g_strdup ( titre_fichier );
+                }
+                else
+                {
+                    titre = g_strdup ( gsb_data_account_get_holder_name ( tmp_number ) );
+
+                    if ( titre == NULL )
+                        titre = g_strdup ( gsb_data_account_get_name ( tmp_number ) );
+                }
+            break;
+            }
+            case GSB_ACCOUNTS_FILE:
+                if ( nom_fichier_comptes && strlen ( nom_fichier_comptes ) )
+                    titre = g_path_get_basename ( nom_fichier_comptes );
+            break;
+        }
+
+        g_free ( nom_fichier_comptes );
+
+        if ( titre && strlen ( titre ) > 0 )
+        {
+            titre_grisbi = g_strconcat ( titre, " - ", _("Grisbi"), NULL );
+            g_free ( titre );
+
+            return_value = TRUE;
+        }
+        else
+        {
+            titre_grisbi = g_strconcat ( "<", _("unnamed"), ">", NULL );
+            return_value = FALSE;
+        }
+    }
+    grisbi_window_set_window_title ( window, titre_grisbi );
 
-    return TRUE;
+    gsb_main_page_update_homepage_title ( titre_grisbi );
+
+    if ( titre_grisbi && strlen ( titre_grisbi ) > 0 )
+        g_free ( titre_grisbi );
+
+    /* return */
+    return return_value;
 }
 
 
diff --git a/src/grisbi_app.h b/src/grisbi_app.h
index 79ddfd3..9ff0ea1 100644
--- a/src/grisbi_app.h
+++ b/src/grisbi_app.h
@@ -61,7 +61,7 @@ const GList	*grisbi_app_get_windows ( GrisbiApp *app );
 gboolean grisbi_app_quit ( void );
 gboolean grisbi_app_set_active_filename ( const gchar *filename );
 gboolean grisbi_app_set_active_file_title ( const gchar *filename );
-gboolean grisbi_app_set_active_title ( const gchar *title );
+gboolean grisbi_app_set_active_title ( gint account_number );
 /* END_DECLARATION */
 
 G_END_DECLS
diff --git a/src/grisbi_osx.c b/src/grisbi_osx.c
index 7f3f12a..c4d9eac 100644
--- a/src/grisbi_osx.c
+++ b/src/grisbi_osx.c
@@ -46,7 +46,6 @@
 #include "file_obfuscate.h"
 #include "file_obfuscate_qif.h"
 #include "import.h"
-#include "main.h"
 #include "menu.h"
 #include "parametres.h"
 #include "structures.h"
diff --git a/src/grisbi_ui.h b/src/grisbi_ui.h
index ddb0da6..38697a9 100644
--- a/src/grisbi_ui.h
+++ b/src/grisbi_ui.h
@@ -22,7 +22,6 @@
 #include "gsb_transactions_list.h"
 #include "help.h"
 #include "import.h"
-#include "main.h"
 #include "menu.h"
 #include "parametres.h"
 #include "tip.h"
diff --git a/src/grisbi_window.c b/src/grisbi_window.c
index 85f9bc3..beeeec3 100644
--- a/src/grisbi_window.c
+++ b/src/grisbi_window.c
@@ -508,25 +508,6 @@ static void grisbi_window_add_recents_sub_menu ( GtkUIManager *ui_manager,
 }
 
 
-/* TITLE OF MAIN WINDOW */
-/**
- * set window title
- *
- *
- *
- * */
-void grisbi_window_set_window_title ( GrisbiWindow *window,
-                        const gchar *title )
-{
-    if ( window->priv->window_title )
-        g_free ( window->priv->window_title );
-
-    window->priv->window_title = g_strdup ( title );
-
-    gtk_window_set_title ( GTK_WINDOW ( window ), title );
-}
-
-
 /* GTK_BUILDER */
 /**
  * Crée un builder et récupère les widgets du fichier grisbi.ui
@@ -584,7 +565,7 @@ gboolean grisbi_window_set_filename ( GrisbiWindow *window,
 }
 
 
-/* TITLE OF FILE */
+/* TITLES */
 /**
  * retourne le titre du fichier associé à la fenêtre
  *
@@ -618,6 +599,26 @@ gboolean grisbi_window_set_file_title ( GrisbiWindow *window,
 }
 
 
+/**
+ * set window title
+ *
+ * \param GrisbiWindow
+ * \param title
+ *
+ * \return
+ * */
+void grisbi_window_set_window_title ( GrisbiWindow *window,
+                        const gchar *title )
+{
+    if ( window->priv->window_title )
+        g_free ( window->priv->window_title );
+
+    window->priv->window_title = g_strdup ( title );
+
+    gtk_window_set_title ( GTK_WINDOW ( window ), title );
+}
+
+
 /* STATUS_BAR */
 /**
  * Create and return a new GtkStatusBar to hold various status
diff --git a/src/gsb_account.c b/src/gsb_account.c
index 9ffce4a..24e8e4d 100644
--- a/src/gsb_account.c
+++ b/src/gsb_account.c
@@ -44,7 +44,6 @@
 #include "menu.h"
 #include "gsb_real.h"
 #include "gsb_scheduler_list.h"
-#include "main.h"
 #include "traitement_variables.h"
 #include "tiers_onglet.h"
 #include "categories_onglet.h"
diff --git a/src/gsb_account_property.c b/src/gsb_account_property.c
index 434a972..42585c8 100644
--- a/src/gsb_account_property.c
+++ b/src/gsb_account_property.c
@@ -2,7 +2,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2009 Cédric Auger (cedric at grisbi.org)            */
 /*          2004-2009 Benjamin Drieu (bdrieu at april.org)                       */
-/*                      2009 Pierre Biava (grisbi at pierre.biava.name)          */
+/*                      2009_2012 Pierre Biava (grisbi at pierre.biava.name)     */
 /*      2009 Thomas Peel (thomas.peel at live.fr)                                */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
@@ -39,34 +39,34 @@
 
 /*START_INCLUDE*/
 #include "gsb_account_property.h"
+#include "accueil.h"
+#include "categories_onglet.h"
 #include "dialog.h"
+#include "grisbi_app.h"
 #include "gsb_account.h"
 #include "gsb_autofunc.h"
 #include "gsb_bank.h"
-#include "utils_buttons.h"
 #include "gsb_currency.h"
 #include "gsb_data_account.h"
 #include "gsb_data_bank.h"
 #include "gsb_data_currency.h"
 #include "gsb_data_transaction.h"
-#include "utils_editables.h"
 #include "gsb_file.h"
 #include "gsb_form.h"
 #include "gsb_form_scheduler.h"
-#include "navigation.h"
-#include "accueil.h"
-#include "menu.h"
 #include "gsb_scheduler_list.h"
-#include "main.h"
-#include "traitement_variables.h"
-#include "utils_str.h"
-#include "utils.h"
-#include "tiers_onglet.h"
-#include "categories_onglet.h"
+#include "gsb_transactions_list.h"
 #include "imputation_budgetaire.h"
-#include "transaction_list.h"
+#include "menu.h"
+#include "navigation.h"
 #include "structures.h"
-#include "gsb_transactions_list.h"
+#include "tiers_onglet.h"
+#include "traitement_variables.h"
+#include "transaction_list.h"
+#include "utils.h"
+#include "utils_buttons.h"
+#include "utils_editables.h"
+#include "utils_str.h"
 #include "erreur.h"
 /*END_INCLUDE*/
 
@@ -1537,7 +1537,7 @@ gboolean gsb_account_property_focus_out ( GtkWidget *widget,
         payees_fill_list ();
         break;
     case PROPERTY_HOLDER_NAME:
-        gsb_main_set_grisbi_title ( account_number );
+        grisbi_app_set_active_title ( account_number );
         break;
     }
 
diff --git a/src/gsb_currency_config.c b/src/gsb_currency_config.c
index 7b09cfe..71ba42e 100644
--- a/src/gsb_currency_config.c
+++ b/src/gsb_currency_config.c
@@ -48,7 +48,6 @@
 #include "gsb_file.h"
 #include "gsb_locale.h"
 #include "imputation_budgetaire.h"
-#include "main.h"
 #include "parametres.h"
 #include "structures.h"
 #include "tiers_onglet.h"
diff --git a/src/gsb_dirs.c b/src/gsb_dirs.c
index d9a6ac2..6e3491b 100644
--- a/src/gsb_dirs.c
+++ b/src/gsb_dirs.c
@@ -33,6 +33,7 @@
 #endif /* !G_OS_WIN32 */
 
 #include "include.h"
+#include "gsb_file_config.h"
 #include "gsb_dirs.h"
 #include "structures.h"
 
@@ -256,6 +257,52 @@ const gchar *gsb_dirs_get_home_dir ( void )
 }
 
 
+/**
+ * retourne une chaine avec les principaux répertoires
+ *
+ * \param
+ *
+ * \return must be freed
+ */
+gchar *gsb_dirs_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"
+                        "\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",
+                        home_dir,
+                        user_config_dir,
+                        conf_filename,
+                        accel_filename,
+                        user_data_dir,
+                        DATA_PATH,
+                        categories_dir,
+                        locale_dir,
+                        plugins_dir,
+                        pixmaps_dir,
+                        ui_dir );
+
+    g_free ( accel_filename );
+
+    return path_str;
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/gsb_dirs.h b/src/gsb_dirs.h
index ffb779a..f9453f6 100644
--- a/src/gsb_dirs.h
+++ b/src/gsb_dirs.h
@@ -15,6 +15,7 @@ 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 );
+gchar *gsb_dirs_get_print_dir_var ( void );
 const gchar *gsb_dirs_get_ui_dir ( void );
 const gchar *gsb_dirs_get_user_config_dir ( void );
 const gchar *gsb_dirs_get_user_data_dir ( void );
diff --git a/src/gsb_file.c b/src/gsb_file.c
index 0a52e9a..2fd0a9e 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -52,7 +52,6 @@
 #include "gsb_real.h"
 #include "gsb_status.h"
 #include "gsb_transactions_list.h"
-#include "main.h"
 #include "menu.h"
 #include "navigation.h"
 #include "parametres.h"
@@ -487,7 +486,7 @@ gboolean gsb_file_open_file ( gchar *filename )
     }
 
     /* set Grisbi title */
-    gsb_main_set_grisbi_title ( -1 );
+    grisbi_app_set_active_title ( -1 );
 
     /* update the main page */
     mise_a_jour_accueil (TRUE);
@@ -628,7 +627,7 @@ gboolean gsb_file_save_file ( gint origine )
         /* update variables */
         etat.fichier_deja_ouvert = 0;
             gsb_file_set_modified ( FALSE );
-        gsb_main_set_grisbi_title ( gsb_gui_navigation_get_current_account ( ) );
+        grisbi_app_set_active_title ( gsb_gui_navigation_get_current_account ( ) );
         gsb_file_append_name_to_opened_list ( nouveau_nom_enregistrement );
 
         g_free ( nouveau_nom_enregistrement );
@@ -1038,7 +1037,7 @@ gboolean gsb_file_close ( void )
 /*        init_variables ();
         gsb_account_property_clear_config ( );
 */
-        gsb_main_set_grisbi_title ( -1 );
+        grisbi_app_set_active_title ( -1 );
 
         menus_sensitifs ( FALSE );
 
diff --git a/src/gsb_locale.c b/src/gsb_locale.c
index 3b1d6b9..59bdaf9 100644
--- a/src/gsb_locale.c
+++ b/src/gsb_locale.c
@@ -104,3 +104,39 @@ void gsb_locale_set_mon_thousands_sep ( const gchar *thousands_sep )
     g_free ( _locale -> mon_thousands_sep );
     _locale -> mon_thousands_sep = g_strdup ( thousands_sep );
 }
+
+
+/**
+ *
+ *  \return must be freed
+ *
+ */
+gchar *gsb_locale_get_print_locale_var ( void )
+{
+    gchar *locale_str = NULL;
+
+    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"),
+                        _locale->currency_symbol,
+                        _locale -> mon_thousands_sep,
+                        _locale -> mon_decimal_point,
+                        _locale -> positive_sign,
+                        _locale -> negative_sign,
+                        _locale -> p_cs_precedes,
+                        _locale -> frac_digits );
+
+    return locale_str;
+}
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
diff --git a/src/gsb_locale.h b/src/gsb_locale.h
index d6f99de..02eb375 100644
--- a/src/gsb_locale.h
+++ b/src/gsb_locale.h
@@ -11,5 +11,5 @@ gchar        *gsb_locale_get_mon_decimal_point ( void );
 void          gsb_locale_set_mon_decimal_point ( const gchar *decimal_point );
 gchar        *gsb_locale_get_mon_thousands_sep ( void );
 void          gsb_locale_set_mon_thousands_sep ( const gchar *thousands_sep );
-
+gchar        *gsb_locale_get_print_locale_var ( void );
 #endif
diff --git a/src/gsb_scheduler.c b/src/gsb_scheduler.c
index b2ea4f3..ca70cb5 100644
--- a/src/gsb_scheduler.c
+++ b/src/gsb_scheduler.c
@@ -45,7 +45,6 @@
 #include "gsb_file.h"
 #include "gsb_scheduler_list.h"
 #include "gsb_transactions_list.h"
-#include "main.h"
 #include "structures.h"
 #include "traitement_variables.h"
 #include "utils_dates.h"
diff --git a/src/gsb_status.c b/src/gsb_status.c
index 414a882..3db738d 100644
--- a/src/gsb_status.c
+++ b/src/gsb_status.c
@@ -35,7 +35,6 @@
 #include "gsb_status.h"
 #include "grisbi_app.h"
 #include "grisbi_window.h"
-#include "main.h"
 #include "structures.h"
 #include "utils.h"
 /*END_INCLUDE*/
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index d5723b5..13963ea 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -62,7 +62,6 @@
 #include "gsb_reconcile.h"
 #include "gsb_scheduler_list.h"
 #include "import.h"
-#include "main.h"
 #include "menu.h"
 #include "mouse.h"
 #include "navigation.h"
diff --git a/src/import.c b/src/import.c
index a17c334..5d1cc2d 100644
--- a/src/import.c
+++ b/src/import.c
@@ -66,7 +66,6 @@
 #include "gsb_transactions_list.h"
 #include "gtk_combofix.h"
 #include "import_csv.h"
-#include "main.h"
 #include "menu.h"
 #include "navigation.h"
 #include "parametres.h"
diff --git a/src/imputation_budgetaire.c b/src/imputation_budgetaire.c
index 0ae5ec4..266b22e 100644
--- a/src/imputation_budgetaire.c
+++ b/src/imputation_budgetaire.c
@@ -45,7 +45,6 @@
 #include "gsb_form_widget.h"
 #include "gsb_transactions_list.h"
 #include "gtk_combofix.h"
-#include "main.h"
 #include "meta_budgetary.h"
 #include "metatree.h"
 #include "mouse.h"
diff --git a/src/main.c b/src/main.c
index 972497e..37c9ce0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,42 +36,27 @@
 
 /*START_INCLUDE*/
 #include "main.h"
-#include "accueil.h"
 #include "dialog.h"
 #include "grisbi_app.h"
 #include "gsb_assistant_first.h"
-#include "gsb_color.h"
-#include "gsb_data_account.h"
 #include "gsb_dirs.h"
 #include "gsb_file.h"
 #include "gsb_file_config.h"
 #include "gsb_locale.h"
 #include "gsb_plugins.h"
-#include "gsb_status.h"
-#include "import.h"
-#include "menu.h"
 #include "parse_cmdline.h"
-#include "structures.h"
 #include "tip.h"
-#include "traitement_variables.h"
-#include "utils.h"
-#include "utils_str.h"
 #include "erreur.h"
 /*END_INCLUDE*/
 
 
 /*START_STATIC*/
-static gboolean gsb_main_change_state_window ( GtkWidget *window,
-                        GdkEventWindowState *event,
-                        gpointer null );
 static void gsb_main_grisbi_shutdown ( GrisbiCommandLine *command_line );
 static gboolean gsb_main_init_app ( void );
 static void gsb_main_load_file_if_necessary ( GrisbiCommandLine *command_line );
 static gboolean gsb_main_print_environment_var ( void );
 static gint gsb_main_set_debug_level ( GrisbiCommandLine *command_line );
 static void gsb_main_trappe_signal_sigsegv ( void );
-static gboolean gsb_main_window_delete_event (GtkWidget *window, gpointer data);
-static void gsb_main_window_destroy_event ( GObject* obj, gpointer data);
 static void gsb_main_window_set_size_and_position ( void );
 /*END_STATIC*/
 
@@ -82,8 +67,6 @@ static void gsb_main_window_set_size_and_position ( void );
 /* variables initialisées lors de l'exécution de grisbi */
 struct gsb_run_t run;
 
-/* Options pour grisbi */
-static gint debug_level = -1;
 
 /**
  * Main function
@@ -124,12 +107,11 @@ gint main ( int argc, char **argv )
         exit ( return_value );
 
     /* initialisation du mode de débogage */
-    debug_level = gsb_main_set_debug_level ( command_line );
-    initialize_debugging ();
+    initialize_debugging ( grisbi_command_line_get_debug_level ( command_line ) );
 
     /* initialisation et sortie si nécessaire de la variable locale pour les devises */
     gsb_locale_init ( );
-    if ( debug_level > 0 )
+    if ( gsb_debug_get_debug_level () > 0 )
         gsb_main_print_environment_var ();
 
     /* initialisation du nom du fichier de configuration */
@@ -187,7 +169,7 @@ gboolean gsb_main_print_environment_var ( void )
 
     g_print ("Variables d'environnement :\n" );
 
-    tmp_str = gsb_main_get_print_locale_var ( );
+    tmp_str = gsb_locale_get_print_locale_var ( );
     g_print ("%s", tmp_str);
 
     g_free ( tmp_str );
@@ -197,7 +179,7 @@ gboolean gsb_main_print_environment_var ( void )
                         G_GINT64_MODIFIER,
                         G_MAXINT64 );
 
-    tmp_str = gsb_main_get_print_dir_var ( );
+    tmp_str = gsb_dirs_get_print_dir_var ( );
     g_print ("%s", tmp_str);
 
     g_free ( tmp_str );
@@ -207,7 +189,7 @@ gboolean gsb_main_print_environment_var ( void )
 
 
 /**
- * detourne le signal SIGSEGV
+ * On detourne les signaaux SIGINT, SIGTERM, SIGSEGV
  *
  *
  *
@@ -226,7 +208,7 @@ void gsb_main_trappe_signal_sigsegv ( void )
         g_print ( _("Error on sigaction: SIGINT won't be trapped\n") );
 
     if ( sigaction ( SIGTERM, &sig_sev, NULL ) )
-        g_print ( _("Error on sigaction: SIGINT won't be trapped\n") );
+        g_print ( _("Error on sigaction: SIGTERM won't be trapped\n") );
 
     if ( sigaction ( SIGSEGV, &sig_sev, NULL ) )
         g_print ( _("Error on sigaction: SIGSEGV won't be trapped\n") );
@@ -268,271 +250,6 @@ void gsb_main_load_file_if_necessary ( GrisbiCommandLine *command_line )
 
 
 /**
- * check on any change on the main window
- * for now, only to check if we set/unset the full-screen
- *
- * \param window
- * \param event
- * \param null
- *
- * \return FALSE
- * */
-gboolean gsb_main_change_state_window ( GtkWidget *window,
-                        GdkEventWindowState *event,
-                        gpointer null )
-{
-    if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
-    {
-        GrisbiAppConf *conf;
-
-        conf = grisbi_app_get_conf ( );
-
-        if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
-            conf->full_screen = TRUE;
-        else
-            conf->full_screen = FALSE;
-    }
-    return FALSE;
-}
-
-/**
- * close grisbi by destroying the main window
- * This function is called by the Quit menu option.
- *
- * \param
- *
- * \return FALSE
- * */
-gboolean gsb_main_grisbi_close ( void )
-{
-    GrisbiApp *app;
-    GrisbiWindow *main_window;
-    GrisbiAppConf *conf;
-
-    app = grisbi_app_get_default ( );
-    conf = grisbi_app_get_conf ( );
-
-    /* on récupère la fenetre active */
-    main_window = grisbi_app_get_active_window ( app );
-
-    /* sauvegarde la position de la fenetre principale */
-    gtk_window_get_position ( GTK_WINDOW ( main_window ), &conf->root_x, &conf->root_y );
-
-    if ( !gsb_main_window_delete_event ( GTK_WIDGET ( main_window ), NULL ) )
-        gtk_widget_destroy ( GTK_WIDGET ( main_window ) );
-
-    /* clean finish of the debug file */
-    if ( etat.debug_mode )
-        gsb_debug_finish_log ( );
-
-    return FALSE;
-}
-
-/**
- * This function is called when the main window is deleted.
- * It proposes to save the file if necessary.
- */
-static gboolean gsb_main_window_delete_event (GtkWidget *window, gpointer data)
-{
-    devel_debug (NULL);
-
-    /* need to save the config before gsb_file_close */
-/*    gsb_file_config_save_config (); */
-
-    if (!gsb_file_close ())
-        return TRUE;
-    return FALSE;
-}
-
-/**
- * exit the gtk main loop when the main window is destroyed.
- */
-static void gsb_main_window_destroy_event ( GObject* obj, gpointer data)
-{
-/*    free_variables();
-    main_window = NULL;
-    gtk_main_quit();
-*/
-}
-
-
-/**
- * set Grisbi title
- *
- *
- *
- * */
-gboolean gsb_main_set_grisbi_title ( gint account_number )
-{
-    gchar *nom_fichier_comptes;
-    const gchar *titre_fichier;
-    gchar *titre_grisbi = NULL;
-    gchar *titre = NULL;
-    gint tmp_number;
-    gboolean return_value;
-    GrisbiAppConf *conf;
-
-    devel_debug_int ( account_number );
-    conf = grisbi_app_get_conf ( );
-
-    titre_fichier = grisbi_app_get_active_file_title ();
-    nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
-    if ( nom_fichier_comptes == NULL )
-    {
-        titre_grisbi = g_strdup ( _("Grisbi") );
-        return_value = TRUE;
-    }
-    else
-    {
-        switch ( conf->display_grisbi_title )
-        {
-            case GSB_ACCOUNTS_TITLE:
-            {
-                if ( titre_fichier && strlen ( titre_fichier ) )
-                    titre = g_strdup ( titre_fichier );
-            }
-            break;
-            case GSB_ACCOUNT_HOLDER:
-            {
-                if ( account_number == -1 )
-                    tmp_number = gsb_data_account_first_number ( );
-                else
-                    tmp_number = account_number;
-
-                if ( tmp_number == -1 )
-                {
-                    if ( titre_fichier && strlen ( titre_fichier ) )
-                        titre = g_strdup ( titre_fichier );
-                }
-                else
-                {
-                    titre = g_strdup ( gsb_data_account_get_holder_name ( tmp_number ) );
-
-                    if ( titre == NULL )
-                        titre = g_strdup ( gsb_data_account_get_name ( tmp_number ) );
-                }
-            break;
-            }
-            case GSB_ACCOUNTS_FILE:
-                if ( nom_fichier_comptes && strlen ( nom_fichier_comptes ) )
-                    titre = g_path_get_basename ( nom_fichier_comptes );
-            break;
-        }
-
-        g_free ( nom_fichier_comptes );
-
-        if ( titre && strlen ( titre ) > 0 )
-        {
-            titre_grisbi = g_strconcat ( titre, " - ", _("Grisbi"), NULL );
-            g_free ( titre );
-
-            return_value = TRUE;
-        }
-        else
-        {
-            titre_grisbi = g_strconcat ( "<", _("unnamed"), ">", NULL );
-            return_value = FALSE;
-        }
-    }
-    grisbi_app_set_active_title ( titre_grisbi );
-
-    gsb_main_page_update_homepage_title ( titre_grisbi );
-
-    if ( titre_grisbi && strlen ( titre_grisbi ) > 0 )
-        g_free ( titre_grisbi );
-
-    /* return */
-    return return_value;
-}
-
-
-/**
- *
- *  \return must be freed
- *
- */
-gchar *gsb_main_get_print_locale_var ( void )
-{
-    struct lconv *conv;
-    gchar *locale_str = NULL;
-    gchar *positive_sign;
-    gchar *negative_sign;
-
-    /* test local pour les nombres */
-    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"
-                        "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,
-                        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 ( positive_sign );
-    g_free ( negative_sign );
-
-    return locale_str;
-}
-
-
-/**
- *
- *  \return must be freed
- *
- */
-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"
-                        "\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",
-                        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 ( ),
-                        gsb_dirs_get_plugins_dir ( ),
-                        gsb_dirs_get_pixmaps_dir ( ),
-                        gsb_dirs_get_ui_dir ( ) );
-
-    g_free ( accel_filename );
-
-    return path_str;
-}
-
-
-/**
  * renvoie la version de Grisbi
  *
  * \param
@@ -552,56 +269,6 @@ g_print ( N_("Grisbi version %s, %s\n"), VERSION, gsb_plugin_get_list ( ) );
 
 
 /**
- * renvoie le niveau de débug
- *
- * \param
- *
- * \return debug_level
- */
-gint gsb_main_get_debug_level ( void )
-{
-    return debug_level;
-}
-
-
-/**
- * positionne la variable debug_mode à 0 si version stable et
- * à DEBUG_GRISBI ou une valeur passée en paramètre
- *
- * \param
- *
- * \return debug_mode
- */
-gint gsb_main_set_debug_level ( GrisbiCommandLine *command_line )
-{
-    gchar **tab;
-    gint number = 0;
-    gint number_1;
-    gint debug_level;
-
-    debug_level = grisbi_command_line_get_debug_level ( command_line );
-
-    tab = g_strsplit ( VERSION, ".", 3 );
-    number_1 = utils_str_atoi ( tab[1] );
-
-    number = number_1 % 2;
-    /* on garde le niveau mini de débogage si $DEBUG_GRISBI n'existe pas */
-    if ( number )
-    {
-        if ( getenv ( "DEBUG_GRISBI" ) )
-            number = utils_str_atoi ( getenv ( "DEBUG_GRISBI" ) );
-    }
-    if ( debug_level == -1 )
-        debug_level = number;
-
-    if ( debug_level > MAX_DEBUG_LEVEL )
-        debug_level = MAX_DEBUG_LEVEL;
-
-    return debug_level;
-}
-
-
-/**
  *  procédure appelée après gtk_main_quit termine Grisbi
  *
  * \param
diff --git a/src/main.h b/src/main.h
index 8496325..ddb9a15 100644
--- a/src/main.h
+++ b/src/main.h
@@ -9,10 +9,7 @@
 
 /* START_DECLARATION */
 gboolean gsb_main_get_debug_level ( void );
-gboolean gsb_main_grisbi_close ( void );
-gchar *gsb_main_get_print_dir_var ( void );
 gchar *gsb_main_get_print_locale_var ( void );
-gboolean gsb_main_set_grisbi_title ( gint account_number );
 void gsb_main_show_version ( void );
 gint main ( gint argc, gchar **argv );
 /* END_DECLARATION */
diff --git a/src/navigation.c b/src/navigation.c
index 0fa272c..3132a1c 100644
--- a/src/navigation.c
+++ b/src/navigation.c
@@ -57,7 +57,6 @@
 #include "gsb_scheduler_list.h"
 #include "gsb_transactions_list.h"
 #include "imputation_budgetaire.h"
-#include "main.h"
 #include "menu.h"
 #include "metatree.h"
 #include "mouse.h"
@@ -1019,7 +1018,7 @@ gboolean navigation_change_account ( gint new_account )
 
     /* Update the title of the file if needed */
     if ( conf->display_grisbi_title == GSB_ACCOUNT_HOLDER )
-        gsb_main_set_grisbi_title ( new_account );
+        grisbi_app_set_active_title ( new_account );
 
     bet_data_select_bet_pages ( new_account );
 
diff --git a/src/plugins/openssl/openssl.c b/src/plugins/openssl/openssl.c
index 625f68b..c4d6b13 100644
--- a/src/plugins/openssl/openssl.c
+++ b/src/plugins/openssl/openssl.c
@@ -37,7 +37,6 @@
 #include "openssl.h"
 #include "dialog.h"
 #include "grisbi_app.h"
-#include "main.h"
 #include "structures.h"
 #include "erreur.h"
 /*END_INCLUDE*/
diff --git a/src/structures.h b/src/structures.h
index 4530f9d..3e6b1d3 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -13,9 +13,6 @@
  * to VERSION_GRISBI */
 #define VERSION_FICHIER "0.6.0"
 
-/* Define this when in Git development branch. */
-#define IS_DEVELOPMENT_VERSION 1
-
 #define VERSION_FICHIER_ETAT "0.6.0"
 #define VERSION_FICHIER_CATEG "0.6.0"
 #define VERSION_FICHIER_IB "0.6.0"
@@ -214,8 +211,6 @@ struct gsb_conf_t
 
 };
 
-/* declared in gsb_file_config.c */
-extern struct gsb_conf_t conf;
 
 /** structure run
  * variables containing just 0 or 1
diff --git a/src/tests/main_cunit.c b/src/tests/main_cunit.c
index 28bb9f1..4251ceb 100644
--- a/src/tests/main_cunit.c
+++ b/src/tests/main_cunit.c
@@ -62,7 +62,7 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
     return FALSE;
 }
 gchar *gsb_main_get_print_locale_var(void) { return NULL; }
-gchar *gsb_main_get_print_dir_var(void) { return NULL; }
+gchar *gsb_dirs_get_print_dir_var(void) { return NULL; }
 
 /* End of unnecessary things */
 
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index 15fc001..605813e 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -76,7 +76,6 @@
 #include "gsb_select_icon.h"
 #include "gsb_transactions_list.h"
 #include "import.h"
-#include "main.h"
 #include "menu.h"
 #include "navigation.h"
 #include "structures.h"


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list