[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.18, 1.19 balance_estimate_config.h, 1.5, 1.6 balance_estimate_data.c, 1.26, 1.27 balance_estimate_data.h, 1.17, 1.18 balance_estimate_future.c, 1.12, 1.13 balance_estimate_hist.c, 1.24, 1.25 balance_estimate_hist.h, 1.10, 1.11 balance_estimate_tab.c, 1.69, 1.70 balance_estimate_tab.h, 1.16, 1.17 fenetre_principale.c, 1.136, 1.137 fenetre_principale.h, 1.33, 1.34 gsb_account.c, 1.50, 1.51 gsb_data_account.c, 1.108, 1.109 gsb_data_account.h, 1.45, 1.46 gsb_data_transaction.c, 1.90, 1.91 gsb_form.c, 1.164, 1.165 gsb_transactions_list.c, 1.211, 1.212 import.c, 1.333, 1.334 navigation.c, 1.144, 1.145 parametres.c, 1.215, 1.216 structures.h, 1.247, 1.248 traitement_variables.c, 1.195, 1.196

Pierre Biava pbiava at users.sourceforge.net
Tue May 18 22:12:56 CEST 2010


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

Modified Files:
	balance_estimate_config.c balance_estimate_config.h 
	balance_estimate_data.c balance_estimate_data.h 
	balance_estimate_future.c balance_estimate_hist.c 
	balance_estimate_hist.h balance_estimate_tab.c 
	balance_estimate_tab.h fenetre_principale.c 
	fenetre_principale.h gsb_account.c gsb_data_account.c 
	gsb_data_account.h gsb_data_transaction.c gsb_form.c 
	gsb_transactions_list.c import.c navigation.c parametres.c 
	structures.h traitement_variables.c 
Log Message:
Fixed bugs in the budget module and minor changes.

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- navigation.c	4 May 2010 12:27:53 -0000	1.144
+++ navigation.c	18 May 2010 20:12:54 -0000	1.145
@@ -100,6 +100,7 @@
 
 
 /*START_EXTERN*/
+extern GtkWidget *account_page;
 extern gchar *initial_holder_title;
 extern GtkWidget *label_last_statement;
 extern GtkWidget *menu_import_rules;
@@ -1096,7 +1097,6 @@
 gboolean gsb_gui_navigation_select_line ( GtkTreeSelection *selection,
                         GtkTreeModel *model )
 {
-    GtkWidget * account_notebook;
     gint account_number, page_number;
     gint report_number;
     gchar * title = NULL;
@@ -1160,10 +1160,9 @@
 	    gsb_menu_update_view_menu ( account_number );
 
 	    /* set the form */
-	    account_notebook = g_object_get_data ( G_OBJECT (notebook_general), "account_notebook" );
-        gsb_gui_on_account_switch_page ( GTK_NOTEBOOK ( account_notebook ),
+        gsb_gui_on_account_switch_page ( GTK_NOTEBOOK ( account_page ),
                         NULL,
-                        gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_notebook ) ),
+                        gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_page ) ),
                         NULL );
 	    gsb_form_show ( FALSE );
 

Index: balance_estimate_future.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- balance_estimate_future.c	8 May 2010 05:54:13 -0000	1.12
+++ balance_estimate_future.c	18 May 2010 20:12:54 -0000	1.13
@@ -31,6 +31,7 @@
 /*START_INCLUDE*/
 #include "balance_estimate_future.h"
 #include "./balance_estimate_data.h"
+#include "./balance_estimate_tab.h"
 #include "./dialog.h"
 #include "./utils_dates.h"
 #include "./gsb_calendar_entry.h"
@@ -234,7 +235,8 @@
         else
             bet_data_future_add_lines ( scheduled );
 
-        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
     }
 
     gtk_widget_hide ( bet_futur_dialog );
@@ -1720,7 +1722,7 @@
             bet_data_future_modify_lines ( scheduled );
         }
 
-        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
     }
 
     gtk_widget_hide ( bet_futur_dialog );
@@ -1813,7 +1815,8 @@
         else
             bet_data_transfert_add_line ( transfert );
 
-        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
     }
 
     gtk_widget_hide ( bet_transfert_dialog );
@@ -2362,7 +2365,8 @@
             bet_data_transfert_modify_line ( transfert );
         }
 
-        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
     }
 
     gtk_widget_hide ( bet_transfert_dialog );
@@ -2457,13 +2461,14 @@
  *
  *
  * */
-//~ void bet_transfert_auto_inc_toggle ( GtkToggleButton *button, gpointer data )
-//~ {
-    //~ gint account_number;
+/*void bet_transfert_auto_inc_toggle ( GtkToggleButton *button, gpointer data )
+{
+    gint account_number;
 
-    //~ account_number = gsb_gui_navigation_get_current_account ( );
-    //~ bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
-//~ }
+    account_number = gsb_gui_navigation_get_current_account ( );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+    bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
+}*/
 
 
 /**

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- gsb_data_transaction.c	14 May 2010 19:03:46 -0000	1.90
+++ gsb_data_transaction.c	18 May 2010 20:12:54 -0000	1.91
@@ -2314,10 +2314,8 @@
 
     gsb_data_transaction_free (transaction);
 
-#ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( transaction -> account_number, BET_MAJ_ESTIMATE );
-#endif /* ENABLE_BALANCE_ESTIMATE */
+    gsb_data_account_set_bet_maj ( transaction -> account_number, BET_MAJ_ALL );
 
     return TRUE;
 }

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- balance_estimate_config.c	8 May 2010 05:54:13 -0000	1.18
+++ balance_estimate_config.c	18 May 2010 20:12:54 -0000	1.19
@@ -32,6 +32,7 @@
 #include "balance_estimate_config.h"
 #include "./balance_estimate_data.h"
 #include "./balance_estimate_hist.h"
+#include "./balance_estimate_tab.h"
 #include "./utils_dates.h"
 #include "./gsb_account.h"
 #include "./gsb_automem.h"
@@ -50,21 +51,28 @@
 
 
 /*START_STATIC*/
[...1029 lines suppressed...]
     else
     {
+        bet_data_remove_all_bet_data ( account_number );
         gsb_data_account_set_bet_use_budget ( account_number, 0 );
-        widget = g_object_get_data ( G_OBJECT ( notebook ), "Data_for_forecast" );
+        widget = g_object_get_data ( G_OBJECT ( account_page ), "Data_for_forecast" );
         gtk_widget_hide_all ( widget );
-        widget = g_object_get_data ( G_OBJECT ( notebook ), "Data_for_historical" );
+        widget = g_object_get_data ( G_OBJECT ( account_page ), "Data_for_historical" );
         gtk_widget_hide_all ( widget );
-
-        if ( gsb_gui_navigation_get_current_account ( ) == account_number )
-            bet_data_select_bet_pages ( account_number );
     }
+
+    if ( gsb_gui_navigation_get_current_account ( ) == account_number )
+        bet_data_select_bet_pages ( account_number );
 }
 
 

Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- traitement_variables.c	4 May 2010 20:38:18 -0000	1.195
+++ traitement_variables.c	18 May 2010 20:12:54 -0000	1.196
@@ -389,7 +389,7 @@
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* création de la liste des données à utiliser dans le tableau de résultats */
     bet_data_init_variables ( );
-    /* initialisation des boites de dialogues */
+    /* initialisation des boites de dialogue */
     bet_future_initialise_dialog ( );
 #endif /* ENABLE_BALANCE_ESTIMATE */
     etat.bet_deb_period = 1;

Index: balance_estimate_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- balance_estimate_config.h	5 Apr 2010 21:24:53 -0000	1.5
+++ balance_estimate_config.h	18 May 2010 20:12:54 -0000	1.6
@@ -7,14 +7,15 @@
 /* END_INCLUDE_H */
 
 /* START_DECLARATION */
-GtkWidget *bet_config_create_account_page ( void );
-GtkWidget *bet_config_create_general_page ( void );
+GtkWidget *bet_config_account_create_account_page ( void );
+GtkWidget *bet_config_general_create_general_page ( void );
 void bet_config_duration_button_clicked ( GtkWidget *togglebutton,
                         GtkWidget *spin_button );
 gboolean bet_config_duration_number_changed ( GtkWidget *spin_button,
                         gpointer data );
 void bet_config_fyear_clicked ( GtkWidget *combo, gpointer data );
 void bet_config_origin_data_clicked ( GtkWidget *togglebutton, gpointer data );
+GtkWidget *bet_config_get_duration_widget ( gint origin );
 /* END_DECLARATION */
 
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- balance_estimate_tab.h	4 May 2010 12:27:52 -0000	1.16
+++ balance_estimate_tab.h	18 May 2010 20:12:54 -0000	1.17
@@ -32,7 +32,7 @@
                         GtkTreeIter *iter,
                         GDate *date_min,
                         GDate *date_max );
