[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.2, 1.3 balance_estimate_tab.c, 1.34, 1.35 balance_estimate_tab.h, 1.5, 1.6 barre_outils.c, 1.129, 1.130 gsb_autofunc.c, 1.24, 1.25 gsb_data_fyear.c, 1.20, 1.21 gsb_data_partial_balance.c, 1.10, 1.11 gsb_file_others.c, 1.32, 1.33 gsb_form.c, 1.144, 1.145 gsb_fyear.c, 1.11, 1.12 gsb_fyear.h, 1.8, 1.9 import.c, 1.320, 1.321 structures.h, 1.237, 1.238 traitement_variables.c, 1.183, 1.184 utils_str.c, 1.79, 1.80

Pierre Biava pbiava at users.sourceforge.net
Thu Jan 28 21:25:14 CET 2010


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv25683/src

Modified Files:
	balance_estimate_config.c balance_estimate_tab.c 
	balance_estimate_tab.h barre_outils.c gsb_autofunc.c 
	gsb_data_fyear.c gsb_data_partial_balance.c gsb_file_others.c 
	gsb_form.c gsb_fyear.c gsb_fyear.h import.c structures.h 
	traitement_variables.c utils_str.c 
Log Message:
minor corrections

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -d -r1.237 -r1.238
--- structures.h	10 Dec 2009 22:02:33 -0000	1.237
+++ structures.h	28 Jan 2010 20:25:12 -0000	1.238
@@ -27,19 +27,22 @@
 #define PRESPACIFY(s) (g_strconcat ( " ", s, NULL ))
 #define POSTSPACIFY(s) (g_strconcat ( s, " ", NULL ))
 
-
 #define CSV_MAX_TOP_LINES 10	/** How many lines to show in CSV preview.  */
 
-/* variables contenant juste 0 ou 1 */
-/* FIXME : scinder cette structure en 3 parties : */
-/* la partie configurée par le fichier */
-/* la partie configurée par la conf */
-/* la partie configurée pendant le fonctionnement de grisbi */
+/** structure etat
+ * variables contenant juste 0 ou 1
+ * FIXME : scinder cette structure en 3 parties :
+ * la partie configurée par le fichier
+ * la partie configurée par la conf
+ * la partie configurée pendant le fonctionnement de grisbi
+ * */
 struct {
     time_t modification_fichier;
     gint is_archive;                /** TRUE if the file is an archive, FALSE else */
     gint equilibrage;
 
+    gboolean debug_mode;            /* TRUE in debug mode, FALSE for normale mode */
+
     /* files and backup part */
     gint dernier_fichier_auto;
     gint sauvegarde_auto;           /* utilisé pour enregistrer le fichier automatiquementà la fermeture */
@@ -47,29 +50,24 @@
     gint make_backup;               /* TRUE for create a backup when save file */
     gint make_backup_every_minutes; /* TRUE to make backup every x mn */
     gint make_backup_nb_minutes;    /* the number of minutes we want to make a backup */
+    gint crypt_file;                /* TRUE if we want to crypt the file */
+    gint compress_file;             /* TRUE if we want to compress the grisbi file */
+    gint compress_backup;           /* TRUE if we want to compress the backup */
+    gint alerte_permission;         /* à un si le message d'alerte s'affiche */
+    gint fichier_deja_ouvert;       /* à un si lors de l'ouverture, le fichier semblait déjà ouvert */
+    gint force_enregistrement;      /* à un si on force l'enregistrement */
 
-    gboolean debug_mode;            /* TRUE in debug mode, FALSE for normale mode */
+    /* formulaire */
     gint entree;                    /* si etat.entree = 1, la touche entrée finit l'opération */ 
     gint alerte_mini;
     gint formulaire_toujours_affiche;
-    gint alerte_permission;                 /* à un si le message d'alerte s'affiche */
-    gint fichier_deja_ouvert;               /* à un si lors de l'ouverture, le fichier semblait déjà ouvert */
-    gint force_enregistrement;              /* à un si on force l'enregistrement */
-    gint affichage_exercice_automatique;    /* automatic fyear :0 to set according to the date, 2 according to value date */
-    gint automatic_completion_payee;        /* 1 pour autoriser la completion automatique des opérations */
-    gboolean limit_completion_to_current_account;   /** Limit payee *
-                            completion to
-                            current account,
-                            or do a full
-                            search. */
-    gint crypt_file;        /* TRUE if we want to crypt the file */
-    gint compress_file;     /* TRUE if we want to compress the grisbi file */
-    gint compress_backup;   /* TRUE if we want to compress the backup */
-
-    gint formulaire_distinct_par_compte;  /* à 1 si le formulaire est différent pour chaque compte */
+    gint affichage_exercice_automatique;            /* automatic fyear :0 to set according to the date, 2 according to value date */
+    gint automatic_completion_payee;                /* 1 pour autoriser la completion automatique des opérations */
+    gboolean limit_completion_to_current_account;   /* Limit payee completion to current account or do a full search. */
+    gint formulaire_distinct_par_compte;            /* à 1 si le formulaire est différent pour chaque compte */
     gint affiche_nb_ecritures_listes;
     gint largeur_auto_colonnes;
-    gint retient_affichage_par_compte;   /* à 1 si les caractéristiques de l'affichage (R, non R ...) diffèrent par compte */
+    gint retient_affichage_par_compte;      /* à 1 si les caractéristiques de l'affichage (R, non R ...) diffèrent par compte */
     gint en_train_de_sauvegarder;
     gint en_train_de_charger;
     gint utilise_logo;
@@ -82,9 +80,9 @@
     gboolean show_toolbar;          /** Show toolbar or not.  */
     gboolean show_headings_bar;     /** Show headings bar or not. */
     gboolean show_closed_accounts;
+    gboolean automatic_separator;   /* TRUE if do automatic separator */
 
-    gboolean automatic_separator; /* TRUE if do automatic separator */
-    /* Various display message stuff  */
+    /* Various display message stuff    */
     gint display_message_lock_active;
     gint display_message_file_readable;
     gint display_message_minimum_alert;
@@ -93,13 +91,13 @@
     gint display_message_ofx_security;
 
     /* import rules */
-    gint get_extract_number_for_check;          /* TRUE if Extracting a number and save it in the field No Cheque/Virement */
-    gint get_fusion_import_transactions; /* TRUE if merge transactions imported with transactions found*/
-    gint get_categorie_for_payee;               /* TRUE to automatically retrieve the category of the payee if it exists */
-    gint get_fyear_by_value_date;               /* TRUE to get the fyear by value date, FALSE by date */
+    gint get_extract_number_for_check;      /* TRUE if Extracting a number and save it in the field No Cheque/Virement */
+    gint get_fusion_import_transactions;    /* TRUE if merge transactions imported with transactions found*/
+    gint get_categorie_for_payee;           /* TRUE to automatically retrieve the category of the payee if it exists */
+    gint get_fyear_by_value_date;           /* TRUE to get the fyear by value date, FALSE by date */
 
     /* combofix configuration */
-    gint combofix_mixed_sort;                /* TRUE for no separation between the categories */
+    gint combofix_mixed_sort;               /* TRUE for no separation between the categories */
     gint combofix_max_item;                 /* maximum number of items we want before showing the popup */
     gint combofix_case_sensitive;           /* TRUE if case sensitive */
     gint combofix_enter_select_completion;  /* TRUE if enter close the popup and keep what is in the entry (else, select the current item in the list) */
@@ -114,7 +112,7 @@
     /* Print stuff */
     struct print_config print_config;
     
-    /*     largeur des panned */
+    /* width panned */
     gint largeur_colonne_echeancier;
     gint largeur_colonne_comptes_comptes;
     gint largeur_colonne_etat;
@@ -126,20 +124,26 @@
     gint last_tip; 
     gint show_tip; 
 
-    gchar * csv_separator;          /** CSV separator to use while parsing a CSV file. */
-    gboolean csv_skipped_lines [ CSV_MAX_TOP_LINES ]; /** Contains a
-                            * pointer to
-                            * skipped lines
-                            * in CSV
-                            * preview. */
+    gchar * csv_separator;                              /** CSV separator to use while parsing a CSV file. */
+    gboolean csv_skipped_lines [ CSV_MAX_TOP_LINES ];   /* Contains a pointer to skipped lines in CSV preview. */
 
     /* variables pour les metatree */
     gint metatree_sort_transactions;        /* TRUE = sort transactions by date */
     gint add_archive_in_total_balance;      /* Add transactions archived in the totals */
+
+    /* variables for the module estimate balance */
+    gint bet_last_account;
+    gint bet_deb_period;
+    gint bet_end_period;
+    gint bet_spin_range;
+    gint bet_months;
+    gint bet_hist_data;
+    gint bet_hist_fyear;
+    
 } etat;
 
 
-/**
+/** structure conf
  * variables containing just 0 or 1
  * configured by the file grisbi.conf
  *

Index: gsb_fyear.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_fyear.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gsb_fyear.c	18 Jan 2010 22:33:52 -0000	1.11
+++ gsb_fyear.c	28 Jan 2010 20:25:12 -0000	1.12
@@ -140,53 +140,10 @@
 gboolean gsb_fyear_set_combobox_history ( GtkWidget *combo_box,
                         gint fyear_number )
 {
-    GtkTreeIter iter;
-    gint result;
-
-    if (!combo_box)
-	return FALSE;
-
-    if (!fyear_model)
-	return FALSE;
-
-    /* we look for the fyear in the model and not in the filter
-     * because of if the fyear is not showed */
-    result = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL (fyear_model),
-					     &iter );
-    while (result)
-    {
-	gint value;
-	gboolean show;
-
-	gtk_tree_model_get ( GTK_TREE_MODEL (fyear_model),
-			     &iter,
-			     FYEAR_COL_NUMBER, &value,
-			     FYEAR_COL_VIEW, &show,
-			     -1 );
-
-	if (value == fyear_number)
-	{
-	    GtkTreeIter child_iter;
-
-	    /* if normally not showed, we show it now and later
-	     * it will be back to show */
-	    if (!show)
-		gtk_list_store_set ( GTK_LIST_STORE (fyear_model),
-				     &iter,
-				     FYEAR_COL_VIEW, TRUE,
-				     -1 );
-	    /* as we were in the model and not the filter, we need to change the iter */
-	    gtk_tree_model_filter_convert_child_iter_to_iter ( GTK_TREE_MODEL_FILTER (fyear_model_filter),
-							       &child_iter,
-							       &iter );
-	    gtk_combo_box_set_active_iter ( GTK_COMBO_BOX (combo_box),
-					    &child_iter );
-	    return TRUE;
-	}
-	result = gtk_tree_model_iter_next ( GTK_TREE_MODEL (fyear_model),
-					    &iter );
-    }
-    return FALSE;
+    return gsb_fyear_select_iter_by_number ( combo_box,
+                        fyear_model,
+                        fyear_model_filter,
+                        fyear_number );
 }
 
 
