[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.7, 1.8 balance_estimate_config.h, 1.1, 1.2 balance_estimate_data.c, 1.4, 1.5 balance_estimate_data.h, 1.3, 1.4 balance_estimate_hist.c, 1.1, 1.2 balance_estimate_hist.h, 1.1, 1.2 balance_estimate_tab.c, 1.41, 1.42 balance_estimate_tab.h, 1.8, 1.9 fenetre_principale.c, 1.123, 1.124 fenetre_principale.h, 1.28, 1.29 gsb_reconcile.c, 1.45, 1.46 gsb_transactions_list.c, 1.195, 1.196 main.c, 1.164, 1.165 metatree.c, 1.146, 1.147 navigation.c, 1.134, 1.135 parametres.c, 1.210, 1.211 structures.h, 1.239, 1.240 traitement_variables.c, 1.187, 1.188

Pierre Biava pbiava at users.sourceforge.net
Sat Feb 20 09:54:02 CET 2010


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

Modified Files:
	balance_estimate_config.c balance_estimate_config.h 
	balance_estimate_data.c balance_estimate_data.h 
	balance_estimate_hist.c balance_estimate_hist.h 
	balance_estimate_tab.c balance_estimate_tab.h 
	fenetre_principale.c fenetre_principale.h gsb_reconcile.c 
	gsb_transactions_list.c main.c metatree.c navigation.c 
	parametres.c structures.h traitement_variables.c 
Log Message:
finally fixes the bug 600 and additions to the budget module

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- structures.h	6 Feb 2010 08:49:46 -0000	1.239
+++ structures.h	20 Feb 2010 08:54:00 -0000	1.240
@@ -13,7 +13,7 @@
 #define VERSION_FICHIER "0.6.0"
 
 /* Define this when in CVS development branch. */
-//#define IS_DEVELOPMENT_VERSION (1)
+#define IS_DEVELOPMENT_VERSION (1)
 
 #define VERSION_FICHIER_ETAT "0.6.0"
 #define VERSION_FICHIER_CATEG "0.6.0"

Index: fenetre_principale.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- fenetre_principale.h	17 Jun 2009 19:39:51 -0000	1.28
+++ fenetre_principale.h	20 Feb 2010 08:54:00 -0000	1.29
@@ -17,7 +17,6 @@
 } GsbGeneralNotebookPages;
 
 /* START_INCLUDE_H */
-#include "././balance_estimate_tab.h"
 /* END_INCLUDE_H */
 
 

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- balance_estimate_config.c	14 Feb 2010 17:48:49 -0000	1.7
+++ balance_estimate_config.c	20 Feb 2010 08:54:00 -0000	1.8
@@ -21,6 +21,8 @@
 /*                                                                            */
 /* ************************************************************************** */
 
+/* ./configure --with-balance-estimate */
+
 #include "include.h"
 #include <config.h>
 
@@ -84,7 +86,7 @@
  *
  * */
 
-GtkWidget *bet_estimate_config_create_page ( void )
+GtkWidget *bet_config_create_page ( void )
 {
     GtkWidget *vbox_pref, *paddingbox;
 

Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- parametres.c	24 Jan 2010 10:58:01 -0000	1.210
+++ parametres.c	20 Feb 2010 08:54:00 -0000	1.211
@@ -544,7 +544,7 @@
                         1, BET_GENERAL_PAGE,
                         2, 400,
                         -1);
-    gtk_notebook_append_page (preference_frame, bet_estimate_config_create_page(), NULL);
+    gtk_notebook_append_page (preference_frame, bet_config_create_page (), NULL);
 #endif
 
     /* select the page */

Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- traitement_variables.c	15 Feb 2010 05:23:25 -0000	1.187
+++ traitement_variables.c	20 Feb 2010 08:54:00 -0000	1.188
@@ -377,6 +377,7 @@
 
     /* initializes the variables for the estimate balance module */
 #ifdef ENABLE_BALANCE_ESTIMATE
+    /* création de la liste des données à utiliser dans le tableau de résultats */
     bet_data_init_variables ( );
 #endif /* ENABLE_BALANCE_ESTIMATE */
     etat.bet_deb_period = 1;

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- gsb_transactions_list.c	30 Jan 2010 17:04:12 -0000	1.195
+++ gsb_transactions_list.c	20 Feb 2010 08:54:00 -0000	1.196
@@ -3157,7 +3157,7 @@
     devel_debug_int (rows_number);
 
     current_account = gsb_gui_navigation_get_current_account ();
-    if ( rows_number == gsb_data_account_get_nb_rows (current_account))
+    if ( rows_number == gsb_data_account_get_nb_rows (current_account) && rows_number > 1 )
 	return;
 
     /*     we check all the accounts */

Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- balance_estimate_data.h	14 Feb 2010 17:48:49 -0000	1.3
+++ balance_estimate_data.h	20 Feb 2010 08:54:00 -0000	1.4
@@ -31,21 +31,28 @@
 
 
 /* START_DECLARATION */
-gint bet_data_add_div_hist ( gint account_nb,
-                        gint div_number,
-                        gint sub_div_nb,
-                        gsb_real moyenne );
-gint bet_data_add_div_hist_at_position ( gint account_nb,
+gboolean bet_data_add_div_hist ( gint account_nb,
                         gint div_number,
                         gint sub_div_nb,
-                        gsb_real moyenne,
-                        gint pos );
+                        gsb_real amount );
+gsb_real bet_data_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb );
 gchar *bet_data_get_div_name (gint div_num,
                         gint sub_div,
                         const gchar *return_value_error );
+gboolean bet_data_get_div_full ( gint account_nb, gint div_number );
+gint bet_data_get_div_number ( gint transaction_number, gboolean is_transaction );
+gint bet_data_get_sub_div_nb ( gint transaction_number, gboolean is_transaction );
 gboolean bet_data_init_variables ( void );
 gboolean bet_data_populate_div ( gint transaction_number,
+                        gboolean is_transaction,
                         GHashTable  *list_div );
+gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
+gboolean bet_data_search_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
+gboolean bet_data_set_div_amount ( gint account_nb,
+                        gint div_number,
+                        gint sub_div_nb,
+                        gsb_real amount );
+gboolean bet_data_set_div_full ( gint account_nb, gint div_number, gboolean full );
 gboolean bet_data_set_div_ptr ( gint type_div );
 
 SBR *initialise_struct_bet_range ( void );

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- navigation.c	8 Feb 2010 22:01:20 -0000	1.134
+++ navigation.c	20 Feb 2010 08:54:00 -0000	1.135
@@ -1234,7 +1234,7 @@
 
 	    /* what to be done if switch to that page */
 	    gsb_form_set_expander_visible (FALSE, FALSE);
-            bet_update_balance_estimate_tab();
+        bet_array_update_estimate_tab ( );
 	    break;
 #endif /*_BALANCE_ESTIMATE_TAB_H*/
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- balance_estimate_tab.h	14 Feb 2010 17:48:49 -0000	1.8
+++ balance_estimate_tab.h	20 Feb 2010 08:54:00 -0000	1.9
@@ -26,18 +26,17 @@
 /* END_INCLUDE_H */
 
 /* START_DECLARATION */