-void bet_array_update_estimate_tab ( gint account_number );
+void bet_array_update_estimate_tab ( gint account_number, gint type_maj );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_TAB_H*/

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- gsb_data_account.c	14 May 2010 19:03:46 -0000	1.108
+++ gsb_data_account.c	18 May 2010 20:12:54 -0000	1.109
@@ -127,6 +127,7 @@
     gint bet_select_futur_label;        /* fixe le label pour les données futures */
     gint bet_hist_data;                 /* origine des données 0 = catégories 1 = IB */
     gint bet_hist_fyear;                /* numéro d'exercice */
+    gint bet_maj;                       /* MAJ du module estiamte balance */
 } struct_account;
 
 
@@ -3203,6 +3204,12 @@
 }
 
 
+/**
+ *
+ *
+ *
+ *
+ * */
 gboolean gsb_data_account_set_bet_use_budget ( gint account_number, gint value )
 {
     struct_account *account;
@@ -3216,6 +3223,46 @@
 
     return TRUE;
 }
+/**
+ *
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_maj ( gint account_number )
+{
+    struct_account *account;
+
+    account = gsb_data_account_get_structure ( account_number );
+
+    if (!account )
+	    return 0;
+
+    return account -> bet_maj;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_maj ( gint account_number, gint type_maj )
+{
+    struct_account *account;
+
+    account = gsb_data_account_get_structure ( account_number );
+
+    if ( !account )
+	    return FALSE;
+
+    account -> bet_maj = type_maj;
+
+    return TRUE;
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: balance_estimate_hist.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- balance_estimate_hist.h	17 Apr 2010 15:37:03 -0000	1.10
+++ balance_estimate_hist.h	18 May 2010 20:12:54 -0000	1.11
@@ -27,11 +27,14 @@
 /* START_DECLARATION */
 GtkWidget *bet_historical_create_page ( void );
 gint bet_historical_get_fyear_from_combobox ( GtkWidget *combo_box );
+void bet_historical_g_signal_block_tree_view ( void );
+void bet_historical_g_signal_unblock_tree_view ( void );
 void bet_historical_populate_data ( gint account_number );
 void bet_historical_refresh_data ( GtkTreeModel *tab_model,
                         GDate *date_min,
                         GDate *date_max );
 void bet_historical_set_fyear_from_combobox ( GtkWidget *combo_box, gint fyear );
+void bet_historical_set_page_title ( gint account_number );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_HIST_H*/

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- balance_estimate_tab.c	8 May 2010 05:54:13 -0000	1.69
+++ balance_estimate_tab.c	18 May 2010 20:12:54 -0000	1.70
@@ -138,9 +138,11 @@
                         GtkTreePath *path,
                         GtkTreeIter *iter,
                         gpointer data );
+static GtkWidget *bet_array_create_tree_view ( void );
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern GtkWidget *account_page;
 extern gchar* bet_duration_array[];
 extern GdkColor couleur_bet_division;
 extern GdkColor couleur_bet_future;
@@ -149,6 +151,7 @@
 extern gint mise_a_jour_liste_echeances_auto_accueil;
 extern GtkWidget *notebook_general;
 extern gsb_real null_real;
+extern const gdouble prev_month_max;
 extern gint valeur_echelle_recherche_date_import;
 /*END_EXTERN*/
 
@@ -166,28 +169,19 @@
     SPP_ESTIMATE_TREE_AMOUNT_COLUMN,    /* the amount without currency */
     SPP_ESTIMATE_TREE_BALANCE_COLOR,
     SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
-    SPP_ESTIMATE_TREE_NUM_COLUMNS
+    SPP_ESTIMATE_TREE_NUM_COLUMNS,
 };
 
 
 /*
- * 
+ * Met à jour les données à afficher dans les différentes vues du module
  *
  * 
  */
-void bet_array_update_estimate_tab ( gint account_number )
+void bet_array_update_estimate_tab ( gint account_number, gint type_maj )
 {
-    gint type_maj;
-
     devel_debug_int ( account_number );
     /* test account number */
-    if ( account_number == -1 )
-        return;
-
-    type_maj = bet_data_get_maj ( );
-
-    if ( type_maj == BET_MAJ_FALSE )
-        return;
 
     bet_array_initializes_account_settings ( account_number );
     switch ( type_maj )
@@ -203,7 +197,6 @@
             bet_array_refresh_estimate_tab ( account_number );
         break;
     }
-    bet_data_set_maj ( -1, BET_MAJ_FALSE );
 }
 
 
@@ -358,7 +351,6 @@
  */
 void bet_array_refresh_estimate_tab ( gint account_number )
 {
-    GtkWidget *notebook;
     GtkWidget *widget;
     GtkWidget *tree_view;
     GtkTreeIter iter;
@@ -377,8 +369,7 @@
     SBR *tmp_range;
     GValue date_value = {0, };
 
-    //~ devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    devel_debug (NULL);
     tmp_range = struct_initialise_bet_range ( );
 
     /* calculate date_min and date_max with user choice */
@@ -386,7 +377,7 @@
     
     date_max = bet_data_array_get_date_max ( account_number );
 
-    widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_initial_date");
+    widget = g_object_get_data ( G_OBJECT ( account_page ), "bet_initial_date");
     gsb_calendar_entry_set_date ( widget, date_min );
 
     str_date_min = gsb_format_gdate ( date_min );
@@ -421,19 +412,12 @@
                         gsb_data_account_get_name ( account_number ),
                         str_date_min, str_date_max );
 
-    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( notebook ), "bet_array_title") );
-    gtk_label_set_label ( GTK_LABEL ( widget ), title );
-    g_free ( title );
-
-    title = g_strdup_printf (
-                        _("Please select the data source for the account: \"%s\""),
-                        gsb_data_account_get_name ( account_number ) );
-    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_title") );
+    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( account_page ), "bet_array_title") );
     gtk_label_set_label ( GTK_LABEL ( widget ), title );
     g_free ( title );
 
     /* clear the model */
-    tree_view = g_object_get_data ( G_OBJECT ( notebook ), "bet_estimate_treeview" );
+    tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_estimate_treeview" );
     tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
     gtk_tree_store_clear ( GTK_TREE_STORE ( tree_model ) );
 
@@ -503,25 +487,15 @@
  * */
 GtkWidget *bet_array_create_page ( void )
 {
-    GtkWidget *notebook;
     GtkWidget *page;
     GtkWidget *widget = NULL;
     GtkWidget *initial_date = NULL;
     GtkWidget *hbox;
     GtkWidget *align;
     GtkWidget *label;
-    GtkWidget *spin_button = NULL;
-    GtkWidget *previous = NULL;
-    GtkWidget *scrolled_window;
     GtkWidget *tree_view;
-    GtkTreeStore *tree_model;
-    GtkTreeModel *sortable;
-    GtkCellRenderer *cell;
-    GtkTreeViewColumn *column;
-    gint iduration;
 
     devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     page = gtk_vbox_new ( FALSE, 5 );
     gtk_widget_set_name ( page, "forecast_page" );
 
@@ -531,56 +505,15 @@
 
     label = gtk_label_new ("Estimate array");
     gtk_container_add ( GTK_CONTAINER ( align ), label );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_array_title", label );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_array_title", label );
 
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
     gtk_box_pack_start ( GTK_BOX ( page ), align, FALSE, FALSE, 5) ;
 
-    hbox = gtk_hbox_new ( FALSE, 5 );
+    /* set the duration widget */
+    hbox = bet_config_get_duration_widget ( SPP_ORIGIN_ARRAY );
     gtk_container_add ( GTK_CONTAINER ( align ), hbox );
 
-    label = gtk_label_new ( _("Duration estimation") );
-    gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
-    gtk_box_pack_start( GTK_BOX ( hbox ), label, FALSE, FALSE, 5);
-
-    spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
-
-    gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 5 );
-
-    for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
-    {
-        if (previous == NULL)
-        {
-            widget = gtk_radio_button_new_with_label ( NULL,
-                        _(bet_duration_array[iduration]) );
-            previous = widget;
-        }  
-        else 
-        {
-            widget = gtk_radio_button_new_with_label_from_widget (
-                        GTK_RADIO_BUTTON ( previous ),
-                        _(bet_duration_array[iduration]) );
-        }
-        gtk_widget_set_name ( widget, bet_duration_array[iduration] );
-        gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
-        g_signal_connect (G_OBJECT ( widget ),
-                        "released",
-                        G_CALLBACK ( bet_config_duration_button_clicked ),
-                        spin_button );
-    }
-
-    g_object_set_data ( G_OBJECT ( spin_button ), "bet_origin_signal", GINT_TO_POINTER ( 1 ) );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_account_previous", previous );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_account_widget", widget );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_account_spin_button", spin_button );
-
-    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
-
-    g_signal_connect ( G_OBJECT ( spin_button ),
-                        "value-changed",
-                        G_CALLBACK ( bet_config_duration_number_changed ),
-                        GINT_TO_POINTER ( 1 ) );
-
     /* set the start date and the automatic change of month */
     label = gtk_label_new ( COLON ( _("Start date" ) ) );
     gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
