[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.13, 1.14 balance_estimate_data.c, 1.20, 1.21 balance_estimate_data.h, 1.14, 1.15 balance_estimate_future.c, 1.8, 1.9 balance_estimate_hist.c, 1.22, 1.23 balance_estimate_tab.c, 1.63, 1.64 balance_estimate_tab.h, 1.14, 1.15 fenetre_principale.c, 1.132, 1.133 gsb_data_transaction.c, 1.86, 1.87 gsb_form.c, 1.159, 1.160 gsb_transactions_list.c, 1.208, 1.209 import.c, 1.331, 1.332

Pierre Biava pbiava at users.sourceforge.net
Sun Apr 18 09:53:08 CEST 2010


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

Modified Files:
	balance_estimate_config.c balance_estimate_data.c 
	balance_estimate_data.h balance_estimate_future.c 
	balance_estimate_hist.c balance_estimate_tab.c 
	balance_estimate_tab.h fenetre_principale.c 
	gsb_data_transaction.c gsb_form.c gsb_transactions_list.c 
	import.c 
Log Message:
Changing the management of updates of data in the budget module

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- gsb_data_transaction.c	5 Apr 2010 21:24:53 -0000	1.86
+++ gsb_data_transaction.c	18 Apr 2010 07:53:06 -0000	1.87
@@ -2312,7 +2312,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( TRUE );
+    bet_data_set_maj ( transaction -> account_number, BET_MAJ_ESTIMATE );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
     return TRUE;

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- balance_estimate_config.c	17 Apr 2010 15:37:03 -0000	1.13
+++ balance_estimate_config.c	18 Apr 2010 07:53:06 -0000	1.14
@@ -101,7 +101,6 @@
                         _("Common data") );
 
     widget = bet_config_get_period_widget ( paddingbox );
-    g_object_set_data ( G_OBJECT ( notebook ), "period_widget", widget );
 
     /* add a separator */
     gtk_box_pack_start ( GTK_BOX ( vbox_pref ), gtk_hseparator_new (), FALSE, FALSE, 5 );
@@ -164,18 +163,15 @@
 
     /* Calculation of duration */
     widget = bet_config_get_duration_widget ( paddingbox );
-    g_object_set_data ( G_OBJECT ( notebook ), "duration_widget", widget );
 
     /* Select the labels of the list */
     widget = bet_config_get_select_labels_widget ( paddingbox );
-    g_object_set_data ( G_OBJECT ( notebook ), "select_labels_widget", widget );    
 
     /* Sources of historical data */
     paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
                         _("Sources of historical data") );
 
     widget = bet_config_get_select_historical_data ( paddingbox );
-    g_object_set_data ( G_OBJECT ( notebook ), "historical_data", widget );
 
     gtk_widget_show_all ( vbox_pref );
 
@@ -216,13 +212,12 @@
 
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("1st day of month") );
-    gtk_widget_set_name ( button_1, "button_1" );
+    gtk_widget_set_name ( button_1, "bet_period_button_1" );
     gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), button_1 );
     
     button_2 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_1 ),
                         _("date today") );
-    gtk_widget_set_name ( button_2, "button_2" );
 
     if ( etat.bet_deb_period == 1 )
         gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
@@ -264,6 +259,7 @@
  * */
 GtkWidget *bet_config_get_duration_widget ( GtkWidget *container )
 {
+    GtkWidget *notebook;
     GtkWidget* vbox;
     GtkWidget *label;
     GtkWidget *spin_button = NULL;
@@ -275,6 +271,7 @@
 
     size_group = gtk_size_group_new ( GTK_SIZE_GROUP_HORIZONTAL );
 
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     vbox = gtk_vbox_new ( FALSE, 0 );
     gtk_box_pack_start ( GTK_BOX ( container ), vbox, FALSE, FALSE, 0);
 
@@ -289,7 +286,6 @@
 
     spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
     gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 1.0 );
-    gtk_widget_set_name ( spin_button, "spin_button" );
     gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
 
     for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
@@ -312,9 +308,13 @@
                         "released",
                         G_CALLBACK ( bet_config_duration_button_clicked ),
                         spin_button );
-        g_object_set_data ( G_OBJECT ( spin_button ), "bet_origin_signal", GINT_TO_POINTER ( 0 ) );
     }
 