-GtkWidget *bet_balance_estimate_create_tab ( void );
-gboolean bet_fyear_create_combobox_store ( void );
-GtkWidget *bet_parameter_get_list_accounts ( GtkWidget *container );
-gint bet_estimate_get_account_selected ( void );
-GtkWidget *bet_parameter_get_duration_widget ( GtkWidget *container, gboolean config );
-void bet_update_balance_estimate_tab ( void );
-void bet_estimate_refresh ( void );
-void bet_estimate_tab_add_new_line ( GtkTreeModel *tab_model,
+GtkWidget *bet_array_create_estimate_page ( void );
+void bet_array_list_add_new_line ( GtkTreeModel *tab_model,
                         GtkTreeModel *model,
                         GtkTreeIter *iter,
                         GDate *date_min,
                         GDate *date_max );
+void bet_array_refresh_estimate_tab ( void );
+void bet_array_update_estimate_tab ( void );
+gint bet_parameter_get_account_selected ( void );
+GtkWidget *bet_parameter_get_duration_widget ( GtkWidget *container, gboolean config );
+GtkWidget *bet_parameter_get_list_accounts ( GtkWidget *container );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_TAB_H*/

Index: gsb_reconcile.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_reconcile.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- gsb_reconcile.c	10 Jan 2010 20:11:38 -0000	1.45
+++ gsb_reconcile.c	20 Feb 2010 08:54:00 -0000	1.46
@@ -653,8 +653,7 @@
     /* restore the saved data */
     etat.retient_affichage_par_compte = reconcile_save_account_display;
 
-    if (reconcile_save_rows_number != 1)
-        gsb_transactions_list_set_visible_rows_number ( reconcile_save_rows_number );
+    gsb_transactions_list_set_visible_rows_number ( reconcile_save_rows_number );
 
     if (reconcile_save_show_marked)
     {

Index: metatree.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/metatree.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- metatree.c	14 Feb 2010 17:48:50 -0000	1.146
+++ metatree.c	20 Feb 2010 08:54:00 -0000	1.147
@@ -44,7 +44,6 @@
 #include "./transaction_list.h"
 #include "./gsb_transactions_list.h"
 #include "./fenetre_principale.h"
-#include "./gtk_combofix.h"
 #include "./gsb_data_transaction.h"
 #include "./include.h"
 #include "./erreur.h"

Index: balance_estimate_hist.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- balance_estimate_hist.h	14 Feb 2010 17:26:19 -0000	1.1
+++ balance_estimate_hist.h	20 Feb 2010 08:54:00 -0000	1.2
@@ -38,6 +38,8 @@
     SPP_HISTORICAL_RETAINED_COLUMN,
     SPP_HISTORICAL_RETAINED_AMOUNT, /* retenaid column without currency */
     SPP_HISTORICAL_BALANCE_COLOR,
+    SPP_HISTORICAL_DIV_COLUMN,
+    SPP_HISTORICAL_SUB_DIV_COLUMN,
     SPP_HISTORICAL_NUM_COLUMNS
 };
 
@@ -45,13 +47,14 @@
 gboolean bet_historical_affiche_div ( GHashTable  *list_div,
                         GtkWidget *tree_view );
 void bet_historical_create_page ( GtkWidget *notebook );
-void bet_historical_origin_data_clicked ( GtkWidget *togglebutton, gpointer data );
+void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data );
+gboolean bet_historical_fyear_create_combobox_store ( void );
 gint bet_historical_get_fyear_from_combobox ( GtkWidget *combo_box );
+void bet_historical_origin_data_clicked ( GtkWidget *togglebutton, gpointer data );
 void bet_historical_populate_data ( void );
 void bet_historical_refresh_data ( GtkTreeModel *tab_model,
                         GDate *date_min,
                         GDate *date_max );
-void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_HIST_H*/

Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- balance_estimate_data.c	14 Feb 2010 17:48:49 -0000	1.4
+++ balance_estimate_data.c	20 Feb 2010 08:54:00 -0000	1.5
@@ -34,6 +34,7 @@
 #include "./gsb_data_budget.h"
 #include "./gsb_data_category.h"
 #include "./gsb_data_fyear.h"
+#include "./gsb_data_mix.h"
 #include "./gsb_data_payee.h"
 #include "./gsb_data_scheduled.h"
 #include "./gsb_data_transaction.h"
@@ -53,19 +54,18 @@
 
 struct _hist_div
 {
-    gint number;
     gint account_nb;
     gint div_number;
+    gboolean div_full;
     gint sub_div_nb;
-    gsb_real moyenne;
-    gsb_real new_amount;
+    GHashTable *sub_div_list;
+    gsb_real amount;
 };
 
 
 /*START_STATIC*/
 static gboolean bet_data_update_div ( SH *sh, gint transaction_number,
                         gint sub_div );
-static void bet_data_hist_div_list_renumerote ( void );
 static struct_hist_div *initialise_struct_hist_div ( void );
 static void free_struct_hist_div ( struct_hist_div *bet_hist_div );
 /*END_STATIC*/
@@ -79,15 +79,13 @@
 
 
 /* pointeurs définis en fonction du type de données catégories ou IB */
-gint (*ptr_div) ( gint transaction_num );
-gint (*ptr_sub_div) ( gint transaction_num );
+gint (*ptr_div) ( gint transaction_num, gboolean is_transaction );
+gint (*ptr_sub_div) ( gint transaction_num, gboolean is_transaction );
 gchar* (*ptr_div_name) ( gint div_num, gint sub_div, const gchar *return_value_error );
 
 
 /* liste des div et sub_div cochées dans la vue des divisions */
-static GSList *bet_hist_div_list = NULL;
-
-static struct_hist_div *bet_hist_div_buffer;
+static GHashTable *bet_hist_div_list;
 
 
 /**
@@ -99,58 +97,87 @@
  * */
 gboolean bet_data_init_variables ( void )
 {
-    if ( bet_hist_div_list )
-    {
-        GSList* tmp_list = bet_hist_div_list;
-        while ( tmp_list )
-        {
-            struct_hist_div *bet_hist_div;
-
-            bet_hist_div = tmp_list -> data;
-            tmp_list = tmp_list -> next;
-            free_struct_hist_div ( bet_hist_div ); 
-        }
-        g_slist_free ( bet_hist_div_list );
-    }
-    bet_hist_div_list = NULL;
-    bet_hist_div_buffer = NULL;
-
+    bet_hist_div_list = g_hash_table_new_full ( g_str_hash,
+                        g_str_equal,
+                        (GDestroyNotify) g_free,
+                        (GDestroyNotify) free_struct_hist_div );
     return FALSE;
 
 }
 
 
-
 /**
  *
  *
  *
  *
  * */
-gint bet_data_add_div_hist ( gint account_nb,
+gboolean bet_data_add_div_hist ( gint account_nb,
                         gint div_number,
                         gint sub_div_nb,
-                        gsb_real moyenne )
+                        gsb_real amount )
 {
-    struct_hist_div *bet_hist_div;
+    gchar *key;
+    gchar *sub_key;
+    struct_hist_div *shd;
+devel_debug_int (account_nb);
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
 
-    bet_hist_div = g_malloc0 ( sizeof ( struct_hist_div ) );
-    if ( ! bet_hist_div )
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
     {
-        dialogue_error_memory ( );
-        return 0;
-    }
-    bet_hist_div -> number = g_slist_length ( bet_hist_div_list ) + 1;
-    bet_hist_div -> account_nb = account_nb;
-    bet_hist_div -> div_number = div_number;
-    bet_hist_div -> sub_div_nb = sub_div_nb;
-    bet_hist_div -> moyenne = moyenne;
+        if ( sub_div_nb > 0 )
+        {
+            sub_key = utils_str_itoa ( sub_div_nb );
+            if (  !g_hash_table_lookup ( bet_hist_div_list, sub_key ) )
+            {
+                struct_hist_div *sub_shd;
 
-    bet_hist_div_list = g_slist_append ( bet_hist_div_list, bet_hist_div );
+                sub_shd = initialise_struct_hist_div ( );
+                if ( !sub_shd )
+                {
+                    dialogue_error_memory ( );
+                    return FALSE;
+                }
+                sub_shd -> sub_div_nb = sub_div_nb;
+                sub_shd -> amount = amount;
+                g_hash_table_insert ( shd -> sub_div_list, sub_key, sub_shd );
+            }
+        }
+    }
+    else
+    {
+        shd = initialise_struct_hist_div ( );
+        if ( !shd )
+        {
+            dialogue_error_memory ( );
+            return 0;
+        }
+        shd -> account_nb = account_nb;
+        shd -> div_number = div_number;
+        shd -> sub_div_nb = sub_div_nb;
+        if ( sub_div_nb > 0 )
+        {
+            struct_hist_div *sub_shd;
 
-    bet_hist_div_buffer = bet_hist_div;
+            sub_shd = initialise_struct_hist_div ( );
+            if ( !sub_shd )
+            {
+                dialogue_error_memory ( );
+                return FALSE;
+            }
+            sub_key = utils_str_itoa ( sub_div_nb );
+            sub_shd -> sub_div_nb = sub_div_nb;
+            sub_shd -> amount = amount;
+            g_hash_table_insert ( shd -> sub_div_list, sub_key, sub_shd );
+        }
+        g_hash_table_insert ( bet_hist_div_list, key, shd );
+    }
 