@@ -595,24 +528,48 @@
 			            "key-press-event",
 			            G_CALLBACK ( bet_array_entry_key_press ),
 			            NULL );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_initial_date", initial_date );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_initial_date", initial_date );
     gtk_box_pack_start ( GTK_BOX (hbox), initial_date, FALSE, FALSE, 0 );
 
     widget = gtk_check_button_new ( );
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), FALSE );
     gtk_widget_set_tooltip_text ( GTK_WIDGET ( widget ),
                         SPACIFY(_("Check the box to automatically change start date") ) );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_auto_inc_month", widget );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_auto_inc_month", widget );
     gtk_box_pack_start ( GTK_BOX (hbox), widget, FALSE, FALSE, 0 );
     g_signal_connect ( G_OBJECT ( widget ),
 			            "toggled",
 			            G_CALLBACK ( bet_array_auto_inc_month_toggle ),
 			            NULL );
 
+    tree_view = bet_array_create_tree_view ( );
+    gtk_box_pack_start ( GTK_BOX ( page ), tree_view, TRUE, TRUE, 5 );
+
+    gtk_widget_show_all ( page );
+
+    return page;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+GtkWidget *bet_array_create_tree_view ( void )
+{
+    GtkWidget *scrolled_window;
+    GtkWidget *tree_view;
+    GtkTreeStore *tree_model;
+    GtkTreeModel *sortable;
+    GtkCellRenderer *cell;
+    GtkTreeViewColumn *column;
+
     /* create the estimate treeview */
     tree_view = gtk_tree_view_new ( );
     gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW ( tree_view ), TRUE );
-    g_object_set_data ( G_OBJECT ( notebook), "bet_estimate_treeview", tree_view );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_estimate_treeview", tree_view );
 
     /* create the model */
     tree_model = gtk_tree_store_new ( SPP_ESTIMATE_TREE_NUM_COLUMNS,
@@ -648,8 +605,6 @@
 				        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
     gtk_container_add ( GTK_CONTAINER ( scrolled_window ), tree_view );
     gtk_widget_show ( scrolled_window );
-    gtk_box_pack_start ( GTK_BOX ( page ),
-		                GTK_WIDGET ( scrolled_window ), TRUE, TRUE, 5 );
 
     /* Date column */
     cell = gtk_cell_renderer_text_new ();
@@ -725,9 +680,9 @@
 		                G_CALLBACK ( bet_array_list_button_press ),
 		                NULL );
 
-    gtk_widget_show_all ( page );
+    gtk_widget_show_all ( tree_view );
 
-    return page;
+    return scrolled_window;;
 }
 
 
@@ -1175,7 +1130,10 @@
         if ( g_date_compare ( scheduled -> date, date_tomorrow ) < 0 )
         {
             bet_data_future_remove_line ( account_number, scheduled -> number );
+            g_hash_table_iter_init ( &iter, future_list );
             g_date_free ( date_tomorrow );
+            if ( g_hash_table_size ( future_list ) == 0 )
+                return FALSE;
             continue;
         }
         else
@@ -1231,7 +1189,7 @@
             g_free ( str_credit );
     }
 
-    return FALSE;
+    return TRUE;
 }
 
 
@@ -1509,10 +1467,7 @@
 
     if ( origine == SPP_ORIGIN_TRANSACTION )
     {
-        GtkNotebook *notebook;
-
-        notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 0 );
+        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), 0 );
         transaction_list_select ( number );
         gsb_transactions_list_edit_transaction ( number );
     }
@@ -1566,7 +1521,7 @@
         bet_data_remove_div_hist ( account_number, number, sub_div_nb );
         gtk_tree_store_remove ( GTK_TREE_STORE ( model ), &iter );
 
-        bet_data_set_maj ( account_number, BET_MAJ_HISTORICAL );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_HISTORICAL );
     }
     else if ( origine == SPP_ORIGIN_FUTURE )
     {
@@ -1614,7 +1569,8 @@
         account_number = gsb_gui_navigation_get_current_account ( );
         bet_data_future_remove_lines ( account_number, number, mother_row );
 
-        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
     }
 }
 
@@ -1690,7 +1646,8 @@
         return;
 
     account_number = gsb_gui_navigation_get_current_account ( );
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+    bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
 }
 
 
@@ -1916,7 +1873,8 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+    bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
 
     return FALSE;
 }
@@ -2023,16 +1981,15 @@
  * */
 gboolean bet_array_initializes_account_settings ( gint account_number )
 {
-    GtkWidget *notebook;
     GtkWidget *widget = NULL;
     GtkWidget *button = NULL;
     GtkWidget *toggled = NULL;
+    gpointer pointer;
     gint param;
     gint months;
 
     //~ devel_debug_int ( account_number );
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
-    button = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_spin_button" );
+    button = g_object_get_data ( G_OBJECT ( account_page ), "bet_account_spin_button" );
 
     param = gsb_data_account_get_bet_spin_range ( account_number );
     months = gsb_data_account_get_bet_months ( account_number );
@@ -2043,23 +2000,23 @@
 
     if ( param == 0 )
     {
-        widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_previous" );
+        widget = g_object_get_data ( G_OBJECT ( account_page ), "bet_account_previous" );
         g_signal_handlers_block_by_func ( G_OBJECT ( widget ),
                         G_CALLBACK ( bet_config_duration_button_clicked ),
                         button );
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
-        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, 240.0 );
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, prev_month_max );
         gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
                         (gdouble) months );
     }
     else
     {
-        widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_widget" );
+        widget = g_object_get_data ( G_OBJECT ( account_page ), "bet_account_widget" );
         g_signal_handlers_block_by_func ( G_OBJECT ( widget ),
                         G_CALLBACK ( bet_config_duration_button_clicked ),
                         button );
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
-        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, 20.0 );
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, prev_month_max / 12.0 );
         gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
                         (gdouble) months / 12.0 );
     }
@@ -2071,7 +2028,7 @@
                         G_CALLBACK ( bet_config_duration_number_changed ),
                         GINT_TO_POINTER ( 1 ) );
 
-    toggled = g_object_get_data ( G_OBJECT ( notebook ), "bet_auto_inc_month" );
+    toggled = g_object_get_data ( G_OBJECT ( account_page ), "bet_auto_inc_month" );
     g_signal_handlers_block_by_func ( G_OBJECT ( toggled ),
                         G_CALLBACK ( bet_array_auto_inc_month_toggle ),
                         NULL );
@@ -2086,22 +2043,23 @@
     param = gsb_data_account_get_bet_hist_data ( account_number );
 
     if ( param == 1 )
-        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_button_2" );
+        button = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_button_2" );
     else
-        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_button_1" );
+        button = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_button_1" );
 
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
 
     param = gsb_data_account_get_bet_hist_fyear ( account_number );
-    widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo" );
+    widget = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_fyear_combo" );
+    pointer = g_object_get_data ( G_OBJECT ( widget ), "pointer" );
     g_signal_handlers_block_by_func ( G_OBJECT ( widget ),
                         G_CALLBACK ( bet_config_fyear_clicked ),
-                        GINT_TO_POINTER ( 1 ) );
+                        pointer );
 
     bet_historical_set_fyear_from_combobox ( widget, param );
     g_signal_handlers_unblock_by_func ( G_OBJECT ( widget ),
                         G_CALLBACK ( bet_config_fyear_clicked ),
-                        GINT_TO_POINTER ( 1 ) );
+                        pointer );
 
     return FALSE;
 }
@@ -2438,7 +2396,8 @@
         if ( value )
         {
             gsb_data_account_bet_update_initial_date_if_necessary ( account_number );
-            bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+            gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+            bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
         }
 
         if ( etat.modification_fichier == 0 )

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- balance_estimate_hist.c	1 May 2010 07:59:13 -0000	1.24
+++ balance_estimate_hist.c	18 May 2010 20:12:54 -0000	1.25
@@ -39,6 +39,7 @@
 #include "./gsb_data_transaction.h"
 #include "./gsb_fyear.h"
 #include "./gsb_real.h"
+#include "./navigation.h"
 #include "./traitement_variables.h"
 #include "./utils_str.h"
 #include "./balance_estimate_data.h"
@@ -93,11 +94,15 @@
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern GtkWidget *account_page;
 extern GdkColor couleur_fond[2];
 extern GtkWidget *notebook_general;
 extern gsb_real null_real;
 /*END_EXTERN*/
 
+/* blocage des signaux pour le tree_view pour les comptes de type GSB_TYPE_CASH */
+static gboolean hist_block_signal = FALSE;
+
 /**
  * this is a tree model filter with 3 columns :
  * the name, the number and a boolean to show it or not
@@ -119,7 +124,6 @@
  * */
 GtkWidget *bet_historical_create_page ( void )
 {
-    GtkWidget *notebook;
     GtkWidget *widget;
     GtkWidget *page;
     GtkWidget *hbox;
@@ -129,9 +133,9 @@
     GtkWidget *tree_view;
     gchar *str_year;
     gint year;
+    gpointer pointer;
 
     devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     page = gtk_vbox_new ( FALSE, 5 );
     gtk_widget_set_name ( page, "historical_page" );
 
@@ -141,7 +145,7 @@
  
     label = gtk_label_new ( "bet_hist_title" );
     gtk_container_add ( GTK_CONTAINER ( align ), label );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_title", label);
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_hist_title", label);
 
     /* Choix des données sources */
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
@@ -149,7 +153,7 @@
 
     hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_container_add ( GTK_CONTAINER ( align ), hbox );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_data", hbox );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_historical_data", hbox );
 
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("Categories") );
@@ -167,8 +171,8 @@
                         G_CALLBACK ( bet_config_origin_data_clicked ),
                         GINT_TO_POINTER ( 1 ) );
 
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_button_1", button_1 );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_button_2", button_2 );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_hist_button_1", button_1 );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_hist_button_2", button_2 );
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
 