+    g_object_set_data ( G_OBJECT ( spin_button ), "bet_origin_signal", GINT_TO_POINTER ( 0 ) );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_account_previous", previous );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_account_widget", widget );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_account_spin_button", spin_button );
+
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
 
     g_signal_connect ( G_OBJECT ( spin_button ),
@@ -418,6 +418,7 @@
  * */
 GtkWidget *bet_config_get_select_historical_data ( GtkWidget *container )
 {
+    GtkWidget *notebook;
     GtkWidget *vbox;
     GtkWidget *widget;
     GtkWidget *hbox;
@@ -425,6 +426,7 @@
     gchar *str_year;
     gint year;
 
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     vbox = gtk_vbox_new ( FALSE, 0 );
     gtk_box_pack_start ( GTK_BOX ( container ), vbox, FALSE, FALSE, 0);
 
@@ -434,7 +436,7 @@
 
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("Categories") );
-    gtk_widget_set_name ( button_1, "button_1" );
+    gtk_widget_set_name ( button_1, "bet_hist_button_1" );
     g_signal_connect (G_OBJECT ( button_1 ),
                         "released",
                         G_CALLBACK ( bet_config_origin_data_clicked ),
@@ -443,12 +445,13 @@
     button_2 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_1 ),
                         _("Budgetary lines") );
-    gtk_widget_set_name ( button_2, "button_2" );
     g_signal_connect (G_OBJECT ( button_2 ),
                         "released",
                         G_CALLBACK ( bet_config_origin_data_clicked ),
                         GINT_TO_POINTER ( 0 ) );
 
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_hist_button_1", button_1 );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_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) ;
 
@@ -458,6 +461,7 @@
     gtk_widget_set_tooltip_text ( GTK_WIDGET ( widget ),
                       SPACIFY(_("Choose the financial year or 12 months rolling") ) );
     gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5);
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_config_hist_fyear_combo", widget );
 
     /* hide the present financial year */
     year = g_date_get_year ( gdate_today ( ) );
@@ -492,11 +496,11 @@
 
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
 
-    if ( g_strcmp0 ( name, "button_1" ) == 0 )
+    if ( g_strcmp0 ( name, "bet_period_button_1" ) == 0 )
     {
         etat.bet_deb_period = 1;
     }
-    else if ( g_strcmp0 ( name, "button_2" ) == 0 )
+    else
     {
         etat.bet_deb_period = 2;
     }
@@ -522,7 +526,7 @@
     gpointer data;
     gint account_number;
     gint months;
-
+devel_debug (NULL);
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
     data = g_object_get_data ( G_OBJECT ( spin_button ), "bet_origin_signal");
 
@@ -530,9 +534,10 @@
         account_number = bet_config_get_account ( );
     else
         account_number = gsb_gui_navigation_get_current_account ( );