-    return bet_hist_div -> number;
+    return TRUE;
 }
 
 
@@ -160,31 +187,75 @@
  *
  *
  * */
-gint bet_data_add_div_hist_at_position ( gint account_nb,
-                        gint div_number,
-                        gint sub_div_nb,
-                        gsb_real moyenne,
-                        gint pos )
+gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_div_nb )
 {
-    struct_hist_div *bet_hist_div;
+    gchar *key;
+    char *sub_key;
+    struct_hist_div *shd;
+devel_debug_int (account_nb);
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
 
-    bet_hist_div = initialise_struct_hist_div ( );
-    if ( ! bet_hist_div )
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
     {
-        dialogue_error_memory ( );
-        return 0;
+        if ( sub_div_nb > 0 )
+        {
+            sub_key = utils_str_itoa ( sub_div_nb );
+            g_hash_table_remove ( shd -> sub_div_list, sub_key );
+        }
+        if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
+            g_hash_table_remove ( bet_hist_div_list, key );
     }
-    bet_hist_div -> account_nb = account_nb;
-    bet_hist_div -> div_number = div_number;
-    bet_hist_div -> sub_div_nb = sub_div_nb;
-    bet_hist_div -> moyenne = moyenne;
+    else
+        return FALSE;
 
-    bet_hist_div_list = g_slist_insert ( bet_hist_div_list, bet_hist_div, pos - 1 );
-    bet_data_hist_div_list_renumerote ( );
+    return TRUE;
+}
 
-    bet_hist_div_buffer = bet_hist_div;
 
-    return bet_hist_div -> number;
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_search_div_hist ( gint account_nb, gint div_number, gint sub_div_nb )
+{
+    gchar *key;
+    gchar *sub_key;
+    struct_hist_div *shd;
+    
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+    {
+        if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
+        {
+            g_free ( key );
+            return TRUE;
+        }
+        else if ( sub_div_nb > 0 );
+        {
+            sub_key = utils_str_itoa ( sub_div_nb );
+            if (  g_hash_table_lookup ( shd -> sub_div_list, sub_key ) )
+            {
+                g_free ( key );
+                g_free ( sub_key );
+                return TRUE;
+            }
+            g_free ( sub_key );
+        }
+    }
+
+    g_free ( key );
+    return FALSE;
 }
 
 
@@ -194,18 +265,24 @@
  *
  *
  * */