@@ -183,7 +187,7 @@
         gtk_widget_set_tooltip_text ( GTK_WIDGET ( widget ),
                         SPACIFY(_("Choose the financial year or 12 months rolling") ) );
 
-        g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo", widget );
+        g_object_set_data ( G_OBJECT ( account_page ), "bet_hist_fyear_combo", widget );
 
         gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5);
 
@@ -194,15 +198,17 @@
         g_free ( str_year );
 
         /* set the signal */
+        pointer = GINT_TO_POINTER ( 1 );
+        g_object_set_data ( G_OBJECT ( widget ), "pointer", pointer );
         g_signal_connect ( G_OBJECT ( widget ),
                         "changed",
                         G_CALLBACK (bet_config_fyear_clicked),
-                        GINT_TO_POINTER ( 1 ) );
+                        pointer );
     }
 
     /* création de la liste des données */
     tree_view = bet_historical_get_data_tree_view ( page );
-    g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_treeview", tree_view );
+    g_object_set_data ( G_OBJECT ( account_page ), "bet_historical_treeview", tree_view );
 
     gtk_widget_show_all ( page );
 
@@ -230,7 +236,7 @@
         gint div_number;
         gint sub_div_nb;
         gint nbre_fils;
-        gint account_nb;
+        gint account_number;
         gboolean valeur;
         gboolean col_edited;
 
@@ -238,7 +244,7 @@
                         SPP_HISTORICAL_SELECT_COLUMN, &valeur,
                         SPP_HISTORICAL_AVERAGE_COLUMN, &str_average,
                         SPP_HISTORICAL_AVERAGE_AMOUNT, &str_amount,
-                        SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
+                        SPP_HISTORICAL_ACCOUNT_NUMBER, &account_number,
                         SPP_HISTORICAL_DIV_NUMBER, &div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
                         SPP_HISTORICAL_EDITED_COLUMN, &col_edited,
@@ -252,27 +258,28 @@
 
         if ( valeur == 1 )
         {
-            //~ printf ("avant - account_nb = %d, div = %d, sub_div = %d\n", account_nb, div, sub_div);
-            bet_data_hist_add_div ( account_nb, div_number, sub_div_nb );
-            bet_data_set_div_amount ( account_nb, div_number, sub_div_nb,
+            //~ printf ("avant - account_number = %d, div = %d, sub_div = %d\n",
+                        //~ account_number, div, sub_div);
+            bet_data_hist_add_div ( account_number, div_number, sub_div_nb );
+            bet_data_set_div_amount ( account_number, div_number, sub_div_nb,
                         gsb_real_import_from_string ( str_amount ) );
             gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
                         SPP_HISTORICAL_SELECT_COLUMN, 1,
                         SPP_HISTORICAL_RETAINED_COLUMN, str_average,
                         SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
-                        SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
+                        SPP_HISTORICAL_ACCOUNT_NUMBER, account_number,
                         SPP_HISTORICAL_DIV_NUMBER, div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
                         -1 );
         }
         else
         {
-            bet_data_remove_div_hist ( account_nb, div_number, sub_div_nb );
+            bet_data_remove_div_hist ( account_number, div_number, sub_div_nb );
             gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
                         SPP_HISTORICAL_SELECT_COLUMN, FALSE,
                         SPP_HISTORICAL_RETAINED_COLUMN, "",
                         SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
-                        SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
+                        SPP_HISTORICAL_ACCOUNT_NUMBER, account_number,
                         SPP_HISTORICAL_DIV_NUMBER, div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
                         SPP_HISTORICAL_EDITED_COLUMN, TRUE,
@@ -303,7 +310,7 @@
                     if ( str_average )
                         g_free ( str_average );
                     str_average = gsb_real_get_string_with_currency ( amount,
-                                gsb_data_account_get_currency ( account_nb ), TRUE );
+                                gsb_data_account_get_currency ( account_number ), TRUE );
                     gtk_tree_store_set ( GTK_TREE_STORE ( model ),
                                 &parent,
                                 SPP_HISTORICAL_SELECT_COLUMN, TRUE,
@@ -311,13 +318,13 @@
                                 SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
                                 -1);
                     if ( bet_historical_amount_differ_average ( model, &parent) )
-                        bet_data_set_div_amount ( account_nb, div_number, 0, amount );
+                        bet_data_set_div_amount ( account_number, div_number, 0, amount );
                         
                     bet_historical_row_collapse_all ( NULL, &parent, model );
                 }
                 else
                 {
-                    bet_data_set_div_amount ( account_nb, div_number, 0, null_real );
+                    bet_data_set_div_amount ( account_number, div_number, 0, null_real );
                     gtk_tree_store_set ( GTK_TREE_STORE ( model ), &parent,
                                 SPP_HISTORICAL_SELECT_COLUMN, FALSE,
                                 SPP_HISTORICAL_RETAINED_COLUMN, "",
@@ -327,7 +334,8 @@
             }
         }
 
-        bet_data_set_maj ( account_nb, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        bet_data_update_bet_module ( account_number, GSB_HISTORICAL_PAGE );
     }
 
     if ( etat.modification_fichier == 0 )
@@ -374,7 +382,7 @@
         GtkTreeIter parent;
         gboolean valeur;
         gboolean edited;
-        gint account_nb;
+        gint account_number;
         gint currency_number;
         gint div_number;
         gint sub_div_nb;
@@ -385,7 +393,7 @@
 
         gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
                         SPP_HISTORICAL_SELECT_COLUMN, &valeur,
-                        SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
+                        SPP_HISTORICAL_ACCOUNT_NUMBER, &account_number,
                         SPP_HISTORICAL_DIV_NUMBER, &div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
                         SPP_HISTORICAL_EDITED_COLUMN, &edited,
@@ -402,14 +410,14 @@
         }
 
         number = gsb_real_get_from_string ( new_text );
-        currency_number = gsb_data_account_get_currency ( account_nb );
+        currency_number = gsb_data_account_get_currency ( account_number );
         tmp_str = gsb_real_get_string_with_currency ( number, currency_number, TRUE );
 
-        if ( bet_data_search_div_hist ( account_nb, div_number, sub_div_nb ) == FALSE )
-            bet_data_hist_add_div ( account_nb, div_number, sub_div_nb );
+        if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) == FALSE )
+            bet_data_hist_add_div ( account_number, div_number, sub_div_nb );
 
-        bet_data_set_div_edited  ( account_nb, div_number, sub_div_nb, TRUE );
-        bet_data_set_div_amount ( account_nb, div_number, sub_div_nb, number );
+        bet_data_set_div_edited  ( account_number, div_number, sub_div_nb, TRUE );
+        bet_data_set_div_amount ( account_number, div_number, sub_div_nb, number );
         gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
                             SPP_HISTORICAL_SELECT_COLUMN, TRUE,
                             SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
@@ -426,10 +434,10 @@
         if ( is_parent && bet_historical_get_full_div ( model, &parent ) )
         {
             number = bet_historical_get_children_amount ( model, &parent );
-            bet_data_set_div_amount ( account_nb, div_number, 0, number );
+            bet_data_set_div_amount ( account_number, div_number, 0, number );
             str_amount = gsb_real_save_real_to_string ( number, 2 );
             tmp_str = gsb_real_get_string_with_currency ( number,
-                        gsb_data_account_get_currency ( account_nb ), TRUE );
+                        gsb_data_account_get_currency ( account_number ), TRUE );
             gtk_tree_store_set ( GTK_TREE_STORE ( model ),
                         &parent,
                         SPP_HISTORICAL_SELECT_COLUMN, TRUE,
@@ -441,7 +449,7 @@
             g_free ( tmp_str );
         }
 
-        bet_data_set_maj ( account_nb, BET_MAJ_ESTIMATE );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
 
         if ( etat.modification_fichier == 0 )
             modification_fichier ( TRUE );
@@ -457,7 +465,6 @@
  * */
 GtkWidget *bet_historical_get_data_tree_view ( GtkWidget *container )
 {
-    GtkWidget *notebook;
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
     GtkTreeStore *tree_model;
@@ -467,9 +474,9 @@
     gchar *title;
 
     //~ devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     tree_view = gtk_tree_view_new ( );
     gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW (tree_view), TRUE);