-
+printf ("account_number = %d\n", account_number);
     if ( g_strcmp0 ( name, "Year" ) == 0 )
     {
+        printf ("param = 1\n");
         gsb_data_account_set_bet_spin_range ( account_number, 1 );
         gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
         months = gsb_data_account_get_bet_months ( account_number );
@@ -546,6 +551,7 @@
     }
     else
     {
+        printf ("param = 0\n");
         gsb_data_account_set_bet_spin_range ( account_number, 0 );
         gsb_data_account_set_bet_months ( account_number,
                         gtk_spin_button_get_value_as_int (
@@ -556,7 +562,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( account_number );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 }
 
 
@@ -571,12 +577,12 @@
 {
     gint account_number;
     gint months;
-
+devel_debug (NULL);
     if ( GPOINTER_TO_INT ( data ) == 0 )
         account_number = bet_config_get_account ( );
     else
         account_number = gsb_gui_navigation_get_current_account ( );
-
+printf ("account_number = %d\n", account_number);
     months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
     if ( gsb_data_account_get_bet_spin_range ( account_number ) == 1 )
         months *= 12;
@@ -586,7 +592,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( account_number );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 
     return ( FALSE );
 }
@@ -615,7 +621,7 @@
 
     notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
 
-    if ( g_strcmp0 ( name, "button_1" ) == 0 )
+    if ( g_strcmp0 ( name, "bet_hist_button_1" ) == 0 )
     {
         gsb_data_account_set_bet_hist_data ( account_number, 0 );
         bet_data_set_div_ptr ( 0 );
@@ -635,7 +641,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_update_estimate_tab ( );
+    bet_data_set_maj ( account_number, BET_MAJ_HISTORICAL );
 }
 
 
@@ -660,45 +666,11 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_update_estimate_tab ( );
+    bet_data_set_maj ( account_number, BET_MAJ_HISTORICAL );
 }
 
 
 /**
- *
- *
- *
- *
- * */
-/*gboolean bet_config_set_property_widget_mirror ( GtkWidget *widget,
-                        gchar *ancestor_name,
-                        gint widget_type,
-                        gboolean value )
-{
-    GtkWidget *notebook;
-    GtkWidget *ancestor;
-    GtkWidget *mirror;
-    //~ GtkTreeViewColumn *column;
-    const gchar *name;
-    //~ gchar *title;
-
-    name = gtk_widget_get_name ( GTK_WIDGET ( widget ) );
-    devel_debug (name);
-    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-    ancestor = g_object_get_data ( G_OBJECT ( notebook ), ancestor_name );
-    if ( gtk_widget_is_ancestor ( widget, ancestor ) == FALSE )
-    {
-        mirror = utils_get_child_widget_by_name ( ancestor, name );
-        if ( mirror )
-            printf ("mirror trouvé\n");
-            //~ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( mirror ), TRUE );
-    }
-
-    return FALSE;
-}*/
-
-
-/**
  * callback called when changing the account from the button
  * re-fill the page with the account data
  *
@@ -711,9 +683,9 @@
                         gpointer null )
 {
     GtkWidget *notebook;
-    GtkWidget *ancestor;
     GtkWidget *widget;
     GtkWidget *button;
+    gpointer ptr;
     gint account_number;
     gint param;
     gint months;
@@ -721,42 +693,55 @@
     notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
     account_number = gsb_account_get_combo_account_number ( combo );
 
-    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "duration_widget" );
-
     param = gsb_data_account_get_bet_spin_range ( account_number );
     months = gsb_data_account_get_bet_months ( account_number );
-    button = utils_get_child_widget_by_name ( ancestor, "spin_button" );
+    button = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_account_spin_button" );
+    ptr = g_object_get_data ( G_OBJECT ( button ), "pointer" );
+    g_signal_handlers_block_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK ( bet_config_duration_number_changed ),
+                        ptr );
 
-    if ( param == 1 )
+    if ( param == 0 )
     {
-        widget = utils_get_child_widget_by_name ( ancestor, "Year" );
+        widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_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, 20.0 );
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, 240.0 );
         gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
-                        (gdouble) months / 12.0 );
+                        (gdouble) months );
     }
     else
     {
-        widget = utils_get_child_widget_by_name ( ancestor, "Month" );
+        widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_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, 240.0 );
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, 20.0 );
         gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
-                        (gdouble) months );
+                        (gdouble) months / 12.0 );
     }
-    
-    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "historical_data" );
+
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( widget ),
+                        G_CALLBACK ( bet_config_duration_button_clicked ),
+                        button );
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK ( bet_config_duration_number_changed ),
+                        ptr );
 
     param = gsb_data_account_get_bet_hist_data ( account_number );
 
     if ( param == 1 )
-        button = utils_get_child_widget_by_name ( ancestor, "button_2" );
+        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_hist_button_2" );
     else
-        button = utils_get_child_widget_by_name ( ancestor, "button_1" );
+        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_hist_button_1" );
 
-    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
 
     param = gsb_data_account_get_bet_hist_fyear ( account_number );
-    widget = utils_get_child_widget_by_name ( ancestor, "bet_hist_fyear_combo" );
+    widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_config_hist_fyear_combo" );
     bet_historical_set_fyear_from_combobox ( widget, param );
 
     return FALSE;
@@ -809,7 +794,8 @@
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
-    bet_array_refresh_estimate_tab ( account_number );
+    
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 
     return FALSE;
 }

Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- balance_estimate_data.h	5 Apr 2010 21:24:53 -0000	1.14
+++ balance_estimate_data.h	18 Apr 2010 07:53:06 -0000	1.15
@@ -65,6 +65,15 @@
 };
 
 
+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 );
@@ -81,7 +90,7 @@
                         gint sub_div,
                         const gchar *return_value_error );
 gint bet_data_get_div_number ( gint transaction_number, gboolean is_transaction );
-gboolean bet_data_get_maj ( void );
+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 );
@@ -106,7 +115,7 @@
                         gint sub_div_nb,
                         gboolean edited );
 gboolean bet_data_set_div_ptr ( gint type_div );
-void bet_data_set_maj ( gboolean maj );
+void bet_data_set_maj ( gint account_number, gint type_maj );
 void bet_data_synchronise_hist_div_list ( GHashTable  *list_div );
 void struct_free_bet_historical ( SH *sh );
 struct_futur_data *struct_initialise_bet_future ( void );

Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- fenetre_principale.c	5 Apr 2010 21:24:53 -0000	1.132
+++ fenetre_principale.c	18 Apr 2010 07:53:06 -0000	1.133
@@ -303,6 +303,7 @@
                         guint page_number,
                         gpointer null )
 {
+    //~ devel_debug_int (page_number);
     switch ( page_number )
     {
     case 0:
@@ -313,7 +314,7 @@
     case 2:
 #ifdef ENABLE_BALANCE_ESTIMATE
         if ( bet_data_get_maj ( ) )
-            bet_array_update_estimate_tab ( );
+            bet_array_update_estimate_tab ( gsb_gui_navigation_get_current_account ( ) );
 #endif /* ENABLE_BALANCE_ESTIMATE */
     case 3:
         gsb_form_set_expander_visible (FALSE, FALSE );

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- gsb_transactions_list.c	17 Apr 2010 15:37:03 -0000	1.208
+++ gsb_transactions_list.c	18 Apr 2010 07:53:06 -0000	1.209
@@ -2431,7 +2431,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( TRUE );
+    bet_data_set_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ESTIMATE );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
     if ( etat.modification_fichier == 0 )

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- gsb_form.c	15 Apr 2010 20:55:48 -0000	1.159
+++ gsb_form.c	18 Apr 2010 07:53:06 -0000	1.160
@@ -2643,7 +2643,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( TRUE );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
     /* give the focus to the date widget */

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- balance_estimate_tab.h	17 Apr 2010 15:37:03 -0000	1.14
+++ balance_estimate_tab.h	18 Apr 2010 07:53:06 -0000	1.15
@@ -27,13 +27,14 @@
 
 /* START_DECLARATION */
 GtkWidget *bet_array_create_page ( void );