+/**
+ *
+ *
+ *
+ *
+ * */
 gboolean bet_data_set_div_ptr ( gint type_div )
 {
     if ( type_div == 0 )
     {
-        ptr_div = &gsb_data_transaction_get_category_number;
-        ptr_sub_div = &gsb_data_transaction_get_sub_category_number;
+        ptr_div = &gsb_data_mix_get_category_number;
+        ptr_sub_div = &gsb_data_mix_get_sub_category_number;
         ptr_div_name = &gsb_data_category_get_name;
     }
     else
     {
-        ptr_div = &gsb_data_transaction_get_budgetary_number;
-        ptr_sub_div = &gsb_data_transaction_get_sub_budgetary_number;
+        ptr_div = &gsb_data_mix_get_budgetary_number;
+        ptr_sub_div = &gsb_data_mix_get_sub_budgetary_number;
         ptr_div_name = &gsb_data_budget_get_name;
     }
 
@@ -217,7 +294,31 @@
  *
  *
  * */
-gchar *bet_data_get_div_name (gint div_num,
+gint bet_data_get_div_number ( gint transaction_number, gboolean is_transaction )
+{
+    return ptr_div ( transaction_number, is_transaction );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gint bet_data_get_sub_div_nb ( gint transaction_number, gboolean is_transaction )
+{
+    return ptr_sub_div ( transaction_number, is_transaction );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gchar *bet_data_get_div_name ( gint div_num,
                         gint sub_div,
                         const gchar *return_value_error )
 {
@@ -231,16 +332,151 @@
  *
  *
  * */
+gsb_real bet_data_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb )
+{
+    gchar *key;
+    struct_hist_div *shd;
+    gsb_real amount;
+
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+    {
+        if ( sub_div_nb == 0 )
+            amount = shd -> amount;
+        else
+        {
+            gchar *sub_key;
+            struct_hist_div *sub_shd;
+
+            sub_key = utils_str_itoa ( sub_div_nb );
+            if ( ( sub_shd = g_hash_table_lookup ( shd -> sub_div_list, sub_key ) ) )
+                amount = sub_shd -> amount;
+            else
+                amount = null_real;
+            g_free ( sub_key );
+        }
+    }
+    else
+        amount = null_real;
+    g_free ( key );
+
+    return amount;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_set_div_amount ( gint account_nb,
+                        gint div_number,
+                        gint sub_div_nb,
+                        gsb_real amount )
+{
+    gchar *key;
+    struct_hist_div *shd;
+
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+    {
+        if ( sub_div_nb == 0 )
+            shd -> amount = amount;
+        else
+        {
+            gchar *sub_key;
+            struct_hist_div *sub_shd;
+
+            sub_key = utils_str_itoa ( sub_div_nb );
+            if ( ( sub_shd = g_hash_table_lookup ( shd -> sub_div_list, sub_key ) ) )
+                sub_shd -> amount = amount;
+            g_free ( sub_key );
+        }
+    }
+
+    g_free ( key );
+
+    return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_get_div_full ( gint account_nb, gint div_number )
+{
+    gchar *key;
+    struct_hist_div *shd;
+
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+        return shd -> div_full;
+    else
+        return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_data_set_div_full ( gint account_nb, gint div_number, gboolean full )
+{
+    gchar *key;
+    struct_hist_div *shd;
+devel_debug_int (full);
+    if ( account_nb == 0 )
+        key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
+    else
+        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+                        utils_str_itoa ( div_number ), NULL );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+        shd -> div_full = full;
+
+    return FALSE;
+}
+
+
+
+/**
+ * Ajoute les données de la transaction à la division et la sous division
+ * création des nouvelles divisions et si existantes ajout des données
+ * par appel à bet_data_update_div ( )
+ *
+ * */
 gboolean bet_data_populate_div ( gint transaction_number,
+                        gboolean is_transaction,
                         GHashTable  *list_div )
 {
     gint div = 0;
     gint sub_div = 0;
     SH *sh = NULL;
 
-    div = ptr_div ( transaction_number );
+    div = ptr_div ( transaction_number, is_transaction );
     if ( div > 0 )
-        sub_div = ptr_sub_div ( transaction_number );
+        sub_div = ptr_sub_div ( transaction_number, is_transaction );
     else
         return FALSE;
     
@@ -260,8 +496,8 @@
 
 
 /**
- *
- *
+ * Ajout des données à la division et création de la sous division si elle 
+ * n'existe pas.
  *
  *
  * */
@@ -274,7 +510,7 @@
     amount = gsb_data_transaction_get_amount ( transaction_number );
     sbr-> current_balance = gsb_real_add ( sbr -> current_balance, amount );
 
-    if ( sub_div == -1 )
+    if ( sub_div < 1 )
         return FALSE;
 
     if ( ( tmp_sh = g_hash_table_lookup ( sh -> list_sub_div, utils_str_itoa ( sub_div ) ) ) )
@@ -293,28 +529,6 @@
 
 
 /**
- * renumerote la liste des divisions cochées
- *
- * */
-void bet_data_hist_div_list_renumerote ( void )
-{
-    GSList *list_tmp;
-    gint i = 1;
-
-    list_tmp = bet_hist_div_list;
-    while ( list_tmp )
-    {
-        struct_hist_div *bet_hist_div;
-
-        bet_hist_div = list_tmp -> data;
-        bet_hist_div -> number = i;
-        i++;
-        list_tmp = list_tmp -> next;
-    }
-}
-
-
-/**
  *
  *
  *
@@ -359,7 +573,7 @@
 
 	sh = g_malloc ( sizeof ( SH ) );
     sh -> sbr = initialise_struct_bet_range ( );
-    sh -> list_sub_div = g_hash_table_new_full ( g_int_hash,
+    sh -> list_sub_div = g_hash_table_new_full ( g_str_hash,
                         g_str_equal,
                         NULL,
                         (GDestroyNotify) free_struct_historical );
@@ -380,6 +594,7 @@
         free_struct_bet_range ( sh -> sbr );
     if ( sh -> list_sub_div )
         g_hash_table_remove_all ( sh -> list_sub_div );
+
     g_free ( sh );
 }
 
@@ -392,17 +607,20 @@
  * */
 struct_hist_div *initialise_struct_hist_div ( void )
 {
-    struct_hist_div *bet_hist_div;
+    struct_hist_div *shd;
 
-    bet_hist_div = g_malloc ( sizeof ( struct_hist_div ) );
-    bet_hist_div -> number = 0;
-    bet_hist_div -> account_nb = 0;
-    bet_hist_div -> div_number = 0;
-    bet_hist_div -> sub_div_nb = 0;
-    bet_hist_div -> moyenne = null_real;
-    bet_hist_div -> new_amount = null_real;
+    shd = g_malloc ( sizeof ( struct_hist_div ) );
+    shd -> account_nb = 0;
+    shd -> div_number = 0;
+    shd -> div_full = FALSE;
+    shd -> sub_div_nb = -1;
+    shd -> sub_div_list = g_hash_table_new_full ( g_str_hash,
+                        g_str_equal,
+                        (GDestroyNotify) g_free,
+                        (GDestroyNotify) free_struct_hist_div );
+    shd -> amount = null_real;
 
-    return bet_hist_div;
+    return shd;
 }
 
 
@@ -412,9 +630,12 @@
  *
  *
  * */
-void free_struct_hist_div ( struct_hist_div *bet_hist_div )
+void free_struct_hist_div ( struct_hist_div *shd )
 {
-    g_free ( bet_hist_div );
+    if ( shd -> sub_div_list )
+        g_hash_table_remove_all ( shd -> sub_div_list );
+
+    g_free ( shd );
 }
 
 /**

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- balance_estimate_tab.c	14 Feb 2010 17:48:49 -0000	1.41
+++ balance_estimate_tab.c	20 Feb 2010 08:54:00 -0000	1.42
@@ -65,6 +65,11 @@
 
 
 /*START_STATIC*/
+static void bet_array_create_page ( GtkWidget *notebook );
+static gint bet_array_date_sort_function ( GtkTreeModel *model,
+                        GtkTreeIter *itera,
+                        GtkTreeIter *iterb,
+                        gpointer user_data );
 static void bet_array_list_add_substract_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
 static gboolean bet_array_list_button_press ( GtkWidget *tree_view,
@@ -72,43 +77,35 @@
 static void bet_array_list_context_menu ( GtkWidget *tree_view );
 static void bet_array_list_delete_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
-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_estimate_refresh_scheduled_data ( GtkTreeModel *tab_model,
+static void bet_array_refresh_scheduled_data ( GtkTreeModel *tab_model,
                         gint selected_account,
                         GDate *date_min,
                         GDate *date_max );
-static void bet_estimate_refresh_transactions_data ( GtkTreeModel *tab_model,
+static void bet_array_refresh_transactions_data ( GtkTreeModel *tab_model,
                         gint selected_account,
                         GDate *date_min,
                         GDate *date_max );
-static gboolean bet_update_average_column (GtkTreeModel *model,
+static gboolean bet_array_update_average_column (GtkTreeModel *model,
                         GtkTreePath *path,
                         GtkTreeIter *iter,
                         gpointer data);
-static gboolean bet_update_graph ( GtkTreeModel *model,
+static void bet_graph_create_page ( GtkWidget *notebook );
+static gboolean bet_graph_update_graph ( GtkTreeModel *model,
                         GtkTreePath *path,
                         GtkTreeIter *iter,
                         gpointer data );
-static gint bet_date_sort_function (GtkTreeModel *model,
-                        GtkTreeIter *a,
-                        GtkTreeIter *b,
-                        gpointer user_data);
-static void bet_parameter_create_page ( GtkWidget *notebook );
 static void bet_parameter_account_selection_changed ( GtkTreeSelection *tree_selection,
                         gpointer user_data );
-static gboolean bet_parameter_update_list_accounts ( GtkWidget *tree_view,
-                        GtkTreeModel *tree_model );
-static void bet_array_create_page ( GtkWidget *notebook );
-static void bet_graph_create_page ( GtkWidget *notebook );
-static gboolean bet_duration_number_changed ( GtkWidget *spin_button,
+static void bet_parameter_create_page ( GtkWidget *notebook );
+static void bet_parameter_duration_button_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *spin_button );
+static gboolean bet_parameter_duration_number_changed ( GtkWidget *spin_button,
                         GtkWidget *togglebutton );
-static void bet_duration_period_clicked ( GtkWidget *togglebutton,
+static void bet_parameter_duration_period_clicked ( GtkWidget *togglebutton,
                         GtkWidget *button );
+static void bet_parameter_select_account ( gint account_nb );
+static gboolean bet_parameter_update_list_accounts ( GtkWidget *tree_view,
+                        GtkTreeModel *tree_model );
 /*END_STATIC*/
 
 /*START_EXTERN*/
@@ -154,7 +151,7 @@
  * This function create the widget (notebook) which contains all the
  * balance estimate interface. This widget is added in the main window
  */
-GtkWidget *bet_balance_estimate_create_tab ( void )
+GtkWidget *bet_array_create_estimate_page ( void )
 {
     GtkWidget* notebook;
 
@@ -179,18 +176,18 @@
     bet_historical_create_page ( notebook );
 
     bet_historical_populate_data ( );
-    bet_estimate_refresh ( );
+    bet_array_refresh_estimate_tab ( );
 
     return notebook;
 }
 
 
 /*
- * bet_update_balance_estimate_tab
+ * bet_array_update_estimate_tab
  *
  * This function is called each time that "Balance estimate" is selected in the selection tree.
  */
-void bet_update_balance_estimate_tab ( void )
+void bet_array_update_estimate_tab ( void )
 {
     GtkWidget *tree_view;
     GtkTreeModel *tree_model;
@@ -210,7 +207,7 @@
  * This function is called by the Tree Model to sort
  * two lines by date.
  */
-static gint bet_date_sort_function ( GtkTreeModel *model,
+static gint bet_array_date_sort_function ( GtkTreeModel *model,
                         GtkTreeIter *itera,
                         GtkTreeIter *iterb,
                         gpointer user_data )
@@ -245,14 +242,14 @@
 
 
 /*
- * bet_update_average_column
+ * bet_array_update_average_column
  *
  * This function is called for each line of the array.
  * It calculates the balance column by adding the amount of the line
  * to the balance of the previous line.
  * It calculates the minimum and the maximum values of the balance column.
  */
-static gboolean bet_update_average_column ( GtkTreeModel *model,
+static gboolean bet_array_update_average_column ( GtkTreeModel *model,
                         GtkTreePath *path,
                         GtkTreeIter *iter,
                         gpointer data )
@@ -282,7 +279,7 @@
         return FALSE;
     }
 
-    selected_account = bet_estimate_get_account_selected ( );
+    selected_account = bet_parameter_get_account_selected ( );
     if ( selected_account == -1 )
         return FALSE;
 
@@ -311,11 +308,11 @@
 
 
 /*
- * bet_update_graph
+ * bet_graph_update_graph
  * This function is called for each line of the estimate array and it updates
  * the graph.
  */
-static gboolean bet_update_graph ( GtkTreeModel *model,
+static gboolean bet_graph_update_graph ( GtkTreeModel *model,
                         GtkTreePath *path,
                         GtkTreeIter *iter,
                         gpointer data )
@@ -344,13 +341,13 @@
 
 
 /*
- * bet_estimate_refresh
+ * bet_array_refresh_estimate_tab
  * This function clears the estimate array and calculates new estimates.
  * It updates the estimate graph.
  * This function is called when the refresh button is pressed and when
  * the balance estimate tab is selected.
  */
-void bet_estimate_refresh ( void )
+void bet_array_refresh_estimate_tab ( void )
 {
     GtkWidget *widget;
     GtkWidget *tree_view;
@@ -374,7 +371,7 @@
     tmp_range = initialise_struct_bet_range ( );
 
     /* find the selected account */
-    selected_account = bet_estimate_get_account_selected ( );
+    selected_account = bet_parameter_get_account_selected ( );
 
     if ( selected_account == -1 )
         return;
@@ -449,13 +446,13 @@
     bet_historical_refresh_data ( tree_model, date_min, date_max );
     
     /* search transactions of the account which are in the future */
-    bet_estimate_refresh_transactions_data ( tree_model,
+    bet_array_refresh_transactions_data ( tree_model,
                         selected_account,
                         date_min,
                         date_max );
 
     /* for each schedulded operation */
-    bet_estimate_refresh_scheduled_data ( tree_model,
+    bet_array_refresh_scheduled_data ( tree_model,
                         selected_account,
                         date_min,
                         date_max );
@@ -468,23 +465,23 @@
     tmp_range -> current_balance = current_balance;
 
     gtk_tree_model_foreach ( GTK_TREE_MODEL ( tree_model ),
-                        bet_update_average_column, tmp_range );
+                        bet_array_update_average_column, tmp_range );
 
     /* update graph */
     widget = g_object_get_data ( G_OBJECT ( bet_container ), "bet_graph_curve" );
     gtk_curve_reset ( GTK_CURVE ( widget ) );
     gtk_tree_model_foreach ( GTK_TREE_MODEL ( tree_model ),
-                        bet_update_graph, widget );
+                        bet_graph_update_graph, widget );
 }
 
 
 /*
- * bet_duration_period_clicked
+ * bet_parameter_duration_period_clicked
  * This function is called when a radio button is called to change the inial period.
  * It copies the new durations from the data parameter (of the radio button) into
  * the bet_period property of the bet container
  */
-static void bet_duration_period_clicked ( GtkWidget *togglebutton, GtkWidget *button )
+static void bet_parameter_duration_period_clicked ( GtkWidget *togglebutton, GtkWidget *button )
 {
     GtkWidget *ancestor;
     GtkWidget *widget;
@@ -493,7 +490,7 @@
     devel_debug (NULL);
     if ( button )
         g_signal_handlers_block_by_func ( G_OBJECT ( button ),
-                        G_CALLBACK (bet_duration_period_clicked),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         button );
 
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
@@ -538,20 +535,24 @@
 
     if ( button )
         g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
-                        G_CALLBACK (bet_duration_period_clicked),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         button );
 
-    bet_estimate_refresh ( );
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_array_refresh_estimate_tab ( );
 }
 
 
 /*
- * bet_duration_button_clicked
+ * bet_parameter_duration_button_clicked
  * This function is called when a radio button is called to change the estimate duration.
  * It copies the new durations from the data parameter (of the radio button) into
  * the bet_months property of the bet container
  */
-static void bet_duration_button_clicked ( GtkWidget *togglebutton, GtkWidget *spin_button )
+static void bet_parameter_duration_button_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *spin_button )
 {
     GtkWidget *ancestor;
     GtkWidget *widget;
@@ -590,7 +591,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_estimate_refresh ( );
+    bet_array_refresh_estimate_tab ( );
 }
 
 
@@ -600,7 +601,8 @@
  * It copies the new duration from the spin_button into the bet_months property of
  * the bet container
  */
-gboolean bet_duration_number_changed ( GtkWidget *spin_button, GtkWidget *togglebutton )
+gboolean bet_parameter_duration_number_changed ( GtkWidget *spin_button,
+                        GtkWidget *togglebutton )
 {
     GtkWidget *ancestor;
     GtkWidget *widget;
@@ -628,7 +630,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_estimate_refresh();
+    bet_array_refresh_estimate_tab ( );
 
     return ( FALSE );
 }
@@ -686,7 +688,7 @@
     /* sort by date */
     gtk_tree_sortable_set_sort_func ( GTK_TREE_SORTABLE(tree_model),
 				      SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
-				      (GtkTreeIterCompareFunc) bet_date_sort_function,
+				      (GtkTreeIterCompareFunc) bet_array_date_sort_function,
 				      NULL, NULL );
     gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_model),
 					 SPP_ESTIMATE_TREE_SORT_DATE_COLUMN, GTK_SORT_DESCENDING);
@@ -881,8 +883,11 @@
 
     etat.bet_last_account = account_nb;
 
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
     bet_historical_populate_data ( );
-    bet_estimate_refresh ( );
+    bet_array_refresh_estimate_tab ( );
 }
 
 
@@ -1076,23 +1081,29 @@
     /*set the signals */
     g_signal_connect (G_OBJECT ( button_1 ),
                         "released",
-                        G_CALLBACK ( bet_duration_period_clicked ),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         button_3 );
     g_signal_connect (G_OBJECT ( button_2 ),
                         "released",
-                        G_CALLBACK ( bet_duration_period_clicked ),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         button_4 );
     g_signal_connect (G_OBJECT ( button_3 ),
                         "released",
-                        G_CALLBACK ( bet_duration_period_clicked ),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         NULL );
     g_signal_connect (G_OBJECT ( button_4 ),
                         "released",
-                        G_CALLBACK ( bet_duration_period_clicked ),
+                        G_CALLBACK ( bet_parameter_duration_period_clicked ),
                         NULL );
 
     /* partie mensuelle */
     label = gtk_label_new ( _("Duration estimation") );
+
+        if ( config )
+    {
+        gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
+        gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    }
     gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
 
     hbox = gtk_hbox_new ( FALSE, 5 );
@@ -1130,7 +1141,7 @@
         gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
         g_signal_connect (G_OBJECT ( widget ),
                         "released",
-                        G_CALLBACK ( bet_duration_button_clicked ),
+                        G_CALLBACK ( bet_parameter_duration_button_clicked ),
                         spin_button );
     }
 
@@ -1141,7 +1152,7 @@
 
     g_signal_connect ( G_OBJECT ( spin_button ),
                         "value-changed",
-                        G_CALLBACK ( bet_duration_number_changed ),
+                        G_CALLBACK ( bet_parameter_duration_number_changed ),
                         widget );
     gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
     
@@ -1155,7 +1166,7 @@
  * find the selected account
  *
  * */
-gint bet_estimate_get_account_selected ( void )
+gint bet_parameter_get_account_selected ( void )
 {
     GtkWidget *tree_view;
     GtkTreeIter iter;
@@ -1170,10 +1181,11 @@
     if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
      &model, &iter ) )
     {
-        /* no selection, select the first account
-         * (no warning here because cause a conflict with the tree of navigation */
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( bet_container ), 0 );
-        return -1 ;
+        /* no selection, select the first account */
+        etat.bet_last_account = gsb_data_account_first_number ( );
+        bet_parameter_select_account ( etat.bet_last_account );
+
+        return etat.bet_last_account ;
     }
 
     gtk_tree_model_get ( model, &iter, SPP_ACCOUNT_TREE_NUM_COLUMN, &account_nb, -1 );
@@ -1183,12 +1195,44 @@
 
 
 /**
+ * select the account
+ *
+ * */
+void bet_parameter_select_account ( gint account_nb )
+{
+    GtkWidget *tree_view;
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    GtkTreeSelection *tree_selection;
+    gboolean valid = FALSE;
+
+    /* récuperation du n° de compte à utiliser */
+    tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
+    tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+    model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+
+    valid = gtk_tree_model_get_iter_first ( model, &iter );
+    while (valid)
+    {
+        gint number;
+
+        gtk_tree_model_get ( model, &iter, SPP_ACCOUNT_TREE_NUM_COLUMN, &number, -1 );
+        if ( number == account_nb )
+            break;
+        
+        valid = gtk_tree_model_iter_next ( model, &iter );
+    }
+    gtk_tree_selection_select_iter ( GTK_TREE_SELECTION ( tree_selection ), &iter );
+}
+
+
+/**
  *
  *
  *
  *
  * */
-void bet_estimate_refresh_scheduled_data ( GtkTreeModel *tab_model,
+void bet_array_refresh_scheduled_data ( GtkTreeModel *tab_model,
                         gint selected_account,
                         GDate *date_min,
                         GDate *date_max )
@@ -1209,6 +1253,8 @@
         gint scheduled_number;
         gint account_number;
         gint transfer_account_number;
+        gint div_number;
+        gint sub_div_nb;
         GDate *date;
         GValue date_value = {0, };
         gsb_real amount;
@@ -1224,6 +1270,11 @@
         /* ignore scheduled operations of other account */
         account_number = gsb_data_scheduled_get_account_number ( scheduled_number );
 
+        div_number = bet_data_get_div_number ( scheduled_number, FALSE );
+        sub_div_nb = bet_data_get_sub_div_nb ( scheduled_number, FALSE );
+        if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) )
+            continue;
+
         if ( gsb_data_scheduled_is_transfer ( scheduled_number ) )
         {
             transfer_account_number = gsb_data_scheduled_get_account_number_transfer (
@@ -1326,7 +1377,7 @@
  *
  *
  * */
-void bet_estimate_refresh_transactions_data ( GtkTreeModel *tab_model,
+void bet_array_refresh_transactions_data ( GtkTreeModel *tab_model,
                         gint selected_account,
                         GDate *date_min,
                         GDate *date_max )
@@ -1349,6 +1400,8 @@
         gint transfer_number;
         gint account_number;
         gint transfer_account_number;
+        gint div_number;
+        gint sub_div_nb;
         const GDate *date;
         GValue date_value = {0, };
         gsb_real amount;
@@ -1360,6 +1413,11 @@
         if ( account_number != selected_account )
             continue;
 
+        div_number = bet_data_get_div_number ( transaction_number, TRUE );
+        sub_div_nb = bet_data_get_sub_div_nb ( transaction_number, TRUE );
+        if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) )
+            continue;
+
         date = gsb_data_transaction_get_date ( transaction_number );
         /* ignore transaction which are before date_min (today) */
         if ( g_date_compare ( date, date_min ) <= 0 )
@@ -1438,7 +1496,7 @@
  *
  *
  * */
-void bet_estimate_tab_add_new_line ( GtkTreeModel *tab_model,
+void bet_array_list_add_new_line ( GtkTreeModel *tab_model,
                         GtkTreeModel *model,
                         GtkTreeIter *iter,
                         GDate *date_min,
@@ -1470,7 +1528,7 @@
     if (amount.mantissa < 0)
         str_debit = gsb_real_get_string_with_currency ( gsb_real_opposite ( amount ),
                         gsb_data_account_get_currency (
-                        bet_estimate_get_account_selected ( ) ), TRUE );
+                        bet_parameter_get_account_selected ( ) ), TRUE );
     else
         str_credit = str_value;
 
@@ -1647,7 +1705,7 @@
         tmp_range -> current_balance = current_balance;
 
         gtk_tree_model_foreach ( GTK_TREE_MODEL ( model ),
-                        bet_update_average_column, tmp_range );
+                        bet_array_update_average_column, tmp_range );
     }
 }
 
@@ -1688,7 +1746,7 @@
         tmp_range -> current_balance = current_balance;
 
         gtk_tree_model_foreach ( GTK_TREE_MODEL ( model ),
-                        bet_update_average_column, tmp_range );
+                        bet_array_update_average_column, tmp_range );
     }
 }
 

Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- main.c	29 Jan 2010 18:03:32 -0000	1.164
+++ main.c	20 Feb 2010 08:54:00 -0000	1.165
@@ -114,6 +114,7 @@
     gchar *string;
     gchar *path;
 	struct lconv *conv;
+    cmdline_options  opt;
 
 #ifndef _WIN32
     struct sigaction sig_sev;
@@ -122,16 +123,14 @@
 	gchar * gtkrc_file;
 #endif
 
-    cmdline_options  opt;
-
-    gsb_cunit_run_tests();
-
 #if GSB_GMEMPROFILE
     g_mem_set_vtable(glib_mem_profiler_table);
 #endif
 
+#if IS_DEVELOPMENT_VERSION
+    gsb_cunit_run_tests();
     initialize_debugging();
-
+#endif
 
 #ifdef _WIN32
     /* Retrieve exception information and store them under grisbi.rpt file!
@@ -182,6 +181,7 @@
 #ifdef HAVE_PLUGINS
     gsb_plugins_scan_dir ( PLUGINS_DIR );
 #endif
+
     /* create the icon of grisbi (set in the panel of gnome or other) */
     string = g_build_filename ( PIXMAPS_DIR, "grisbi.png", NULL );
     if ( g_file_test ( string, G_FILE_TEST_EXISTS ) )
@@ -193,6 +193,7 @@
     init_variables ();
     register_import_formats ();
 
+#ifdef IS_DEVELOPMENT_VERSION
     /* test locale pour les nombres */
 	conv = localeconv();
     
@@ -208,6 +209,7 @@
             g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL ),
             g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL ),
             conv->frac_digits );