@@ -294,8 +251,7 @@
 
     gtk_list_store_clear (GTK_LIST_STORE ( model ) );
 
-    /* put at the beginning 'Automatic' wich mean at the validation of
-     * the transaction, the fyear will take the value of the date */
+    /* put at the beginning title */
     gtk_list_store_append ( GTK_LIST_STORE ( model ), &iter );
     gtk_list_store_set ( GTK_LIST_STORE ( model ),
                         &iter,
@@ -395,6 +351,77 @@
     return FALSE;
 }
 
+
+/**
+ * set the combobox on the fyear given in param
+ * if the fyear exists but is not showed normally, we show it because it's for
+ * a modification of a transaction (when the form will be freed, that fyear won't be showed again)
+ *
+ * \combo_box the combo-box to set
+ * \tree_model
+ * \tree_model_filter
+ * \fyear_number the fyear we want to set on the combo-box, if 0, will be set on "Automatic"
+ *
+ * \return TRUE fyear found, FALSE fyear not found, nothing change
+ * */
+gboolean gsb_fyear_select_iter_by_number ( GtkWidget *combo_box,
+                        GtkTreeModel *model,
+                        GtkTreeModel *model_filter,
+                        gint fyear_number )
+{
+    GtkTreeIter iter;
+    gint result;
+
+    if ( !combo_box )
+	    return FALSE;
+
+    if ( !model )
+	    return FALSE;
+
+    /* we look for the fyear in the model and not in the filter
+     * because the fyear may not be visible */
+    result = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ),
+					     &iter );
+    while (result)
+    {
+        gint value;
+        gboolean show;
+
+        gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+                        &iter,
+                        FYEAR_COL_NUMBER, &value,
+                        FYEAR_COL_VIEW, &show,
+                        -1 );
+
+        if ( value == fyear_number )
+        {
+            GtkTreeIter child_iter;
+
+            /* if normally not showed, we show it now and later
+             * it will be back to show */
+            if ( !show )
+                gtk_list_store_set ( GTK_LIST_STORE ( model ),
+                        &iter,
+                        FYEAR_COL_VIEW, TRUE,
+                        -1 );
+
+            /* as we were in the model and not the filter, we need to change the iter */
+            gtk_tree_model_filter_convert_child_iter_to_iter (
+                        GTK_TREE_MODEL_FILTER ( model_filter ),
+                        &child_iter,
+                        &iter );
+            gtk_combo_box_set_active_iter ( GTK_COMBO_BOX ( combo_box ),
+                        &child_iter );
+
+            return TRUE;
+        }
+        result = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ),
+                            &iter );
+    }
+    return FALSE;
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- balance_estimate_config.c	24 Jan 2010 10:58:01 -0000	1.2
+++ balance_estimate_config.c	28 Jan 2010 20:25:12 -0000	1.3
@@ -93,7 +93,7 @@
     paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
                         _("Calculation of period") );
 