+    g_object_set_data ( G_OBJECT ( account_page ), "hist_tree_view", tree_view );
 
     tree_model = gtk_tree_store_new ( SPP_HISTORICAL_NUM_COLUMNS,
                         G_TYPE_BOOLEAN,     /* SPP_HISTORICAL_SELECT_COLUMN     */
@@ -504,6 +511,7 @@
 
     /* create columns */
     cell = gtk_cell_renderer_toggle_new ( );
+    g_object_set_data ( G_OBJECT ( account_page ), "toggle_cell", cell );
     gtk_cell_renderer_toggle_set_radio ( GTK_CELL_RENDERER_TOGGLE ( cell ),
                         FALSE );
     g_object_set (cell, "xalign", 0.5, NULL);
@@ -529,11 +537,10 @@
                         "text", SPP_HISTORICAL_DESC_COLUMN,
                         "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
                         NULL);
-    g_object_set_data ( G_OBJECT ( notebook ), "historical_column_source",
+    g_object_set_data ( G_OBJECT ( account_page ), "historical_column_source",
                         column );
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
-    //~ gtk_tree_view_column_set_min_width ( column, 300 );
     gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
     gtk_tree_view_column_set_resizable ( column, TRUE );
 
@@ -549,7 +556,6 @@
     gtk_tree_view_column_set_alignment ( column, 0.5 );
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
-    //~ gtk_tree_view_column_set_min_width ( column, 120 );
     gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
     gtk_tree_view_column_set_resizable ( column, TRUE );
 
@@ -563,7 +569,6 @@
                         NULL);
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
-    //~ gtk_tree_view_column_set_min_width ( column, 100 );
     g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
     gtk_tree_view_column_set_alignment ( column, 1 );
     gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
@@ -580,7 +585,6 @@
                         NULL);
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
-    //~ gtk_tree_view_column_set_min_width ( column, 100 );
     g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
     gtk_tree_view_column_set_alignment ( column, 1 );
     gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
@@ -589,6 +593,7 @@
 
     /* amount retained column */
     cell = gtk_cell_renderer_text_new ( );
+    g_object_set_data ( G_OBJECT ( account_page ), "edited_cell", cell );
     column = gtk_tree_view_column_new_with_attributes (
                         _("Amount retained"), cell,
                         "text", SPP_HISTORICAL_RETAINED_COLUMN,
@@ -598,7 +603,6 @@
                         NULL);
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
-    //~ gtk_tree_view_column_set_min_width ( column, 100 );
     g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
     gtk_tree_view_column_set_alignment ( column, 1 );
     gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
@@ -638,7 +642,6 @@
  * */
 void bet_historical_populate_data ( gint account_number )
 {
-    GtkWidget *notebook;
     GtkWidget *tree_view;
     GtkTreeModel *model;
     gint fyear_number;
@@ -647,9 +650,8 @@
     GSList* tmp_list;
     GHashTable  *list_div;
 
-    //~ devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    tree_view = g_object_get_data (G_OBJECT ( notebook ), "bet_historical_treeview" );
+    devel_debug_int ( account_number );
+    tree_view = g_object_get_data (G_OBJECT ( account_page ), "bet_historical_treeview" );
     if ( GTK_IS_TREE_VIEW ( tree_view ) == FALSE )
         return;
 
@@ -667,14 +669,14 @@
         g_date_subtract_years ( date_min, 1 );
         date_max = gdate_today ( );
         g_date_subtract_days ( date_max, 1 );
-        g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_period",
+        g_object_set_data ( G_OBJECT ( account_page ), "bet_historical_period",
                 g_strdup ( _("12 months rolling") ) );
     }
     else
     {
         date_min = gsb_data_fyear_get_beginning_date ( fyear_number );
         date_max = gsb_data_fyear_get_end_date ( fyear_number );
-        g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_period",
+        g_object_set_data ( G_OBJECT ( account_page ), "bet_historical_period",
                 g_strdup ( gsb_data_fyear_get_name ( fyear_number ) ) );
     }
     list_div = g_hash_table_new_full ( g_str_hash,
@@ -684,7 +686,6 @@
 
     /* search transactions of the account  */
     tmp_list = gsb_data_transaction_get_complete_transactions_list ( );
-
     while ( tmp_list )
     {
         gint transaction_number;
@@ -715,6 +716,7 @@
 
         bet_data_populate_div ( transaction_number, TRUE, list_div );
     }
+
     bet_historical_affiche_div ( list_div, tree_view );
     //~ bet_data_synchronise_hist_div_list ( list_div );
 
@@ -753,7 +755,6 @@
                         gpointer value,
                         gpointer user_data )
 {
-    GtkWidget *notebook;
     SH *sh = ( SH* ) value;
     SBR *sbr = sh -> sbr;
     GtkTreeView *tree_view = ( GtkTreeView * ) user_data;
@@ -775,13 +776,16 @@
     gsb_real average;
     gsb_real retained;
     gsb_real amount;
+    kind_account kind;
 
     div_number = sh -> div;
     div_name = bet_data_get_div_name ( div_number, 0, NULL );
     account_nb = sh -> account_nb;
+    kind = gsb_data_account_get_kind ( account_nb );
+    if ( kind == GSB_TYPE_CASH )
+        edited = FALSE;
 
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    titre = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_period" );
+    titre = g_object_get_data ( G_OBJECT ( account_page ), "bet_historical_period" );
 
     model = gtk_tree_view_get_model ( tree_view );
 
@@ -804,7 +808,7 @@
                         SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
                         SPP_HISTORICAL_DIV_NUMBER, div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, 0,
-                        SPP_HISTORICAL_EDITED_COLUMN, TRUE,
+                        SPP_HISTORICAL_EDITED_COLUMN, edited,
                         -1);
 
     if ( bet_data_search_div_hist ( account_nb, div_number, 0 ) 
@@ -877,7 +881,7 @@
                         SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
                         SPP_HISTORICAL_DIV_NUMBER, div_number,
                         SPP_HISTORICAL_SUB_DIV_NUMBER, sub_sh -> div,
-                        SPP_HISTORICAL_EDITED_COLUMN, TRUE,
+                        SPP_HISTORICAL_EDITED_COLUMN, edited,
                         -1);
 
         if ( bet_data_search_div_hist ( account_nb, div_number, sub_sh -> div ) )