+#endif
 
     /* firt use ? */
     if ( ! gsb_file_config_load_config () )

Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- fenetre_principale.c	14 Feb 2010 17:48:49 -0000	1.123
+++ fenetre_principale.c	20 Feb 2010 08:54:00 -0000	1.124
@@ -267,7 +267,7 @@
     /* append the balance estimate page */
 #ifdef ENABLE_BALANCE_ESTIMATE 
     gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
-			       bet_balance_estimate_create_tab (),
+			       bet_array_create_estimate_page (),
 			       gtk_label_new (SPACIFY(_("Balance estimate"))) );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- balance_estimate_hist.c	14 Feb 2010 17:26:55 -0000	1.1
+++ balance_estimate_hist.c	20 Feb 2010 08:54:00 -0000	1.2
@@ -64,21 +64,21 @@
 /*END_INCLUDE*/
 
 /*START_STATIC*/
-static GtkWidget *bet_estimate_get_historical_data ( GtkWidget *container );
-static void bet_estimate_populate_div_model ( gpointer key,
-                        gpointer value,
-                        gpointer user_data);
 static void bet_historical_div_cell_edited (GtkCellRendererText *cell,
                         const gchar *path_string,
                         const gchar *new_text,
                         GtkWidget *tree_view );
 static void bet_historical_div_cell_editing_started ( GtkCellRenderer *cell,
                         GtkCellEditable *editable,
-                        const gchar     *path,
-                        gpointer         data );
+                        const gchar *path_string,
+                        GtkWidget *tree_view );
 static gboolean bet_historical_div_toggle_clicked ( GtkCellRendererToggle *renderer,
                         gchar *path_string,
                         GtkTreeModel *store );