-    bet_estimate_get_duration_widget ( paddingbox );
+    bet_estimate_get_duration_widget ( paddingbox, TRUE );
 
     /* Sources of historical data */
     paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,

Index: gsb_data_fyear.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_fyear.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- gsb_data_fyear.c	3 Jan 2010 11:21:26 -0000	1.20
+++ gsb_data_fyear.c	28 Jan 2010 20:25:12 -0000	1.21
@@ -731,3 +731,8 @@
         return 1;
     return 0;
 }
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */

Index: gsb_data_partial_balance.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_partial_balance.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- gsb_data_partial_balance.c	15 Nov 2009 05:37:12 -0000	1.10
+++ gsb_data_partial_balance.c	28 Jan 2010 20:25:12 -0000	1.11
@@ -377,7 +377,8 @@
 
     gtk_entry_set_text ( GTK_ENTRY ( entry_name ), balance_name );
     gtk_entry_set_text ( GTK_ENTRY ( entry_list ), liste_cptes );
-    gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_bouton ), partial_balance_number );
+    gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_bouton ),
+                        (gdouble) partial_balance_number );
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( colorise_bouton ),
                         gsb_data_partial_balance_get_colorise (
                         partial_balance_number ) );

Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- traitement_variables.c	22 Nov 2009 18:45:52 -0000	1.183
+++ traitement_variables.c	28 Jan 2010 20:25:12 -0000	1.184
@@ -374,6 +374,14 @@
 
     /* initialise la liste des catégories */
     categ_tree_model = NULL;
+
+    /* initializes the variables for the estimate balance module */
+     etat.bet_deb_period = 1;
+    etat.bet_end_period = 1;
+    etat.bet_spin_range = 1;
+    etat.bet_months = 1;
+    etat.bet_hist_data = 0;
+    etat.bet_hist_fyear = 0;
 }
 
 

Index: gsb_fyear.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_fyear.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gsb_fyear.h	18 Jan 2010 22:33:52 -0000	1.8
+++ gsb_fyear.h	28 Jan 2010 20:25:12 -0000	1.9
@@ -14,13 +14,17 @@
 /* START_DECLARATION */
 gint gsb_fyear_get_fyear_from_combobox ( GtkWidget *combo_box,
                         const GDate *date );
+gboolean gsb_fyear_hide_iter_by_name ( GtkTreeModel *model, gchar *name );
 void gsb_fyear_init_variables ( void );
 GtkWidget *gsb_fyear_make_combobox ( gboolean set_automatic );
+gboolean gsb_fyear_select_iter_by_number ( GtkWidget *combo_box,
+                        GtkTreeModel *model,
+                        GtkTreeModel *model_filter,
+                        gint fyear_number );
 gboolean gsb_fyear_set_automatic ( gboolean set_automatic );
 gboolean gsb_fyear_set_combobox_history ( GtkWidget *combo_box,
                         gint fyear_number );
 gboolean gsb_fyear_update_fyear_list ( void );