@@ -1040,20 +1044,26 @@
                         GDate *date_min,
                         GDate *date_max )
 {
-    GtkWidget *notebook;
     GtkWidget *tree_view;
     GtkTreeModel *model;
     GtkTreeIter iter;
     GtkTreeIter fils_iter;
 
-    //~ devel_debug (NULL);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    tree_view = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_treeview" );
+    devel_debug (NULL);
+    tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_historical_treeview" );
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
 
     if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
     {
         gboolean valeur;
+        gint account_number;
+
+        /* test du numero de compte */
+        gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
+                        SPP_HISTORICAL_ACCOUNT_NUMBER, &account_number,
+                        -1 );
+        if ( account_number != gsb_gui_navigation_get_current_account ( ) )
+            return;
 
         do
         {
@@ -1173,9 +1183,7 @@
 
     if ( edited )
     {
-        tree_view = g_object_get_data ( G_OBJECT (
-                        g_object_get_data ( G_OBJECT ( notebook_general ),
-                        "account_notebook") ),
+        tree_view = g_object_get_data ( G_OBJECT ( account_page ),
                         "bet_historical_treeview" );
         gtk_tree_view_collapse_row ( tree_view,
                         gtk_tree_model_get_path ( model, parent ) );
@@ -1318,9 +1326,7 @@
                         GtkTreeModel *model )
 {
     if ( tree_view == NULL )
-        tree_view = g_object_get_data ( G_OBJECT (
-                g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook") ),
-                "bet_historical_treeview" );
+        tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_historical_treeview" );
     gtk_tree_view_collapse_row ( tree_view,
                 gtk_tree_model_get_path ( model, iter ) );
     gtk_tree_selection_select_iter ( gtk_tree_view_get_selection (
@@ -1472,7 +1478,7 @@
                         SPP_HISTORICAL_EDITED_COLUMN, FALSE,
                         -1);
 
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -1511,20 +1517,28 @@
  * */
 gboolean bet_historical_initializes_account_settings ( gint account_number )
 {
-    GtkWidget *notebook;
     GtkWidget *combo = NULL;
     gint fyear_number;
+    gpointer pointer;
 
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
-    combo = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo" );
+    combo = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_fyear_combo" );
 
     fyear_number = gsb_data_account_get_bet_hist_fyear ( account_number );
 
+    pointer = g_object_get_data ( G_OBJECT ( combo ), "pointer" );
+    g_signal_handlers_block_by_func ( G_OBJECT ( combo ),
+                        G_CALLBACK ( bet_config_fyear_clicked ),
+                        pointer );
+
     gsb_fyear_select_iter_by_number ( combo,
                         bet_fyear_model,
                         bet_fyear_model_filter,
                         fyear_number );
 
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( combo ),
+                        G_CALLBACK ( bet_config_fyear_clicked ),
+                        pointer );
+
     return FALSE;
 }
 
@@ -1588,6 +1602,77 @@
  *
  *
  * */
+void bet_historical_g_signal_block_tree_view ( void )
+{
+    GtkTreeView *tree_view;
+    gpointer cell;
+    GtkTreeModel *tree_model;
+
+    hist_block_signal = TRUE;
+    tree_view = g_object_get_data ( G_OBJECT ( account_page ), "hist_tree_view" );
+    tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+
+    cell = g_object_get_data ( G_OBJECT ( account_page ), "toggle_cell" );
+    g_signal_handlers_block_by_func ( cell, bet_historical_div_toggle_clicked, tree_model );
+
+    cell = g_object_get_data ( G_OBJECT ( account_page ), "edited_cell" );
+    g_signal_handlers_block_by_func ( tree_view, bet_historical_button_press, NULL );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_historical_g_signal_unblock_tree_view ( void )
+{
+    GtkTreeView *tree_view;
+    gpointer cell;
+    GtkTreeModel *tree_model;
+
+    if ( hist_block_signal == FALSE )
+        return;
+
+    hist_block_signal = FALSE;
+    tree_view = g_object_get_data ( G_OBJECT ( account_page ), "hist_tree_view" );
+    tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+    cell = g_object_get_data ( G_OBJECT ( account_page ), "toggle_cell" );
+
+    g_signal_handlers_unblock_by_func ( cell, bet_historical_div_toggle_clicked, tree_model );
+
+    cell = g_object_get_data ( G_OBJECT ( account_page ), "edited_cell" );
+    g_signal_handlers_unblock_by_func ( tree_view, bet_historical_button_press, NULL );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_historical_set_page_title ( gint account_number )
+{
+    GtkWidget * widget;
+    gchar *title;
+
+    title = g_strdup_printf (
+                    _("Please select the data source for the account: \"%s\""),
+                    gsb_data_account_get_name ( account_number ) );
+    widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_title") );
+    gtk_label_set_label ( GTK_LABEL ( widget ), title );
+    g_free ( title );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
 
 /* Local Variables: */
 /* c-basic-offset: 4 */

Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- gsb_data_account.h	8 May 2010 05:54:13 -0000	1.45
+++ gsb_data_account.h	18 May 2010 20:12:54 -0000	1.46
@@ -46,6 +46,7 @@
 gboolean gsb_data_account_get_bet_auto_inc_month ( gint account_number );
 gint gsb_data_account_get_bet_hist_data ( gint account_number );
 gint gsb_data_account_get_bet_hist_fyear ( gint account_number );
+gint gsb_data_account_get_bet_maj ( gint account_number );
 gint gsb_data_account_get_bet_months ( gint account_number );
 gint gsb_data_account_get_bet_select_label ( gint account_number, gint origine );
 gint gsb_data_account_get_bet_spin_range ( gint account_number );
@@ -107,6 +108,7 @@
                         gboolean auto_inc_month );
 gboolean gsb_data_account_set_bet_hist_data ( gint account_number, gint hist_data );
 gboolean gsb_data_account_set_bet_hist_fyear ( gint account_number, gint hist_fyear );
+gboolean gsb_data_account_set_bet_maj ( gint account_number, gint type_maj );
 gboolean gsb_data_account_set_bet_months ( gint account_number, gint months );
 gboolean gsb_data_account_set_bet_select_label ( gint account_number,
                         gint origine,

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.247
retrieving revision 1.248
diff -u -d -r1.247 -r1.248
--- structures.h	4 May 2010 12:27:53 -0000	1.247
+++ structures.h	18 May 2010 20:12:54 -0000	1.248
@@ -36,7 +36,8 @@
  * la partie configurée par la conf
  * la partie configurée pendant le fonctionnement de grisbi
  * */
-struct {
+struct
+{
     time_t modification_fichier;
     gint is_archive;                /** TRUE if the file is an archive, FALSE else */
     gint equilibrage;
@@ -122,7 +123,8 @@
  * configured by the file grisbi.conf
  *
  */
-struct {
+struct
+{
 
     /* geometry */
     gint root_x;                                    /* main_window x position */
@@ -180,18 +182,32 @@
     gchar   *search_str;
 };
 
-enum alignement {
+enum alignement
+{
     LEFT, CENTER, RIGHT,
 };
 
 
-enum bet_array_origin_data {
+enum bet_array_origin_data
+{
     SPP_ORIGIN_TRANSACTION,
     SPP_ORIGIN_SCHEDULED,
     SPP_ORIGIN_HISTORICAL,
     SPP_ORIGIN_FUTURE,
-    SPP_ORIGIN_ACCOUNT
+    SPP_ORIGIN_ACCOUNT,
+    SPP_ORIGIN_ARRAY,
+    SPP_ORIGIN_CONFIG
 };
 
+enum bet_type_maj 
+{
+    BET_MAJ_FALSE = 0,
+    BET_MAJ_ESTIMATE,
+    BET_MAJ_HISTORICAL,
+    BET_MAJ_FINANCIAL,
+    BET_MAJ_ALL,
+};
+
+
 
 #endif

Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- balance_estimate_data.h	8 May 2010 05:54:13 -0000	1.17
+++ balance_estimate_data.h	18 May 2010 20:12:54 -0000	1.18
@@ -5,6 +5,7 @@
 
 /* START_INCLUDE_H */
 #include "././gsb_real.h"
+#include "./fenetre_principale.h"
 /* END_INCLUDE_H */
 
 
@@ -82,15 +83,6 @@
 };
 
 
-enum type_maj 
-{
-    BET_MAJ_FALSE = 0,
-    BET_MAJ_ESTIMATE,
-    BET_MAJ_HISTORICAL,
-    BET_MAJ_ALL,
-};
-
-
 /* START_DECLARATION */
 GDate *bet_data_array_get_date_max ( gint account_number );
 gboolean bet_data_future_add_lines ( struct_futur_data *scheduled );
@@ -107,7 +99,6 @@
                         gint sub_div,
                         const gchar *return_value_error );
 gint bet_data_get_div_number ( gint transaction_number, gboolean is_transaction );
-gint bet_data_get_maj ( void );
 gint bet_data_get_selected_currency ( void );
 GPtrArray *bet_data_get_strings_to_save ( void );
 gint bet_data_get_sub_div_nb ( gint transaction_number, gboolean is_transaction );
@@ -120,6 +111,7 @@
 gboolean bet_data_populate_div ( gint transaction_number,
                         gboolean is_transaction,
                         GHashTable  *list_div );
+gboolean bet_data_remove_all_bet_data ( gint account_number );
 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 );
 void bet_data_select_bet_pages ( gint account_number );
@@ -140,6 +132,7 @@
 gboolean bet_data_transfert_remove_line ( gint account_number, gint number );
 gboolean bet_data_transfert_set_line_from_file ( struct_transfert_data *transfert );
 void bet_data_transfert_update_date_if_necessary ( struct_transfert_data *transfert );
+void bet_data_update_bet_module ( gint account_number, guint page );
 void struct_free_bet_historical ( SH *sh );
 struct_futur_data *struct_initialise_bet_future ( void );
 SBR *struct_initialise_bet_range ( void );

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- import.c	4 May 2010 12:27:53 -0000	1.333
+++ import.c	18 May 2010 20:12:54 -0000	1.334
@@ -1521,6 +1521,9 @@
         break;
     }
 
+        /* MAJ des données du module bet */
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
+
     /* first, we create the rule if asked */
     if (compte -> create_rule && compte -> action != IMPORT_CREATE_ACCOUNT)
     {
@@ -1604,11 +1607,6 @@
                  "with any reconcile number yet.  You may associate them with a reconcilation "
                  "later via the preferences windows.") );
 
-#ifdef ENABLE_BALANCE_ESTIMATE
-    /* force the update module budget */
-    bet_data_set_maj ( gsb_gui_navigation_get_current_account (), BET_MAJ_ESTIMATE );
-#endif /* ENABLE_BALANCE_ESTIMATE */
-
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 }
@@ -4374,7 +4372,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
     if ( etat.modification_fichier == 0 )

Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- balance_estimate_data.c	8 May 2010 05:54:13 -0000	1.26
+++ balance_estimate_data.c	18 May 2010 20:12:54 -0000	1.27
@@ -30,6 +30,7 @@
 
 /*START_INCLUDE*/
 #include "balance_estimate_data.h"
+#include "./balance_estimate_hist.h"
 #include "./balance_estimate_tab.h"
 #include "./dialog.h"
 #include "./gsb_data_account.h"
@@ -65,6 +66,7 @@
 
 
 /*START_EXTERN*/
+extern GtkWidget *account_page;
 extern GtkWidget *notebook_general;
 extern gsb_real null_real;
 /*END_EXTERN*/
@@ -87,8 +89,121 @@
 static GHashTable *bet_transfert_list;
 static gint transfert_number;
 
-/* force la mise à jour des données */
-static gint bet_maj = FALSE;
+
+/**
+ * Sélectionne les onglets du module gestion budgétaire en fonction du type de compte
+ *
+ */
+void bet_data_select_bet_pages ( gint account_number )
+{
+    GtkWidget *page;
+    kind_account kind;
+    gint current_page;
+    gint bet_use_budget;
+
+    devel_debug_int ( account_number );
+
+    kind = gsb_data_account_get_kind ( account_number );
+    current_page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_page ) );
+    bet_use_budget = gsb_data_account_get_bet_use_budget ( account_number );
+    if ( bet_use_budget <= 0 )
+        kind = GSB_TYPE_ASSET;
+
+    switch ( kind )
+    {
+    case GSB_TYPE_BANK:
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
+        gtk_widget_show ( page );
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
+        gtk_widget_show ( page );
+        bet_historical_g_signal_unblock_tree_view ( );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
+        if ( current_page < GSB_PROPERTIES_PAGE 
+         && 
+         gsb_data_account_get_bet_use_budget ( account_number ) == FALSE )
+            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_TRANSACTIONS_PAGE );
+        break;
+    case GSB_TYPE_CASH:
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
+        gtk_widget_hide ( page );
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
+        gtk_widget_show ( page );
+        if ( current_page == GSB_ESTIMATE_PAGE )
+            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
+        bet_historical_g_signal_block_tree_view ( );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_HISTORICAL );
+        break;
+    case GSB_TYPE_LIABILITIES:
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
+        gtk_widget_show ( page );
+        if ( current_page == GSB_HISTORICAL_PAGE )
+            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
+        gtk_widget_hide ( page );
+        gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+        break;
+    case GSB_TYPE_ASSET:
+        if ( current_page < GSB_PROPERTIES_PAGE )
+            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_TRANSACTIONS_PAGE );
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
+        gtk_widget_hide ( page );
+        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
+        gtk_widget_hide ( page );
+        break;
+    }
+}
+
+
+/*
+ * Met à jour les données à afficher dans les différentes vues du module
+ *
+ * 
+ */
+void bet_data_update_bet_module ( gint account_number, guint page )
+{
+    gint type_maj;
+    kind_account kind;
+
+    devel_debug_int ( account_number );
+
+    /* test account number */
+    if ( account_number == -1 )
+        return;
+
+    type_maj = gsb_data_account_get_bet_maj ( account_number );
+    if ( type_maj == BET_MAJ_FALSE )
+        return;
+
+    kind = gsb_data_account_get_kind ( account_number );
+
+    printf ("account_number = %d kind = %d page = %d type_maj = %d\n",
+                        account_number, kind, page, type_maj );
+
+    if ( page == -1 && gsb_gui_navigation_get_current_page ( ) == GSB_ACCOUNT_PAGE )
+        page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_page ) );
+
+    switch ( page )
+    {
+        case GSB_ESTIMATE_PAGE:
+            bet_array_update_estimate_tab ( account_number, type_maj );
+            gsb_data_account_set_bet_maj ( account_number, BET_MAJ_FALSE );
+            break;
+        case GSB_HISTORICAL_PAGE:
+            if ( type_maj == BET_MAJ_ALL )
+            {
+                bet_historical_populate_data ( account_number );
+                gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+            }
+            else if ( type_maj ==  BET_MAJ_HISTORICAL )
+            {
+                bet_historical_populate_data ( account_number );
+                gsb_data_account_set_bet_maj ( account_number, BET_MAJ_FALSE );
+            }
+            break;
+        default:
+            break;
+    }
+}
 
 
 /**
@@ -126,88 +241,6 @@
  *
  *
  * */