+static GtkWidget *bet_historical_get_data ( GtkWidget *container );
+static void bet_historical_populate_div_model ( gpointer key,
+                        gpointer value,
+                        gpointer user_data);
 /*END_STATIC*/
 
 /*START_EXTERN*/
@@ -119,7 +119,7 @@
     gint year;
 
     devel_debug (NULL);
-    widget = gtk_label_new(_("Historical data"));
+    widget = gtk_label_new( _("Historical data") );
     page = gtk_vbox_new ( FALSE, 5 );
 
     gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
@@ -177,7 +177,7 @@
     }
 
     /* création du sélecteur de périod */
-    if ( bet_fyear_create_combobox_store ( ) )
+    if ( bet_historical_fyear_create_combobox_store ( ) )
     {
         widget = gsb_fyear_make_combobox_new ( bet_fyear_model_filter, TRUE );
         gtk_widget_set_name ( GTK_WIDGET ( widget ), "fyear_combo" );
@@ -211,7 +211,7 @@
     }
 
     /* création de la liste des données */
-    tree_view = bet_estimate_get_historical_data ( page );
+    tree_view = bet_historical_get_data ( page );
     g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_treeview", tree_view );
 
     gtk_widget_show_all ( page );
@@ -264,6 +264,7 @@
         modification_fichier ( TRUE );
 
     bet_historical_populate_data ( );
+    bet_array_refresh_estimate_tab ( );
 }
 
 
@@ -301,6 +302,7 @@
         modification_fichier ( TRUE );
 
     bet_historical_populate_data ( );
+    bet_array_refresh_estimate_tab ( );
 }
 
 