-gboolean gsb_fyear_hide_iter_by_name ( GtkTreeModel *model, gchar *name );
 GtkWidget *gsb_fyear_make_combobox_new ( GtkTreeModel *model,
                         gboolean set_automatic );
 gboolean gsb_fyear_update_fyear_list_new ( GtkTreeModel *model,

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- gsb_form.c	9 Jan 2010 20:57:38 -0000	1.144
+++ gsb_form.c	28 Jan 2010 20:25:12 -0000	1.145
@@ -723,7 +723,9 @@
 	    }
 	    else
 	    {
-		gint contra_transaction_number = gsb_data_mix_get_transaction_number_transfer (transaction_number, is_transaction);
+        gint contra_transaction_number;
+
+		contra_transaction_number = gsb_data_mix_get_transaction_number_transfer (transaction_number, is_transaction);
 		switch (contra_transaction_number)
 		{
 		    case -1:

Index: barre_outils.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/barre_outils.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- barre_outils.c	29 Aug 2009 08:36:40 -0000	1.129
+++ barre_outils.c	28 Jan 2010 20:25:12 -0000	1.130
@@ -296,6 +296,8 @@
 
 	gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
 
+    i++;
+
 	tmp_list = tmp_list -> next;
     }
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- balance_estimate_tab.h	24 Jan 2010 10:58:01 -0000	1.5
+++ balance_estimate_tab.h	28 Jan 2010 20:25:12 -0000	1.6
@@ -30,7 +30,7 @@
 
 /* START_DECLARATION */
 GtkWidget *bet_create_balance_estimate_tab ( void );
-GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container );
+GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container, gboolean config );
 gboolean bet_fyear_create_combobox_store ( void );
 void bet_update_balance_estimate_tab ( void );
 /* END_DECLARATION */

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- import.c	23 Jan 2010 13:46:12 -0000	1.320
+++ import.c	28 Jan 2010 20:25:12 -0000	1.321
@@ -3530,7 +3530,7 @@
                         100.0,
                         1.0);
     gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
-                        valeur_echelle_recherche_date_import );
+                        (gdouble) valeur_echelle_recherche_date_import );
     g_signal_connect ( G_OBJECT ( button ),
                         "value-changed",
                         G_CALLBACK ( changement_valeur_echelle_recherche_date_import ),

Index: gsb_file_others.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_others.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- gsb_file_others.c	27 Jan 2010 22:43:26 -0000	1.32
+++ gsb_file_others.c	28 Jan 2010 20:25:12 -0000	1.33
@@ -37,6 +37,7 @@
 #include "./gsb_file_load.h"
 #include "./gsb_file_save.h"
 #include "./navigation.h"
+#include "./utils_files.h"
 #include "./utils_str.h"
 #include "./traitement_variables.h"
 #include "./categories_onglet.h"
@@ -125,8 +126,7 @@
 
     /* the file is in memory, we can save it */
 
-	file = utf8_fopen ( filename,
-			  "w" );
+	file = utf8_fopen ( filename, "w" );
 
     if ( !file
 	 ||
@@ -207,8 +207,7 @@
 
     /* the file is in memory, we can save it */
 
-	file = utf8_fopen ( filename,
-			  "w" );
+	file = utf8_fopen ( filename, "w" );
 
     if ( !file
 	 ||

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- balance_estimate_tab.c	24 Jan 2010 10:58:01 -0000	1.34
+++ balance_estimate_tab.c	28 Jan 2010 20:25:12 -0000	1.35
@@ -57,6 +57,7 @@
 #include "./include.h"
 #include "./structures.h"
 #include "./traitement_variables.h"
+#include "./erreur.h"
 /*END_INCLUDE*/
 
 
@@ -80,12 +81,14 @@
 
 
 /*START_STATIC*/
-static void bet_account_selection_changed ( GtkTreeSelection *treeselection, gpointer user_data );
+static void bet_account_selection_changed ( GtkTreeSelection *tree_selection,
+                        gpointer user_data );
 static gint bet_date_sort_function ( GtkTreeModel *model,
                         GtkTreeIter *itera,
                         GtkTreeIter *iterb,
                         gpointer user_data );
-static void bet_duration_button_clicked ( GtkWidget *togglebutton, GtkWidget *spin_button );
+static void bet_duration_button_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *spin_button );
 static void bet_historical_data_clicked ( GtkWidget *togglebutton, gpointer data );
 static void bet_estimate_refresh ( void );
 static void bet_estimate_refresh_historical_data ( GtkTreeModel *tab_model,
@@ -111,24 +114,28 @@
                         GtkTreeIter *a,
                         GtkTreeIter *b,
                         gpointer user_data);
-static void bet_create_parameter_page ( GtkWidget *notebook );
+static void bet_parameter_create_page ( GtkWidget *notebook );
+static GtkWidget *bet_parameter_get_list_accounts ( GtkWidget *container );
+static gboolean bet_parameter_update_list_accounts ( GtkWidget *tree_view,
+                        GtkTreeModel *tree_model );
 static void bet_create_array_page ( GtkWidget *notebook );
 static void bet_create_graph_page ( GtkWidget *notebook );
 static void bet_create_historical_data_page ( GtkWidget *notebook );
-static GtkWidget *bet_estimate_get_list_accounts ( GtkWidget *container );
-//~ static GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container );
-static gboolean bet_duration_number_changed ( GtkWidget *spin_button, GtkWidget *togglebutton );
-static void bet_duration_period_clicked ( GtkWidget *togglebutton, GtkWidget *button );
+static gboolean bet_duration_number_changed ( GtkWidget *spin_button,
+                        GtkWidget *togglebutton );
+static void bet_duration_period_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *button );
 static GtkWidget *bet_estimate_get_historical_data ( GtkWidget *container );
 static void bet_estimate_populate_historical_data ( void );
 static gboolean bet_estimate_populate_div ( gint transaction_number,
                         GHashTable  *list_div );
-static gboolean bet_estimate_update_div ( SH *sh, gint transaction_number, gint sub_div );
-static gboolean bet_estimate_affiche_div ( GHashTable  *list_div, GtkWidget *tree_view );
+static gboolean bet_estimate_update_div ( SH *sh, gint transaction_number,
+                        gint sub_div );
+static gboolean bet_estimate_affiche_div ( GHashTable  *list_div,
+                        GtkWidget *tree_view );
 static void bet_estimate_populate_div_model ( gpointer key,
                         gpointer value,
                         gpointer user_data);
-//~ static gboolean bet_fyear_create_combobox_store ( void );
 static gint bet_fyear_get_fyear_from_combobox ( GtkWidget *combo_box );
 static gint bet_estimate_get_account_selected ( void );
 static void bet_estimate_tab_add_new_line ( GtkTreeModel *tab_model,
@@ -165,11 +172,11 @@
 gchar* (*ptr_div_name) ( gint div_num, gint sub_div, const gchar *return_value_error );
 
 enum bet_account_tree_columns {
+    SPP_ACCOUNT_TREE_NUM_COLUMN,
     SPP_ACCOUNT_TREE_NAME_COLUMN,
     SPP_ACCOUNT_TREE_NUM_COLUMNS
 };
 
-
 enum bet_estimation_tree_columns {
     SPP_ESTIMATE_TREE_DATE_COLUMN,
     SPP_ESTIMATE_TREE_DESC_COLUMN,
@@ -239,7 +246,7 @@
     bet_container = notebook;
 
     /****** Parameter page ******/
-    bet_create_parameter_page ( notebook );
+    bet_parameter_create_page ( notebook );
 
     /****** Estimation array page ******/
     bet_create_array_page ( notebook );
@@ -265,52 +272,30 @@
     GtkTreeModel *tree_model;
     GtkTreeSelection* tree_selection;
     GtkTreeIter iter;
-    GSList *tmp_list;
-    gchar* previous_account_name = NULL;
 
     /* find the selected account */
-    tree_view = g_object_get_data (G_OBJECT(bet_container), "bet_account_treeview");
-    tree_model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view));
-    tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
-
-    if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(tree_selection), &tree_model, &iter))
-        gtk_tree_model_get (tree_model, &iter, 0, &previous_account_name, -1);
+    tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
+    tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+    tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
 
     /* fill the account list */