+gboolean bet_array_initializes_account_settings ( gint account_number );
 void bet_array_list_add_new_hist_line ( GtkTreeModel *tab_model,
                         GtkTreeModel *model,
                         GtkTreeIter *iter,
                         GDate *date_min,
                         GDate *date_max );
 void bet_array_refresh_estimate_tab ( gint account_number );
-void bet_array_update_estimate_tab ( void );
+void bet_array_update_estimate_tab ( gint account_number );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_TAB_H*/

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.331
retrieving revision 1.332
diff -u -d -r1.331 -r1.332
--- import.c	15 Apr 2010 20:55:49 -0000	1.331
+++ import.c	18 Apr 2010 07:53:06 -0000	1.332
@@ -1605,7 +1605,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( TRUE );
+    bet_data_set_maj ( gsb_gui_navigation_get_current_account (), BET_MAJ_ESTIMATE );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
     if ( etat.modification_fichier == 0 )
@@ -4373,7 +4373,7 @@
 
 #ifdef ENABLE_BALANCE_ESTIMATE
     /* force the update module budget */
-    bet_data_set_maj ( TRUE );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 #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.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- balance_estimate_data.c	5 Apr 2010 21:24:53 -0000	1.20
+++ balance_estimate_data.c	18 Apr 2010 07:53:06 -0000	1.21
@@ -84,7 +84,7 @@
 static gint future_number;
 
 /* force la mise à jour des données */
-static gboolean bet_maj = FALSE;
+static gint bet_maj = FALSE;
 
 
 /**
@@ -116,7 +116,7 @@
  *
  *
  * */
-gboolean bet_data_get_maj ( void )
+gint bet_data_get_maj ( void )
 {
     return bet_maj;
 }
@@ -128,9 +128,52 @@
  *
  *
  * */
-void bet_data_set_maj ( gboolean maj )
+void bet_data_set_maj ( gint account_number, gint type_maj )
 {
-    bet_maj = 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 )
+        bet_array_update_estimate_tab ( account_number );
 }
 
 
@@ -944,7 +987,7 @@
         gtk_widget_show ( page );
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
         gtk_widget_show ( page );