@@ -315,31 +317,49 @@
                         GtkTreeModel *store )
 {
     GtkTreeIter iter;
-    gboolean valeur;
-    gchar *tmp_str;
-    gint nbre_fils;
 
-    devel_debug (NULL);
+    devel_debug (path_string);
     if ( gtk_tree_model_get_iter_from_string ( GTK_TREE_MODEL ( store ), &iter, path_string ) )
     {
+        gchar *tmp_str;
+        gchar *str_amount;
+        gint div;
+        gint sub_div;
+        gint nbre_fils;
+        gint account_nb;
+        gboolean valeur;
+
+        account_nb = bet_parameter_get_account_selected ( );
+
         gtk_tree_model_get ( GTK_TREE_MODEL ( store ), &iter,
                         SPP_HISTORICAL_SELECT_COLUMN, &valeur,
                         SPP_HISTORICAL_AVERAGE_COLUMN, &tmp_str,
+                        SPP_HISTORICAL_RETAINED_AMOUNT, &str_amount,
+                        SPP_HISTORICAL_DIV_COLUMN, &div,
+                        SPP_HISTORICAL_SUB_DIV_COLUMN, &sub_div,
                         -1 );
         valeur = 1 - valeur;
         if ( valeur == 1 )
+        {
+            bet_data_add_div_hist ( account_nb,
+                        div,
+                        sub_div,
+                        gsb_real_get_from_string ( str_amount ) );
             gtk_tree_store_set ( GTK_TREE_STORE ( store ), &iter,
-                        SPP_HISTORICAL_SELECT_COLUMN, valeur,
+                        SPP_HISTORICAL_SELECT_COLUMN, 1,
                         SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
                         -1 );
+        }
         else
+        {
+            bet_data_remove_div_hist ( account_nb, div, sub_div );
             gtk_tree_store_set ( GTK_TREE_STORE ( store ), &iter,
-                        SPP_HISTORICAL_SELECT_COLUMN, valeur,
+                        SPP_HISTORICAL_SELECT_COLUMN, 0,
                         SPP_HISTORICAL_RETAINED_COLUMN, "",
                         -1 );
+        }
 
-        nbre_fils = gtk_tree_model_iter_n_children ( GTK_TREE_MODEL ( store ),
-                        &iter );
+        nbre_fils = gtk_tree_model_iter_n_children ( GTK_TREE_MODEL ( store ), &iter );
         if ( nbre_fils > 0 )
         {
             gint i = 0;
@@ -348,18 +368,30 @@
             while ( gtk_tree_model_iter_nth_child ( GTK_TREE_MODEL ( store ),
                         &fils_iter, &iter, i ) )
             {
-                if ( valeur == 1 )
-                {
-                    gtk_tree_model_get ( GTK_TREE_MODEL ( store ), &fils_iter,
+                gtk_tree_model_get ( GTK_TREE_MODEL ( store ), &fils_iter,
                                 SPP_HISTORICAL_AVERAGE_COLUMN, &tmp_str,
+                                SPP_HISTORICAL_RETAINED_AMOUNT, &str_amount,
+                                SPP_HISTORICAL_DIV_COLUMN, &div,
+                                SPP_HISTORICAL_SUB_DIV_COLUMN, &sub_div,
                                 -1 );
-                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &fils_iter, 0, valeur,
+                if ( valeur == 1 )
+                {
+                    bet_data_add_div_hist ( account_nb,
+                                div,
+                                sub_div,
+                                gsb_real_get_from_string ( str_amount ) );
+                    bet_data_set_div_full ( account_nb, div, TRUE );
+                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &fils_iter,
+                                SPP_HISTORICAL_SELECT_COLUMN, 1,
                                 SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
                                 -1 );
                 }
                 else
                 {
-                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &fils_iter, 0, valeur,
+                    bet_data_set_div_full ( account_nb, div, FALSE );
+                    bet_data_remove_div_hist ( account_nb, div, sub_div );
+                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &fils_iter,
+                                SPP_HISTORICAL_SELECT_COLUMN, 0,
                                 SPP_HISTORICAL_RETAINED_COLUMN, "",
                                 -1 );
                 }
@@ -373,14 +405,13 @@
             gboolean test = TRUE;
             gint i = 0;
 
-            if ( gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( store ),
-                        &parent, &iter ) )
+            if ( gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( store ), &parent, &iter ) )
             {
                 while ( gtk_tree_model_iter_nth_child ( GTK_TREE_MODEL ( store ),
                         &iter, &parent, i ) )
                 {
                     gtk_tree_model_get ( GTK_TREE_MODEL ( store ), &iter,
-                        0, &fils_val, -1 );
+                                SPP_HISTORICAL_SELECT_COLUMN, &fils_val, -1 );
                     if ( fils_val != valeur )
                     {
                         test = FALSE;
@@ -389,14 +420,34 @@
                     i++;
                 }
                 if ( test == TRUE )
-                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &parent, 0, valeur, -1 );
+                {
+                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &parent,
+                                SPP_HISTORICAL_SELECT_COLUMN, valeur, -1 );
+                    if ( valeur == 1 )
+                    {
+                        gtk_tree_model_get ( GTK_TREE_MODEL ( store ), &parent,
+                                SPP_HISTORICAL_AVERAGE_COLUMN, &tmp_str,
+                                -1 );
+                        bet_data_set_div_full ( account_nb, div, TRUE );
+                        gtk_tree_store_set ( GTK_TREE_STORE ( store ), &parent,
+                                SPP_HISTORICAL_SELECT_COLUMN, 1,
+                                SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
+                                -1 );
+                    }
+                }
                 else
-                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &parent, 0, 0, -1 );
+                {
+                    bet_data_set_div_full ( account_nb, div, FALSE );
+                    gtk_tree_store_set ( GTK_TREE_STORE ( store ), &parent,
+                                SPP_HISTORICAL_SELECT_COLUMN, 0,
+                                SPP_HISTORICAL_RETAINED_COLUMN, "",
+                                -1 );
+                }
             }
         }
-    }
 
-    bet_estimate_refresh ( );
+        bet_array_refresh_estimate_tab ( );
+    }
 
     return ( FALSE );
 }
@@ -410,8 +461,8 @@
  * */
 void bet_historical_div_cell_editing_started (GtkCellRenderer *cell,
                         GtkCellEditable *editable,
-                        const gchar     *path,
-                        gpointer         data)
+                        const gchar *path_string,
+                        GtkWidget *tree_view )
 {
     if ( GTK_IS_ENTRY ( editable ) ) 
     {
@@ -432,31 +483,47 @@
                         GtkWidget *tree_view )
 {
     GtkTreeModel *model;
-    gint selected_account;
-    gint currency_number;
-    GtkTreePath *path = gtk_tree_path_new_from_string ( path_string );
     GtkTreeIter iter;
-    gchar *tmp_str;
-    gsb_real number;
 
     devel_debug (NULL);
-    number = gsb_real_get_from_string ( new_text );
-
-    /* find the selected account */
-    selected_account = bet_estimate_get_account_selected ( );
-    if ( selected_account == -1 )
-        return;
-    currency_number = gsb_data_account_get_currency ( selected_account );
-
-    tmp_str = gsb_real_get_string_with_currency ( number, currency_number, TRUE );
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
-    gtk_tree_model_get_iter (model, &iter, path);
-    gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
-                        SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
-                        SPP_HISTORICAL_RETAINED_AMOUNT, new_text,
+    if ( gtk_tree_model_get_iter_from_string ( GTK_TREE_MODEL ( model ), &iter, path_string ) )
+    {
+        gboolean valeur;
+        gint selected_account;
+        gint currency_number;
+        gint div;
+        gint sub_div;
+        gchar *tmp_str;
+        gsb_real number;
+
+        gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
+                        SPP_HISTORICAL_SELECT_COLUMN, &valeur,
+                        SPP_HISTORICAL_DIV_COLUMN, &div,
+                        SPP_HISTORICAL_SUB_DIV_COLUMN, &sub_div,
                         -1 );
 
-    bet_estimate_refresh ( );
+        if ( valeur == FALSE )
+            return;
+
+        number = gsb_real_get_from_string ( new_text );
+
+        /* find the selected account */
+        selected_account = bet_parameter_get_account_selected ( );
+        if ( selected_account == -1 )
+            return;
+        currency_number = gsb_data_account_get_currency ( selected_account );
+
+        tmp_str = gsb_real_get_string_with_currency ( number, currency_number, TRUE );
+
+        bet_data_set_div_amount ( selected_account, div, sub_div, number );
+        gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
+                            SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
+                            SPP_HISTORICAL_RETAINED_AMOUNT, new_text,
+                            -1 );
+
+        bet_array_refresh_estimate_tab ( );
+    }
 }
 
 