-    gtk_tree_store_clear ( GTK_TREE_STORE (tree_model) );
-    tmp_list = gsb_data_account_get_list_accounts ();
-    while ( tmp_list )
-    {
-        gint i;
-        gchar* account_name;
-
-        i = gsb_data_account_get_no_account(tmp_list->data);
-        tmp_list = tmp_list->next;
-        if (gsb_data_account_get_closed_account(i))
-            continue;
-        account_name = gsb_data_account_get_name(i);
-        gtk_tree_store_append (GTK_TREE_STORE(tree_model), &iter, NULL);
-        gtk_tree_store_set(GTK_TREE_STORE(tree_model), &iter,
-                   SPP_ACCOUNT_TREE_NAME_COLUMN, account_name, -1);
-        /* select the previous selected account */
-        if (previous_account_name && strcmp(account_name, previous_account_name) == 0)
-            gtk_tree_selection_select_iter(GTK_TREE_SELECTION(tree_selection), &iter);
-    }
-    g_free(previous_account_name);
+    bet_parameter_update_list_accounts ( tree_view, GTK_TREE_MODEL ( tree_model ) );
 
     /* if no row is selected, select the first line (if it exists) of the account list */
-    if (!gtk_tree_selection_get_selected(GTK_TREE_SELECTION(tree_selection), &tree_model, &iter))
+    if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+     &tree_model, &iter ) )
     {
-        gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree_model), &iter);
-        gtk_tree_selection_select_iter(GTK_TREE_SELECTION(tree_selection), &iter);
+        gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( tree_model ), &iter );
+        gtk_tree_selection_select_iter ( GTK_TREE_SELECTION ( tree_selection ), &iter );
     }
 
     /* update the estimate array graph and other data (if account list is not empty) */
     /* TODO clear the graph and the account list if no account is selected */
-    if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(tree_selection), &tree_model, &iter))
+    if ( gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+     &tree_model, &iter ) )
     {
-        bet_estimate_refresh ( );
         bet_estimate_populate_historical_data ( );
+        bet_estimate_refresh ( );
     }
 }
 
@@ -456,15 +441,12 @@
     GtkTreeIter iter;
     GtkTreeModel *tree_model;
     gchar *account_name = NULL;
-    gchar *data;
     gchar *str_date_min;
     gchar *str_date_max;
     gchar *str_current_balance;
     gchar *title;
     gchar *tmp_str;
     gint selected_account;
-    gint months;
-    gint period;
     GDate *date_min;
     GDate *date_max;
     gsb_real current_balance;
@@ -475,31 +457,23 @@
 
     /* find the selected account */
     selected_account = bet_estimate_get_account_selected ( );
+
     if ( selected_account == -1 )
         return;
-
     /* calculate date_min and date_max with user choice */
-    data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_months" );
-    months = ( data ) ? GPOINTER_TO_INT ( data ): 1;
-    data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_deb_period" );
-    period = ( data ) ? GPOINTER_TO_INT ( data ): 2;
-
     date_min = gdate_today ();
-    if ( period == 1 )
+    if ( etat.bet_deb_period == 1 )
         g_date_set_day ( date_min, 1 );
 
-    data = g_object_get_data ( G_OBJECT ( bet_container ), "bet_end_period" );
-    period = ( data ) ? GPOINTER_TO_INT ( data ): 2;
-
     date_max = gdate_today ();
 
-    if ( period == 1 )
+    if ( etat.bet_end_period == 1 )
     {
-        g_date_add_months (date_max, months - 1 );
+        g_date_add_months (date_max, etat.bet_months - 1 );
         date_max = gsb_date_get_last_day_of_month ( date_max );
     }
     else
-        g_date_add_months (date_max, months );
+        g_date_add_months (date_max, etat.bet_months );
 
     str_date_min = gsb_format_gdate ( date_min );
     g_value_init ( &date_value, G_TYPE_DATE );
@@ -607,27 +581,21 @@
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
     if ( g_strcmp0 ( name, "button_1" ) == 0 )
     {
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_deb_period",
-                        GINT_TO_POINTER ( 1 ) );
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_end_period",
-                        GINT_TO_POINTER ( 1 ) );
+        etat.bet_deb_period = 1;
+        etat.bet_end_period = 1;
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
     }
     else if ( g_strcmp0 ( name, "button_2" ) == 0 )
     {
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_deb_period",
-                        GINT_TO_POINTER ( 2 ) );
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_end_period",
-                        GINT_TO_POINTER ( 2 ) );
+        etat.bet_deb_period = 2;
+        etat.bet_end_period = 2;
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
     }
     else if ( g_strcmp0 ( name, "button_3" ) == 0 )
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_end_period",
-                        GINT_TO_POINTER ( 1 ) );
+        etat.bet_end_period = 1;
 
     else if ( g_strcmp0 ( name, "button_4" ) == 0 )