-        bet_array_update_estimate_tab ( );
+        bet_data_set_maj ( account_number, BET_MAJ_ALL );
         break;
     case GSB_TYPE_LIABILITIES:
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
@@ -953,7 +996,7 @@
             gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 1 );
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
         gtk_widget_hide ( page );
-        bet_array_update_estimate_tab ( );
+        bet_data_set_maj ( account_number, BET_MAJ_ALL );
         break;
     case GSB_TYPE_ASSET:
         if ( current_page < 2 )

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- balance_estimate_tab.c	17 Apr 2010 15:37:03 -0000	1.63
+++ balance_estimate_tab.c	18 Apr 2010 07:53:06 -0000	1.64
@@ -83,7 +83,6 @@
 static gboolean  bet_array_entry_key_press ( GtkWidget *entry,
                         GdkEventKey *ev,
                         gpointer data );
-static gboolean bet_array_initializes_account_settings ( gint account_number );
 static void bet_array_list_add_substract_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
 static gboolean bet_array_list_button_press ( GtkWidget *tree_view,
@@ -164,21 +163,35 @@
  *
  * 
  */
-void bet_array_update_estimate_tab ( void )
+void bet_array_update_estimate_tab ( gint account_number )
 {
-    gint account_number;
-
-    devel_debug ( NULL );
-    /* Initializes account settings */
-    account_number = gsb_gui_navigation_get_current_account ( );
+    gint type_maj;
 
+    devel_debug_int ( account_number );
+    /* test account number */
     if ( account_number == -1 )
         return;
 
-    bet_array_initializes_account_settings ( account_number );
+    type_maj = bet_data_get_maj ( );
 
-    bet_historical_populate_data ( account_number );
-    bet_array_refresh_estimate_tab ( account_number );
+    if ( type_maj == BET_MAJ_FALSE )
+        return;
+
+    bet_array_initializes_account_settings ( account_number );
+    switch ( type_maj )
+    {
+        case BET_MAJ_ESTIMATE:
+            bet_array_refresh_estimate_tab ( account_number );
+        break;
+        case BET_MAJ_HISTORICAL:
+            bet_historical_populate_data ( account_number );
+        break;
+        case BET_MAJ_ALL:
+            bet_historical_populate_data ( account_number );
+            bet_array_refresh_estimate_tab ( account_number );
+        break;
+    }
+    bet_data_set_maj ( -1, BET_MAJ_FALSE );
 }
 
 
@@ -459,6 +472,7 @@
     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" );
 
     /* create the title */
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
@@ -684,7 +698,7 @@
     GtkTreeIter iter;
     GSList* tmp_list;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     tmp_list = gsb_data_scheduled_get_scheduled_list ( );
 
     while (tmp_list)
@@ -837,7 +851,7 @@
     GDate *date_comp;
     GSList *tmp_list;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     /* init dates */
     date_jour_1 = gdate_today ( );
     if ( g_date_get_day ( date_min ) > 1 )
@@ -1498,7 +1512,7 @@
         account_number = gsb_gui_navigation_get_current_account ( );
         bet_data_future_remove_lines ( account_number, number, mother_row );
 
-        bet_array_refresh_estimate_tab ( account_number );
+        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
     }
 }
 
@@ -1545,12 +1559,14 @@
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
+    gint account_number;
 
     if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
      &model, &iter ) )
         return;
 
-    bet_array_update_estimate_tab ( );
+    account_number = gsb_gui_navigation_get_current_account ( );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 }
 
 
@@ -1767,7 +1783,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( account_number );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 
     return FALSE;
 }
@@ -1842,14 +1858,13 @@
 gboolean bet_array_initializes_account_settings ( gint account_number )
 {
     GtkWidget *notebook;
-    GtkWidget *ancestor;
     GtkWidget *widget = NULL;
     GtkWidget *button = NULL;
     GtkWidget *toggled = NULL;
     gint param;
     gint months;
 
-    //~ devel_debug_int ( account_number );
+    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" );
 
@@ -1896,20 +1911,18 @@
                         NULL );
 
     param = gsb_data_account_get_bet_auto_inc_month ( account_number );
-    printf ("param = %d\n", param);
+
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( toggled ), param );
     g_signal_handlers_unblock_by_func ( G_OBJECT ( toggled ),
                         G_CALLBACK ( bet_array_auto_inc_month_toggle ),
                         NULL );
 