@@ -466,7 +533,7 @@
  *
  *
  * */
-GtkWidget *bet_estimate_get_historical_data ( GtkWidget *container )
+GtkWidget *bet_historical_get_data ( GtkWidget *container )
 {
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
@@ -484,7 +551,8 @@
                         G_TYPE_BOOLEAN,G_TYPE_STRING,
                         G_TYPE_STRING, G_TYPE_STRING,
                         G_TYPE_STRING, G_TYPE_STRING,
-                        G_TYPE_STRING, G_TYPE_STRING );
+                        G_TYPE_STRING, G_TYPE_STRING,
+                        G_TYPE_INT, G_TYPE_INT );
     gtk_tree_view_set_model ( GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL ( tree_model ) );
     g_object_unref ( G_OBJECT ( tree_model ) );
 
@@ -629,7 +697,7 @@
 
     devel_debug (NULL);
     /* récuperation du n° de compte à utiliser */
-    selected_account = bet_estimate_get_account_selected ( );
+    selected_account = bet_parameter_get_account_selected ( );
     if ( selected_account == -1 )
         return;
 
@@ -659,9 +727,9 @@
         g_object_set_data ( G_OBJECT ( bet_container ), "bet_historical_period",
                 g_strdup ( gsb_data_fyear_get_name ( fyear_number ) ) );
     }
-    list_div = g_hash_table_new_full ( g_int_hash,
+    list_div = g_hash_table_new_full ( g_str_hash,
                         g_str_equal,
-                        NULL,
+                        (GDestroyNotify) g_free,
                         (GDestroyNotify) free_struct_historical );
 
     /* search transactions of the account  */
@@ -695,7 +763,7 @@
          transaction_number ) != 0 )
             continue;
 
-        bet_data_populate_div ( transaction_number, list_div );
+        bet_data_populate_div ( transaction_number, TRUE, list_div );
     }
     bet_historical_affiche_div ( list_div, tree_view );
 
@@ -716,7 +784,7 @@
     devel_debug (NULL);
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
 
-    g_hash_table_foreach ( list_div, bet_estimate_populate_div_model, model );
+    g_hash_table_foreach ( list_div, bet_historical_populate_div_model, tree_view );
 
     return FALSE;
 }
@@ -728,30 +796,34 @@
  *
  *
  * */
-void bet_estimate_populate_div_model ( gpointer key,
+void bet_historical_populate_div_model ( gpointer key,
                         gpointer value,
-                        gpointer user_data)
+                        gpointer user_data )
 {
     SH *sh = ( SH* ) value;
     SBR *sbr = sh -> sbr;
-    GtkTreeModel *model = ( GtkTreeModel * ) user_data;
+    GtkTreeView *tree_view = ( GtkTreeView * ) user_data;
+    GtkTreeModel *model;
     GtkTreeIter parent;
     GHashTableIter iter;
     gpointer sub_key, sub_value;
-    gint div;
     gchar *div_name = NULL;
     gchar *str_balance;
     gchar *str_average;
     gchar *str_amount;
     gchar *titre;
+    gint div;
+    gint account_nb;
     gsb_real period = { 12, 0 };
     gsb_real average;
 
     div = sh -> div;
     div_name = bet_data_get_div_name ( div, 0, FALSE );
+    account_nb = bet_parameter_get_account_selected ( );
 
     titre = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_period" );
 
+    model = gtk_tree_view_get_model ( tree_view );
     average = gsb_real_div ( sbr -> current_balance, period );
     str_amount = gsb_real_get_string ( average );
     str_balance = gsb_real_get_string_with_currency ( sbr -> current_balance, 
@@ -767,11 +839,34 @@
                         SPP_HISTORICAL_BALANCE_COLUMN, str_balance,
                         SPP_HISTORICAL_AVERAGE_COLUMN, str_average,
                         SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
+                        SPP_HISTORICAL_DIV_COLUMN, div,
+                        SPP_HISTORICAL_SUB_DIV_COLUMN, 0,
                         -1);
+    if ( bet_data_search_div_hist ( account_nb, div, 0 ) ||
+     bet_data_get_div_full ( account_nb, div ) )
+    {
+        average = bet_data_get_div_amount ( account_nb, div, 0 );
+        if ( str_amount )
+            g_free ( str_amount );
+        str_amount = gsb_real_get_string ( average );
+        if ( str_average )
+            g_free ( str_average );
+        str_average = gsb_real_get_string_with_currency ( average,
+                        gsb_data_account_get_currency ( sh -> account_nb ), TRUE );
+        gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+                        &parent,
+                        SPP_HISTORICAL_SELECT_COLUMN,
+                        bet_data_search_div_hist ( account_nb, div, 0 ) ||
+                        bet_data_get_div_full ( account_nb, div ),
+                        SPP_HISTORICAL_RETAINED_COLUMN, str_average,
+                        SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
+                        -1);
+    }
     g_free ( div_name );
     g_free ( str_balance );
     g_free ( str_average );
     g_free ( str_amount );
+    if ( div == 27 )
 
     if ( g_hash_table_size ( sh -> list_sub_div ) == 1 )
         return;
@@ -809,8 +904,29 @@
                         SPP_HISTORICAL_BALANCE_COLUMN, str_balance,
                         SPP_HISTORICAL_AVERAGE_COLUMN, str_average,
                         SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
+                        SPP_HISTORICAL_DIV_COLUMN, div,
+                        SPP_HISTORICAL_SUB_DIV_COLUMN, sub_sh -> div,
                         -1);
-
+    if ( bet_data_search_div_hist ( account_nb, div, sub_sh -> div ) )
+    {
+        average = bet_data_get_div_amount ( account_nb, div, sub_sh -> div );
+        if ( str_amount )
+            g_free ( str_amount );
+        str_amount = gsb_real_get_string ( average );
+        if ( str_average )
+            g_free ( str_average );
+        str_average = gsb_real_get_string_with_currency ( average,
+                        gsb_data_account_get_currency ( sh -> account_nb ), TRUE );
+        gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+                        &fils,
+                        SPP_HISTORICAL_SELECT_COLUMN,
+                        bet_data_search_div_hist ( account_nb, div, sub_sh -> div ),
+                        SPP_HISTORICAL_RETAINED_COLUMN, str_average,
+                        SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
+                        -1);
+        if ( bet_data_get_div_full ( account_nb, div ) == FALSE )
+            gtk_tree_view_expand_to_path ( tree_view, gtk_tree_model_get_path ( model, &fils ) );
+    }
         g_free ( div_name );
         g_free ( str_balance );
         g_free ( str_average );
@@ -825,7 +941,7 @@
  *
  * \return TRUE ok, FALSE problem
  * */
-gboolean bet_fyear_create_combobox_store ( void )
+gboolean bet_historical_fyear_create_combobox_store ( void )
 {
     gchar *titre;
 
@@ -910,7 +1026,7 @@
                         -1 );
             if ( valeur == 1 )
             {
-                bet_estimate_tab_add_new_line ( tab_model,
+                bet_array_list_add_new_line ( tab_model,
                         GTK_TREE_MODEL ( model ), &iter,
                         date_min, date_max );
             }
@@ -927,7 +1043,7 @@
 
                     if ( valeur == 1 )
                     {
-                        bet_estimate_tab_add_new_line ( tab_model,
+                        bet_array_list_add_new_line ( tab_model,
                                 GTK_TREE_MODEL ( model ), &fils_iter,
                                 date_min, date_max );
                     }

Index: balance_estimate_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- balance_estimate_config.h	24 Jan 2010 10:48:31 -0000	1.1
+++ balance_estimate_config.h	20 Feb 2010 08:54:00 -0000	1.2
@@ -7,7 +7,7 @@
 /* END_INCLUDE_H */
 
 /* START_DECLARATION */
-GtkWidget *bet_estimate_config_create_page ( void );
+GtkWidget *bet_config_create_page ( void );
 /* END_DECLARATION */
 
 



More information about the cvs mailing list