-        g_object_set_data ( G_OBJECT ( bet_container ), "bet_end_period",
-                        GINT_TO_POINTER ( 2 ) );
+        etat.bet_end_period = 2;
 
     g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
                         G_CALLBACK (bet_duration_period_clicked),
@@ -645,28 +613,28 @@
  */
 static void bet_duration_button_clicked ( GtkWidget *togglebutton, GtkWidget *spin_button )
 {
-    gint months;
     const gchar *name;
     
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
-    months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+    etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
 
     if ( g_strcmp0 ( name, "Year" ) == 0 )
     {
+        etat.bet_spin_range = 1;
         gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
-        if ( months > 20 )
+        if ( etat.bet_months > 20 )
         {
-            gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20 );
-            months = 240;
+            gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20.0 );
+            etat.bet_months = 240;
         }
         else
-            months *= 12;
+            etat.bet_months *= 12;
     }
     else
+    {
+        etat.bet_spin_range = 0;
         gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 240.0 );
-
-    g_object_set_data ( G_OBJECT ( bet_container ), "bet_months",
-                        GINT_TO_POINTER ( months ) );
+    }
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -691,6 +659,7 @@
 
     if ( g_strcmp0 ( name, "button_1" ) == 0 )
     {
+        etat.bet_hist_data = 0;
         ptr_div = &gsb_data_transaction_get_category_number;
         ptr_sub_div = &gsb_data_transaction_get_sub_category_number;
         ptr_div_name = &gsb_data_category_get_name;
@@ -698,9 +667,10 @@
     }
     else
     {
+        etat.bet_hist_data = 1;
         ptr_div = &gsb_data_transaction_get_budgetary_number;
         ptr_sub_div = &gsb_data_transaction_get_sub_budgetary_number;
-        ptr_div_name = gsb_data_budget_get_name;
+        ptr_div_name = &gsb_data_budget_get_name;
         title = g_strdup ( _("Budgetary line") );
     }
 
@@ -723,6 +693,8 @@
  * */
 void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data )
 {
+    etat.bet_hist_fyear = bet_fyear_get_fyear_from_combobox ( combo );
+
     bet_estimate_populate_historical_data ( );
 }
 
@@ -875,16 +847,13 @@
  */
 gboolean bet_duration_number_changed ( GtkWidget *spin_button, GtkWidget *togglebutton )
 {
-    gint months = 0;
     gboolean toggled;
 
-    months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+    etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
 
     toggled = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( togglebutton ) );
     if ( toggled == 1 )
-        months *= 12;
-
-    g_object_set_data ( G_OBJECT ( bet_container ), "bet_months", GINT_TO_POINTER ( months ) );
+        etat.bet_months *= 12;
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -900,10 +869,24 @@
  * This function is called for each change in the selected line in the account list.
  * It refreshs balance estimation.
  */
-void bet_account_selection_changed ( GtkTreeSelection *treeselection,
-                        gpointer user_data )
+void bet_account_selection_changed ( GtkTreeSelection *tree_selection,
+                        gpointer data )
 {
-    bet_estimate_refresh();
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    gint account_nb;
+
+    if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
+     &model, &iter ) )
+    {
+        return;
+    }
+
+    gtk_tree_model_get ( model, &iter, SPP_ACCOUNT_TREE_NUM_COLUMN, &account_nb, -1 );
+    etat.bet_last_account = account_nb;
+
+    bet_estimate_populate_historical_data ( );
+    bet_estimate_refresh ( );
 }
 
 
@@ -913,14 +896,14 @@
  *
  *
  * */
-void bet_create_parameter_page ( GtkWidget *notebook )
+void bet_parameter_create_page ( GtkWidget *notebook )
 {
     GtkWidget *widget;
     GtkWidget *page;
     GtkWidget *vbox;
     GtkWidget *hbox;
     GtkWidget *tree_view;
-
+devel_debug (NULL);
     widget = gtk_label_new ( _("Choice the prevision") );
     gtk_widget_show ( GTK_WIDGET ( widget ) );
 
@@ -952,11 +935,11 @@
     gtk_box_pack_start ( GTK_BOX ( page ), vbox, FALSE, FALSE, 5 );
 
     /* create the account list */
-    tree_view = bet_estimate_get_list_accounts ( vbox );
-    g_object_set_data (G_OBJECT(notebook), "bet_account_treeview", tree_view);
+    tree_view = bet_parameter_get_list_accounts ( vbox );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_account_treeview", tree_view );
 
     /* create duration selection */
-    bet_estimate_get_duration_widget ( vbox );
+    bet_estimate_get_duration_widget ( vbox, FALSE );
 }
 
 
@@ -1181,21 +1164,34 @@
 
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
-    ptr_div = &gsb_data_transaction_get_category_number;
-    ptr_sub_div = &gsb_data_transaction_get_sub_category_number;
-    ptr_div_name = &gsb_data_category_get_name;
+
+    if ( etat.bet_hist_data == 0 )
+    {
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
+        ptr_div = &gsb_data_transaction_get_category_number;
+        ptr_sub_div = &gsb_data_transaction_get_sub_category_number;
+        ptr_div_name = &gsb_data_category_get_name;
+    }
+    else
+    {
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_2 ), TRUE );
+        ptr_div = &gsb_data_transaction_get_budgetary_number;
+        ptr_sub_div = &gsb_data_transaction_get_sub_budgetary_number;
+        ptr_div_name = &gsb_data_budget_get_name;
+    }
 
     /* création du sélecteur de périod */
     if ( bet_fyear_create_combobox_store ( ) )
     {
         widget = gsb_fyear_make_combobox_new ( bet_fyear_model_filter, TRUE );
         gtk_widget_set_tooltip_text ( GTK_WIDGET ( widget ),
-                          SPACIFY(_("Choose the financial year or 12 months rolling") ) );
+                        SPACIFY(_("Choose the financial year or 12 months rolling") ) );
         g_signal_connect ( G_OBJECT ( widget ),
-                            "changed",
-                            G_CALLBACK (bet_historical_fyear_clicked),
-                            NULL );
+                        "changed",
+                        G_CALLBACK (bet_historical_fyear_clicked),
+                        NULL );
         g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_fyear", widget );