-gint bet_data_get_maj ( void )
-{
-    return bet_maj;
-}
-
-
-/**
- *
- *
- *
- *
- * */
-void bet_data_set_maj ( gint account_number, gint type_maj )
-{
-    GtkWidget *notebook;
-    GtkWidget *child;
-    const gchar *label;
-
-	//~ devel_debug_int (account_number);
-    if ( type_maj != bet_maj )
-    {
-        switch ( type_maj )
-        {
-            case BET_MAJ_FALSE:
-                bet_maj = type_maj;
-                return;
-            break;
-            case BET_MAJ_ESTIMATE:
-                if ( bet_maj == BET_MAJ_FALSE )
-                    bet_maj = type_maj;
-                else if ( bet_maj == BET_MAJ_HISTORICAL )
-                    bet_maj = BET_MAJ_ALL;
-            break;
-            case BET_MAJ_HISTORICAL:
-                if ( bet_maj == BET_MAJ_FALSE )
-                    bet_maj = type_maj;
-                else if ( bet_maj == BET_MAJ_ESTIMATE )
-                    bet_maj = BET_MAJ_ALL;
-            break;
-            case BET_MAJ_ALL:
-                bet_maj = type_maj;
-            break;
-        }
-
-        if ( account_number == -1
-         || account_number != gsb_gui_navigation_get_current_account ( ) )
-            return;
-    }
-
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    child = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ),
-                        gtk_notebook_get_current_page ( GTK_NOTEBOOK ( notebook ) ) );
-    label = gtk_widget_get_name ( child );
-
-    if ( g_strcmp0 ( label, "forecast_page" ) == 0 )
-        bet_array_update_estimate_tab ( account_number );
-    else if ( g_strcmp0 ( label, "historical_page" ) == 0 )
-    {
-        GtkWidget * widget;
-        gchar *title;
-        kind_account kind;
-
-        kind = gsb_data_account_get_kind ( account_number );
-        title = g_strdup_printf (
-                        _("Please select the data source for the account: \"%s\""),
-                        gsb_data_account_get_name ( account_number ) );
-        widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_title") );
-        gtk_label_set_label ( GTK_LABEL ( widget ), title );
-        g_free ( title );
-
-        if ( kind != GSB_TYPE_CASH )
-            bet_array_update_estimate_tab ( account_number );
-    }
-}
-
-
-/**
- *
- *
- *
- *
- * */
 gboolean bet_data_hist_add_div ( gint account_nb,
                         gint div_number,
                         gint sub_div_nb )
@@ -1022,64 +1055,6 @@
 }
 
 /**
- * Sélectionne les onglets du module gestion budgétaire en fonction du type de compte
- *
- */
-void bet_data_select_bet_pages ( gint account_number )
-{
-    GtkWidget *notebook;
-    GtkWidget *page;
-    kind_account kind;
-    gint current_page;
-    gint bet_use_budget;
-
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    kind = gsb_data_account_get_kind ( account_number );
-    current_page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( notebook ) );
-    bet_use_budget = gsb_data_account_get_bet_use_budget ( account_number );
-    if ( bet_use_budget <= 0 )
-        kind = GSB_TYPE_ASSET;
-
-    switch ( kind )
-    {
-    case GSB_TYPE_BANK:
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
-        gtk_widget_show ( page );
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
-        gtk_widget_show ( page );
-        bet_data_set_maj ( account_number, BET_MAJ_ALL );
-        break;
-    case GSB_TYPE_CASH:
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
-        gtk_widget_hide ( page );
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
-        gtk_widget_show ( page );
-        if ( current_page == 1 )
-            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 2 );
-        bet_data_set_maj ( account_number, BET_MAJ_HISTORICAL );
-        break;
-    case GSB_TYPE_LIABILITIES:
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
-        gtk_widget_show ( page );
-        if ( current_page == 2 )
-            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 1 );
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
-        gtk_widget_hide ( page );
-        bet_data_set_maj ( account_number, BET_MAJ_ALL );
-        break;
-    case GSB_TYPE_ASSET:
-        if ( current_page < 2 )
-            gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 0 );
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
-        gtk_widget_hide ( page );
-        page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
-        gtk_widget_hide ( page );
-        break;
-    }
-}
-
-
-/**
  *
  *
  *
@@ -1374,7 +1349,7 @@
     return new_sch;
 }
 /**
- *
+ * supprime l'occurence sélectionnée.
  *
  *
  *
@@ -1402,14 +1377,15 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+    bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
 
     return FALSE;
 }
 
 
 /**
- *
+ * supprime touts les occurences de la ligne sélectionnée
  *
  *
  *
@@ -1627,7 +1603,8 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
+    bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
 
     return FALSE;
 }
@@ -1723,6 +1700,91 @@
 }
 
 
+/**
+ * supprime toutes les données du module pour le compte passé en paramètre.
+ *
+ *
+ *
+ * */
+gboolean bet_data_remove_all_bet_data ( gint account_number )
+{
+    GHashTable *tmp_list;
+    GHashTableIter iter;
+    gpointer key, value;
+
+    tmp_list = bet_hist_div_list;
+
+    g_hash_table_iter_init ( &iter, tmp_list );
+    while ( g_hash_table_iter_next ( &iter, &key, &value ) )
+    {
+        struct_hist_div *shd = ( struct_hist_div *) value;
+
+        if ( account_number != shd -> account_nb )
+            continue;
+
+        if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
+        {
+            g_hash_table_iter_remove ( &iter );
+            g_hash_table_iter_init ( &iter, tmp_list );
+        }
+        else
+        {
+            GHashTableIter new_iter;
+
+            g_hash_table_iter_init ( &new_iter, shd -> sub_div_list );
+            while ( g_hash_table_iter_next ( &new_iter, &key, &value ) )
+            {
+                g_hash_table_iter_remove ( &new_iter );
+                g_hash_table_iter_init ( &new_iter, shd -> sub_div_list );
+
+                if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
+                    break;
+            }
+        }
+
+        if ( g_hash_table_size ( tmp_list ) == 0 )
+            break;
+    }
+
+    tmp_list = bet_future_list;
+
+    g_hash_table_iter_init ( &iter, tmp_list );
+    while ( g_hash_table_iter_next ( &iter, &key, &value ) )
+    {
+        struct_futur_data *scheduled = ( struct_futur_data *) value;
+
+        if ( account_number != scheduled -> account_number )
+            continue;
+
+        bet_data_future_remove_lines ( account_number, scheduled -> number,
+                        scheduled -> mother_row );
+        g_hash_table_iter_init ( &iter, tmp_list );
+
+        if ( g_hash_table_size ( tmp_list ) == 0 )
+            break;
+    }
+
+     tmp_list = bet_transfert_list;
+
+    g_hash_table_iter_init ( &iter, tmp_list );
+    while ( g_hash_table_iter_next ( &iter, &key, &value ) )
+    {
+        struct_transfert_data *transfert = ( struct_transfert_data *) value;
+
+        if ( account_number != transfert -> account_number )
+            continue;
+
+        g_hash_table_iter_remove ( &iter );
+        g_hash_table_iter_init ( &iter, tmp_list );
+
+        if ( g_hash_table_size ( tmp_list ) == 0 )
+            return TRUE;
+    }
+   
+    return TRUE;
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: gsb_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- gsb_account.c	4 May 2010 12:27:52 -0000	1.50
+++ gsb_account.c	18 May 2010 20:12:54 -0000	1.51
@@ -136,10 +136,8 @@
         gsb_gui_navigation_add_account ( account_number, TRUE );
 
         /* Go to accounts properties */
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook_general ),
-                    GSB_ACCOUNT_PAGE );
-        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ),
-                        gsb_gui_on_account_get_property_page ( GTK_NOTEBOOK ( account_page ) ) );
+        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook_general ), GSB_ACCOUNT_PAGE );
+        gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_PROPERTIES_PAGE );
 
         gsb_account_property_fill_page ();
     }