-    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "historical_data" );
-
     param = gsb_data_account_get_bet_hist_data ( account_number );
 
     if ( param == 1 )
-        button = g_object_get_data ( G_OBJECT ( notebook ), "button_2" );
+        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_button_2" );
     else
-        button = g_object_get_data ( G_OBJECT ( notebook ), "button_1" );
+        button = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_button_1" );
 
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
 

Index: balance_estimate_future.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- balance_estimate_future.c	17 Apr 2010 15:37:03 -0000	1.8
+++ balance_estimate_future.c	18 Apr 2010 07:53:06 -0000	1.9
@@ -192,7 +192,7 @@
         else
             bet_data_future_add_lines ( scheduled );
 
-        bet_array_refresh_estimate_tab ( account_number );
+        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
     }
 
     gtk_widget_hide ( bet_dialog );
@@ -1651,7 +1651,7 @@
             bet_data_future_modify_lines ( scheduled );
         }
 
-        bet_array_refresh_estimate_tab ( account_number );
+        bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
     }
 
     gtk_widget_hide ( bet_dialog );

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- balance_estimate_hist.c	17 Apr 2010 15:37:03 -0000	1.22
+++ balance_estimate_hist.c	18 Apr 2010 07:53:06 -0000	1.23
@@ -73,7 +73,7 @@
                         GtkTreeModel *model );
 static gboolean bet_historical_fyear_create_combobox_store ( void );
 static gsb_real bet_historical_get_children_amount ( GtkTreeModel *model, GtkTreeIter *parent );
-static GtkWidget *bet_historical_get_data ( GtkWidget *container );
+static GtkWidget *bet_historical_get_data_tree_view ( GtkWidget *container );
 static gboolean bet_historical_get_full_div ( GtkTreeModel *model, GtkTreeIter *parent );
 static gboolean bet_historical_initializes_account_settings ( gint account_number );
 static void bet_historical_populate_div_model ( gpointer key,
@@ -132,6 +132,7 @@
     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" );
 
     /* titre de la page */
     align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
@@ -151,7 +152,7 @@
 
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("Categories") );
-    gtk_widget_set_name ( button_1, "button_1" );
+    gtk_widget_set_name ( button_1, "bet_hist_button_1" );
     g_signal_connect ( G_OBJECT ( button_1 ),
                         "released",
                         G_CALLBACK ( bet_config_origin_data_clicked ),
@@ -160,14 +161,13 @@
     button_2 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_1 ),
                         _("Budgetary lines") );
-    gtk_widget_set_name ( button_2, "button_2" );
     g_signal_connect ( G_OBJECT ( button_2 ),
                         "released",
                         G_CALLBACK ( bet_config_origin_data_clicked ),
                         GINT_TO_POINTER ( 1 ) );
 
-    g_object_set_data ( G_OBJECT ( notebook ), "button_1", button_1 );
-    g_object_set_data ( G_OBJECT ( notebook ), "button_2", button_2 );
+    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 );
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
     gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
 
@@ -200,7 +200,7 @@
     }
 
     /* création de la liste des données */
-    tree_view = bet_historical_get_data ( page );
+    tree_view = bet_historical_get_data_tree_view ( page );
     g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_treeview", tree_view );
 
     gtk_widget_show_all ( page );
@@ -324,7 +324,7 @@
             }
         }
 
-        bet_array_refresh_estimate_tab ( account_nb );
+        bet_data_set_maj ( account_nb, BET_MAJ_ESTIMATE );
     }
 
     if ( etat.modification_fichier == 0 )
@@ -438,7 +438,7 @@
             g_free ( tmp_str );
         }
 
-        bet_array_refresh_estimate_tab ( account_nb );
+        bet_data_set_maj ( account_nb, BET_MAJ_ESTIMATE );
 
         if ( etat.modification_fichier == 0 )
             modification_fichier ( TRUE );
@@ -452,7 +452,7 @@
  *
  *
  * */
-GtkWidget *bet_historical_get_data ( GtkWidget *container )
+GtkWidget *bet_historical_get_data_tree_view ( GtkWidget *container )
 {
     GtkWidget *notebook;
     GtkWidget *scrolled_window;
@@ -1469,7 +1469,7 @@
                         SPP_HISTORICAL_EDITED_COLUMN, FALSE,
                         -1);
 
-    bet_array_refresh_estimate_tab ( account_number );
+    bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );



More information about the cvs mailing list