+
         gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5);
 
         /* hide the present financial year */
@@ -1203,6 +1199,15 @@
         str_year = utils_str_itoa ( year );
         gsb_fyear_hide_iter_by_name ( bet_fyear_model, str_year );
         g_free ( str_year );
+
+        /* show the old choice */
+        if ( etat.bet_hist_fyear > 0 )
+        {
+            gsb_fyear_select_iter_by_number ( widget,
+                        bet_fyear_model,
+                        bet_fyear_model_filter,
+                        etat.bet_hist_fyear );
+        }
     }
 
     /* création de la liste des données */
@@ -1219,7 +1224,7 @@
  *
  *
  * */
-GtkWidget *bet_estimate_get_list_accounts ( GtkWidget *container )
+GtkWidget *bet_parameter_get_list_accounts ( GtkWidget *container )
 {
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
@@ -1230,7 +1235,10 @@
 
     tree_view = gtk_tree_view_new();
 
-    tree_model = gtk_tree_store_new (SPP_ACCOUNT_TREE_NUM_COLUMNS, G_TYPE_STRING );
+    tree_model = gtk_tree_store_new (SPP_ACCOUNT_TREE_NUM_COLUMNS,
+                        G_TYPE_INT,
+                        G_TYPE_STRING );
+
     gtk_tree_view_set_model ( GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL ( tree_model ) );
     g_object_unref ( G_OBJECT ( tree_model ) );
 
@@ -1269,11 +1277,57 @@
  *
  *
  * */
-GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container )
+gboolean bet_parameter_update_list_accounts ( GtkWidget *tree_view,
+                        GtkTreeModel *tree_model )
+{
+    GtkTreeSelection *tree_selection;
+    GtkTreeIter iter;
+    GSList *tmp_list;
+
+    tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+    gtk_tree_store_clear ( GTK_TREE_STORE ( tree_model ) );
+
+    tmp_list = gsb_data_account_get_list_accounts ();
+    while ( tmp_list )
+    {
+        gint account_nb;
+        gchar *account_name;
+
+        account_nb = gsb_data_account_get_no_account ( tmp_list -> data );
+        if ( gsb_data_account_get_closed_account ( account_nb ) )
+        {
+            tmp_list = tmp_list -> next;
+            continue;
+        }
+
+        account_name = gsb_data_account_get_name ( account_nb );
+        gtk_tree_store_append ( GTK_TREE_STORE ( tree_model ), &iter, NULL );
+        gtk_tree_store_set ( GTK_TREE_STORE ( tree_model ),
+                        &iter,
+                        SPP_ACCOUNT_TREE_NUM_COLUMN, account_nb,
+                        SPP_ACCOUNT_TREE_NAME_COLUMN, account_name,
+                        -1);
+        if ( etat.bet_last_account == account_nb )
+            gtk_tree_selection_select_iter ( GTK_TREE_SELECTION ( tree_selection ),
+                        &iter );
+
+        tmp_list = tmp_list -> next;
+    }
+
+    return FALSE;
+}
+/**
+ *
+ *
+ *
+ *
+ * */
+GtkWidget *bet_estimate_get_duration_widget ( GtkWidget *container, gboolean config )
 {
     GtkWidget* main_vbox;
     GtkWidget *label;
-    GtkWidget *spin_button, *button_1, *button_2, *button_3, *button_4;
+    GtkWidget *button_1, *button_2, *button_3, *button_4;
+    GtkWidget *spin_button = NULL;
     GtkWidget *widget = NULL;
     GtkWidget *hbox;
     GtkWidget *previous = NULL;
@@ -1285,8 +1339,11 @@
     main_vbox = gtk_vbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( container ), main_vbox, FALSE, FALSE, 5) ;
 
-    label = gtk_label_new ( _("Calculation of period") );
-    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+    if ( !config )
+    {
+        label = gtk_label_new ( _("Calculation of period") );
+        gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+    }
 
     label = gtk_label_new ( _("Beginning of period") );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
@@ -1301,13 +1358,16 @@
     gtk_widget_set_name ( button_1, "button_1" );
     gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), button_1 );
     
-    g_object_set_data ( G_OBJECT ( bet_container ), "bet_deb_period",
-                        GINT_TO_POINTER ( 1 ) );
     button_2 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_1 ),
                         _("date today") );
     gtk_widget_set_name ( button_2, "button_2" );
 
+    if ( etat.bet_deb_period == 1 )
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_2 ), TRUE );
+
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
 
@@ -1324,13 +1384,19 @@
     gtk_widget_set_name ( button_3, "button_3" );
     gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), button_3 );
     
-    g_object_set_data ( G_OBJECT ( bet_container ), "bet_end_period",
-                        GINT_TO_POINTER ( 1 ) );
     button_4 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_3 ),
                         _("From date to date") );
     gtk_widget_set_name ( button_4, "button_4" );
 
+    if ( etat.bet_end_period == 1 )
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_3 ), TRUE );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_4 ), TRUE );
+
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_3, FALSE, FALSE, 5) ;
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_4, FALSE, FALSE, 5) ;
+
     /*set the signals */
     g_signal_connect (G_OBJECT ( button_1 ),
                         "released",
@@ -1349,9 +1415,6 @@
                         G_CALLBACK ( bet_duration_period_clicked ),
                         NULL );
 
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button_3, FALSE, FALSE, 5) ;
-    gtk_box_pack_start ( GTK_BOX ( hbox ), button_4, FALSE, FALSE, 5) ;
-
     /* partie mensuelle */
     label = gtk_label_new ( _("Duration estimation") );
     gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