Index: fenetre_principale.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- fenetre_principale.h	18 Apr 2010 14:38:28 -0000	1.33
+++ fenetre_principale.h	18 May 2010 20:12:54 -0000	1.34
@@ -13,6 +13,16 @@
     GSB_AQBANKING_PAGE,
 } GsbGeneralNotebookPages;
 
+typedef enum GSB_ACCOUNT_NOTEBOOK_PAGES {
+    GSB_TRANSACTIONS_PAGE,
+#ifdef ENABLE_BALANCE_ESTIMATE
+    GSB_ESTIMATE_PAGE,
+    GSB_HISTORICAL_PAGE,
+    //~ GSB_FINANCIAL_PAGE,
+#endif /* ENABLE_BALANCE_ESTIMATE */
+    GSB_PROPERTIES_PAGE,
+} GsbaccountNotebookPages;
+
 /* START_INCLUDE_H */
 /* END_INCLUDE_H */
 
@@ -22,7 +32,7 @@
 void gsb_gui_headings_update_suffix ( gchar * suffix );
 void gsb_gui_headings_update_title ( gchar * title );
 void gsb_gui_notebook_change_page ( GsbGeneralNotebookPages page );
-gint gsb_gui_on_account_get_property_page ( GtkNotebook *account_page );
+void gsb_gui_on_account_change_page ( GsbaccountNotebookPages page );
 gboolean gsb_gui_on_account_switch_page ( GtkNotebook *notebook,
                         GtkNotebookPage *page,
                         guint page_number,

Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -d -r1.215 -r1.216
--- parametres.c	4 May 2010 12:27:53 -0000	1.215
+++ parametres.c	18 May 2010 20:12:54 -0000	1.216
@@ -544,7 +544,7 @@
                         1, BET_GENERAL_PAGE,
                         2, 400,
                         -1);
-    gtk_notebook_append_page (preference_frame, bet_config_create_general_page (), NULL);
+    gtk_notebook_append_page (preference_frame, bet_config_general_create_general_page (), NULL);
 
     gtk_tree_store_append (GTK_TREE_STORE (preference_tree_model), &iter2, &iter);
     gtk_tree_store_set (GTK_TREE_STORE (preference_tree_model),
@@ -553,7 +553,7 @@
                         1, BET_ACCOUNT_PAGE,
                         2, 400,
                         -1);
-    gtk_notebook_append_page (preference_frame, bet_config_create_account_page (), NULL);
+    gtk_notebook_append_page (preference_frame, bet_config_account_create_account_page (), NULL);
 
 #endif
 

Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- fenetre_principale.c	4 May 2010 12:27:52 -0000	1.136
+++ fenetre_principale.c	18 May 2010 20:12:54 -0000	1.137
@@ -32,6 +32,7 @@
 #include "./gsb_transactions_list.h"
 #include "./accueil.h"
 #include "./etats_onglet.h"
+#include "./gsb_data_account.h"
 #include "./gsb_account_property.h"
 #include "./gsb_form.h"
 #include "./gsb_scheduler_list.h"
@@ -235,8 +236,6 @@
                         creation_fenetre_operations (),
                         gtk_label_new (SPACIFY(_("Transactions"))) );
 
-    g_object_set_data ( G_OBJECT (notebook), "account_notebook", account_page );
-
 #ifdef ENABLE_BALANCE_ESTIMATE
      /* append the balance estimate pages */
     gtk_notebook_append_page ( GTK_NOTEBOOK ( account_page ),
@@ -303,20 +302,28 @@
                         guint page_number,
                         gpointer null )
 {
+    gint account_number;
+    
     //~ devel_debug_int (page_number);
     switch ( page_number )
     {
-    case 0:
+    case GSB_TRANSACTIONS_PAGE:
         gsb_form_set_expander_visible ( TRUE, TRUE );
         break;
-
-    case 1:
-    case 2:
 #ifdef ENABLE_BALANCE_ESTIMATE
-        if ( bet_data_get_maj ( ) )
-            bet_array_update_estimate_tab ( gsb_gui_navigation_get_current_account ( ) );
+    case GSB_ESTIMATE_PAGE:
+        account_number = gsb_gui_navigation_get_current_account ( );
+        if ( gsb_data_account_get_bet_maj ( account_number ) )
+            bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
+        break;
+    case GSB_HISTORICAL_PAGE:
+        account_number = gsb_gui_navigation_get_current_account ( );
+        if ( gsb_data_account_get_bet_maj ( account_number ) )
+            bet_data_update_bet_module ( account_number, GSB_HISTORICAL_PAGE );
+        bet_historical_set_page_title ( account_number );
+        break;
 #endif /* ENABLE_BALANCE_ESTIMATE */
-    case 3:
+    case GSB_PROPERTIES_PAGE:
         gsb_form_set_expander_visible (FALSE, FALSE );
         break;
     }
@@ -325,6 +332,16 @@
 }
 
 
+/**
+ * Set the account notebook page.
+ * 
+ * \param page		Page to set.
+ */
+void gsb_gui_on_account_change_page ( GsbaccountNotebookPages page )
+{
+    gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), page );
+}
+
 
 /**
  * Update one of the heading bar label with a new text.
@@ -417,7 +434,6 @@
 }
 
 
-
 /**
  * Trigger a callback functions only if button event that triggered it
  * was a simple click.
@@ -450,24 +466,6 @@
 }
 
 
-gint gsb_gui_on_account_get_property_page ( GtkNotebook *account_page )
-{
-    GtkWidget *child;
-    gint i = 0;
-
-    while ( ( child = gtk_notebook_get_nth_page ( account_page, i ) ) )
-    {
-        const gchar *label;
-
-        label = gtk_widget_get_name ( child );
-        if ( g_strcmp0 ( label, "properties_page" ) == 0 )
-            return i;
-        else
-            i++;
-    }
-
-    return 0;
-}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- gsb_transactions_list.c	4 May 2010 12:27:53 -0000	1.211
+++ gsb_transactions_list.c	18 May 2010 20:12:54 -0000	1.212
@@ -2431,10 +2431,8 @@
 
     gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook_general ), 1 );
 
-#ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ESTIMATE );
-#endif /* ENABLE_BALANCE_ESTIMATE */
+    gsb_data_account_set_bet_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ALL );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -2471,10 +2469,8 @@
 			    "transaction_selected_in_form",
 			    GINT_TO_POINTER ( -1 ) );
 
-#ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ESTIMATE );
-#endif /* ENABLE_BALANCE_ESTIMATE */
+    gsb_data_account_set_bet_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ALL );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- gsb_form.c	4 May 2010 20:38:18 -0000	1.164
+++ gsb_form.c	18 May 2010 20:12:54 -0000	1.165
@@ -2639,10 +2639,8 @@
     /* as we modify or create a transaction, we invalidate the current report */
     gsb_report_set_current ( 0 );
 
-#ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
-#endif /* ENABLE_BALANCE_ESTIMATE */
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );



More information about the cvs mailing list