@@ -1359,7 +1422,13 @@
     hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 5) ;
 
-    spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
+    if ( etat.bet_spin_range == 0 )
+        spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
+    else
+        spin_button = gtk_spin_button_new_with_range ( 1.0, 20.0, 1.0 );
+
+    gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
+                        (gdouble) etat.bet_months );
 
     for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
     {
@@ -1368,7 +1437,7 @@
             widget = gtk_radio_button_new_with_label ( NULL,
                         _(bet_duration_array[iduration]) );
             previous = widget;
-        } 
+        }  
         else 
         {
             widget = gtk_radio_button_new_with_label_from_widget (
@@ -1383,6 +1452,11 @@
                         spin_button );
     }
 
+    if ( etat.bet_spin_range == 0 )
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
+
     g_signal_connect ( G_OBJECT ( spin_button ),
                         "value-changed",
                         G_CALLBACK ( bet_duration_number_changed ),
@@ -1409,6 +1483,7 @@
     GtkTreeSelection *tree_selection;
     GtkCellRenderer *cell;
     GtkTreeViewColumn *column;
+    gchar *title;
 
     tree_view = gtk_tree_view_new ( );
     gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW (tree_view), TRUE);
@@ -1435,7 +1510,6 @@
     gtk_box_pack_start ( GTK_BOX ( container ), scrolled_window, TRUE, TRUE, 15 );
 
     /* create columns */
-    /* select column */ 
     cell = gtk_cell_renderer_toggle_new ( );
     gtk_cell_renderer_toggle_set_radio ( GTK_CELL_RENDERER_TOGGLE ( cell ),
                         FALSE );
@@ -1453,9 +1527,13 @@
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ), column );
 
     /* name of the div sous-div column*/
+    if ( etat.bet_hist_data == 0 )
+        title = g_strdup ( _("Category") );
+    else
+        title = g_strdup ( _("Budgetary line") );
     cell = gtk_cell_renderer_text_new ( );
-    column = gtk_tree_view_column_new_with_attributes (
-                        _("Category"), cell,
+    column = gtk_tree_view_column_new_with_attributes ( title,
+                        cell,
                         "text", SPP_HISTORICAL_DESC_COLUMN,
                         NULL);
     g_object_set_data ( G_OBJECT ( bet_container ), "historical_column_source",
@@ -1647,7 +1725,8 @@
         sub_div = ptr_sub_div ( transaction_number );
     else
         return FALSE;
-
+if (div == 26)
+printf ("div = %d sub_div = %d\n", div, sub_div );
     if ( g_hash_table_lookup_extended ( list_div, &div, NULL, (gpointer) &sh ) )
         bet_estimate_update_div ( sh, transaction_number, sub_div );
     else
@@ -1674,7 +1753,8 @@
     SBR *sbr = ( SBR*) sh -> sbr;
     gsb_real amount;
     SH *tmp_sh = NULL;
-
+if (sh -> div == 26)
+        printf ("div = %d sub_div = %d\n", sh -> div, sub_div );
     amount = gsb_data_transaction_get_amount ( transaction_number );
     sbr-> current_balance = gsb_real_add ( sbr -> current_balance, amount );
 
@@ -1947,8 +2027,7 @@
     GtkTreeIter iter;
     GtkTreeModel *model;
     GtkTreeSelection *tree_selection;
-    gchar *account_name = NULL;
-    gint selected_account;
+    gint account_nb;
 
     /* récuperation du n° de compte à utiliser */
     tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
@@ -1963,10 +2042,9 @@
         return -1 ;
     }
 
-    gtk_tree_model_get ( model, &iter, 0, &account_name, -1 );
-    selected_account = gsb_data_account_get_no_account_by_name ( account_name );
+    gtk_tree_model_get ( model, &iter, SPP_ACCOUNT_TREE_NUM_COLUMN, &account_nb, -1 );
     
-    return selected_account;
+    return account_nb;
 }
 /**
  *

Index: utils_str.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_str.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- utils_str.c	27 Jan 2010 22:48:05 -0000	1.79
+++ utils_str.c	28 Jan 2010 20:25:12 -0000	1.80
@@ -746,7 +746,11 @@
 
     long_old = g_utf8_strlen ( old_str, -1 );
     chaine = g_strndup ( str, (ptr_debut - str) );
-    chaine = g_strconcat ( chaine, new_str, NULL );
+    if ( ptr_debut + long_old + 1 )
+        chaine = g_strconcat ( chaine, new_str, ( ptr_debut + long_old + 1 ), NULL );
+    else
+        chaine = g_strconcat ( chaine, new_str, NULL );
+
     return g_strdup ( chaine );
 }
 

Index: gsb_autofunc.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_autofunc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- gsb_autofunc.c	24 Aug 2009 13:11:48 -0000	1.24
+++ gsb_autofunc.c	28 Jan 2010 20:25:12 -0000	1.25
@@ -559,7 +559,7 @@
     spin_button = gtk_spin_button_new_with_range ( 0.0, G_MAXDOUBLE, 1.0 );
 
     gtk_spin_button_set_value ( GTK_SPIN_BUTTON (spin_button),
-				value );
+				(gdouble) value );
 
     /* set the default func :
      * the func will be send to gsb_editable_set_text by the data,
@@ -606,7 +606,7 @@
 
     /* Fill in value */
     gtk_spin_button_set_value ( GTK_SPIN_BUTTON (spin_button),
-				value );
+				(gdouble) value );
 
     g_object_set_data ( G_OBJECT (spin_button),
 			"number_for_func", GINT_TO_POINTER (number_for_func));



More information about the cvs mailing list