[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.12, 1.13 balance_estimate_future.c, 1.7, 1.8 balance_estimate_hist.c, 1.21, 1.22 balance_estimate_hist.h, 1.9, 1.10 balance_estimate_tab.c, 1.62, 1.63 balance_estimate_tab.h, 1.13, 1.14 gsb_data_account.c, 1.102, 1.103 gsb_data_account.h, 1.43, 1.44 gsb_file_load.c, 1.217, 1.218 gsb_file_save.c, 1.163, 1.164 gsb_real.c, 1.77, 1.78 gsb_reconcile_list.c, 1.10, 1.11 gsb_transactions_list.c, 1.207, 1.208

Pierre Biava pbiava at users.sourceforge.net
Sat Apr 17 17:37:06 CEST 2010


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

Modified Files:
	balance_estimate_config.c balance_estimate_future.c 
	balance_estimate_hist.c balance_estimate_hist.h 
	balance_estimate_tab.c balance_estimate_tab.h 
	gsb_data_account.c gsb_data_account.h gsb_file_load.c 
	gsb_file_save.c gsb_real.c gsb_reconcile_list.c 
	gsb_transactions_list.c 
Log Message:
minor bug fixes and addition of an automatic change of the month for the estimates

Index: gsb_reconcile_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_reconcile_list.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- gsb_reconcile_list.c	29 Aug 2009 08:36:41 -0000	1.10
+++ gsb_reconcile_list.c	17 Apr 2010 15:37:03 -0000	1.11
@@ -101,6 +101,11 @@
     gint payment_number_1, payment_number_2;
 
     /* ***** the first part is a copy of the generals tests in the transaction list sort ***** */
+    if ( !*a )
+        return -1;
+
+    if ( !*b )
+        return 1;
 
     /* i don't know why but sometimes there is a comparison between the 2 same rows... */
     if (*a == *b)

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- balance_estimate_config.c	5 Apr 2010 21:24:53 -0000	1.12
+++ balance_estimate_config.c	17 Apr 2010 15:37:03 -0000	1.13
@@ -454,7 +454,7 @@
 
     /* création du sélecteur de périod */
     widget = gsb_fyear_make_combobox_new ( bet_fyear_model_filter, TRUE );
-    gtk_widget_set_name ( GTK_WIDGET ( widget ), "fyear_combo" );
+    gtk_widget_set_name ( GTK_WIDGET ( widget ), "bet_hist_fyear_combo" );
     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);
@@ -556,7 +556,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( );
+    bet_array_refresh_estimate_tab ( account_number );
 }
 
 
@@ -586,7 +586,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( );
+    bet_array_refresh_estimate_tab ( account_number );
 
     return ( FALSE );
 }
@@ -756,7 +756,7 @@
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
 
     param = gsb_data_account_get_bet_hist_fyear ( account_number );
-    widget = utils_get_child_widget_by_name ( ancestor, "fyear_combo" );
+    widget = utils_get_child_widget_by_name ( ancestor, "bet_hist_fyear_combo" );
     bet_historical_set_fyear_from_combobox ( widget, param );
 
     return FALSE;
@@ -809,7 +809,7 @@
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
-    bet_array_refresh_estimate_tab ( );
+    bet_array_refresh_estimate_tab ( account_number );
 
     return FALSE;
 }

Index: gsb_real.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- gsb_real.c	14 Apr 2010 20:54:12 -0000	1.77
+++ gsb_real.c	17 Apr 2010 15:37:03 -0000	1.78
@@ -898,7 +898,7 @@
         gsb_real_minimize_exponent ( &real_number );
     }
 	else
-        real_number.mantissa = (glong) (number);
+        real_number.mantissa = (glong) ( tmp_double );
     //~ printf ("real_number.mantissa = %ld real_number.exponent = %d\n", real_number.mantissa,real_number.exponent); 
     return real_number;
 }

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- gsb_transactions_list.c	10 Apr 2010 21:03:15 -0000	1.207
+++ gsb_transactions_list.c	17 Apr 2010 15:37:03 -0000	1.208
@@ -947,11 +947,12 @@
     GtkTreePath *path;
     gint transaction_number;
     gint mother_transaction;
+    gint account_number;
 
     //~ devel_debug (NULL);
 
-    if (gsb_gui_navigation_get_current_account () == -1)
-	return FALSE;
+    if ( ( account_number = gsb_gui_navigation_get_current_account ( ) ) == -1)
+	    return FALSE;
 
     /* if we just want to let the tree view by himself, it's here
      * we get the path of the last line in transaction because untill now,
@@ -959,8 +960,7 @@
     if (row_align < 0)
     {
         path = transaction_list_select_get_path ( transaction_list_get_last_line (
-                            gsb_data_account_get_nb_rows (
-                            gsb_gui_navigation_get_current_account ( ) ) ) );
+                            gsb_data_account_get_nb_rows ( account_number ) ) );
         if ( path )
         {
             gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW (gsb_transactions_list_get_tree_view ()),
@@ -984,8 +984,7 @@
     if (transaction_number == -1)
     {
         path = transaction_list_select_get_path ( transaction_list_get_last_line (
-                            gsb_data_account_get_nb_rows (
-                            gsb_gui_navigation_get_current_account ( ) ) ) );
+                            gsb_data_account_get_nb_rows ( account_number ) ) );
         row_align = 1.0;
     }
     else
@@ -1475,7 +1474,7 @@
     col = find_element_col (ELEMENT_MARK);
     if ( col == -1 )
 	    return FALSE;
-printf ("etape 1\n");
+
     /* if we are on the white line, a R transaction or a child of split, do nothing */
     if ( transaction_number == -1
 	 ||
@@ -1483,7 +1482,7 @@
 	 ||
 	 gsb_data_transaction_get_mother_transaction_number (transaction_number))
 	return FALSE;
-printf ("etape 2\n");
+
     account_number = gsb_gui_navigation_get_current_account ();
     amount = gsb_data_transaction_get_adjusted_amount (transaction_number, -1);
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- balance_estimate_tab.h	5 Apr 2010 21:24:53 -0000	1.13
+++ balance_estimate_tab.h	17 Apr 2010 15:37:03 -0000	1.14
@@ -32,7 +32,7 @@
                         GtkTreeIter *iter,
                         GDate *date_min,
                         GDate *date_max );
-void bet_array_refresh_estimate_tab ( void );
+void bet_array_refresh_estimate_tab ( gint account_number );
 void bet_array_update_estimate_tab ( void );
 /* END_DECLARATION */
 

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- gsb_data_account.c	5 Apr 2010 21:24:53 -0000	1.102
+++ gsb_data_account.c	17 Apr 2010 15:37:03 -0000	1.103
@@ -120,9 +120,10 @@
     GDate *bet_start_date;              /* date de début */
     gint bet_spin_range;                /* echelle de la période 0 = mois 1 = années */
     gint bet_months;                    /* nombre de mois ou d'années */
-    gint bet_select_transaction_label;  /*  */
-    gint bet_select_scheduled_label;    /*  */
-    gint bet_select_futur_label;        /*  */
+    gint bet_auto_inc_month;            /* incrémente automatiquement le mois */
+    gint bet_select_transaction_label;  /* fixe le label pour les opérations */
+    gint bet_select_scheduled_label;    /* fixe le label pour les opérations planifiées */
+    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 */
 } struct_account;
@@ -3031,6 +3032,45 @@
  *
  *
  * */
+gboolean gsb_data_account_get_bet_auto_inc_month ( gint account_number )
+{
+    struct_account *account;
+
+    account = gsb_data_account_get_structure ( account_number );
+
+    if (!account )
+	    return FALSE;
+
+    return account -> bet_auto_inc_month;
+}
+
+
+/**
+ * 
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_auto_inc_month ( gint account_number,
+                        gboolean auto_inc_month )
+{
+    struct_account *account;
+
+    account = gsb_data_account_get_structure ( account_number );
+
+    if (!account )
+	    return FALSE;
+
+    account -> bet_auto_inc_month = auto_inc_month;
+
+    return TRUE;
+}
+
+
+/**
+ * 
+ *
+ *
+ * */
 gint gsb_data_account_get_bet_select_label ( gint account_number, gint origine )
 {
     struct_account *account;
@@ -3090,6 +3130,22 @@
 }
 
 
+gboolean gsb_data_account_bet_update_initial_date_if_necessary ( gint account_number )
+{
+    GDate *date_jour;
+    GDate *tmp_date;
+
+    date_jour = gdate_today ( );
+    tmp_date = gsb_date_copy ( gsb_data_account_get_bet_start_date ( account_number ) );
+    g_date_add_months ( tmp_date, 1 );
+
+    if ( g_date_compare ( date_jour, tmp_date ) >= 0 )
+        gsb_data_account_set_bet_start_date ( account_number, tmp_date );
+
+    g_date_free ( tmp_date );
+
+    return FALSE;
+}
 /* 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.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- balance_estimate_hist.h	5 Apr 2010 21:24:53 -0000	1.9
+++ balance_estimate_hist.h	17 Apr 2010 15:37:03 -0000	1.10
@@ -27,7 +27,7 @@
 /* START_DECLARATION */
 GtkWidget *bet_historical_create_page ( void );
 gint bet_historical_get_fyear_from_combobox ( GtkWidget *combo_box );
-void bet_historical_populate_data ( void );
+void bet_historical_populate_data ( gint account_number );
 void bet_historical_refresh_data ( GtkTreeModel *tab_model,
                         GDate *date_min,
                         GDate *date_max );

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -d -r1.217 -r1.218
--- gsb_file_load.c	5 Apr 2010 21:24:53 -0000	1.217
+++ gsb_file_load.c	17 Apr 2010 15:37:03 -0000	1.218
@@ -1801,6 +1801,18 @@
         continue;
     }
 
+    if ( !strcmp ( attribute_names[i], "Bet_auto_inc_month" ))
+    {
+        gboolean auto_inc_month;
+
+        auto_inc_month = utils_str_atoi ( attribute_values[i] );
+        gsb_data_account_set_bet_auto_inc_month ( account_number, auto_inc_month );
+        if ( auto_inc_month )
+            gsb_data_account_bet_update_initial_date_if_necessary ( account_number );
+            
+        i++;
+        continue;
+    }
     if ( !strcmp ( attribute_names[i], "Bet_select_transaction_label" ))
     {
         gsb_data_account_set_bet_select_label ( account_number,

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- gsb_file_save.c	5 Apr 2010 21:24:53 -0000	1.163
+++ gsb_file_save.c	17 Apr 2010 15:37:03 -0000	1.164
@@ -1064,6 +1064,7 @@
                            "\t\tBet_start_date=\"%s\"\n"
                            "\t\tBet_months=\"%d\"\n"
                            "\t\tBet_UT=\"%d\"\n"
+                           "\t\tBet_auto_inc_month=\"%d\"\n"
                            "\t\tBet_select_transaction_label=\"%d\"\n" 
                            "\t\tBet_select_scheduled_label=\"%d\"\n" 
                            "\t\tBet_select_futur_label=\"%d\"\n"
@@ -1106,6 +1107,7 @@
                         gsb_data_account_get_bet_start_date ( account_number ) ) ),
         gsb_data_account_get_bet_months ( account_number ),
         gsb_data_account_get_bet_spin_range ( account_number ),
+        gsb_data_account_get_bet_auto_inc_month ( account_number ),
         gsb_data_account_get_bet_select_label ( account_number, SPP_ORIGIN_TRANSACTION ),
         gsb_data_account_get_bet_select_label ( account_number, SPP_ORIGIN_SCHEDULED ),
         gsb_data_account_get_bet_select_label ( account_number, SPP_ORIGIN_FUTURE ),

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- balance_estimate_tab.c	14 Apr 2010 20:54:12 -0000	1.62
+++ balance_estimate_tab.c	17 Apr 2010 15:37:03 -0000	1.63
@@ -75,6 +75,7 @@
                         gint sub_div_nb,
                         gsb_real amount,
                         GtkTreeModel *model );
+static void bet_array_auto_inc_month_toggle ( GtkToggleButton *togglebutton, gpointer  data );
 static gint bet_array_date_sort_function ( GtkTreeModel *model,
                         GtkTreeIter *itera,
                         GtkTreeIter *iterb,
@@ -165,9 +166,19 @@
  */
 void bet_array_update_estimate_tab ( void )
 {
+    gint account_number;
+
     devel_debug ( NULL );
-    bet_historical_populate_data ( );
-    bet_array_refresh_estimate_tab ( );
+    /* Initializes account settings */
+    account_number = gsb_gui_navigation_get_current_account ( );
+
+    if ( account_number == -1 )
+        return;
+
+    bet_array_initializes_account_settings ( account_number );
+
+    bet_historical_populate_data ( account_number );
+    bet_array_refresh_estimate_tab ( account_number );
 }
 
 
@@ -285,7 +296,7 @@
  * This function is called when the refresh button is pressed and when
  * the balance estimate tab is selected.
  */
-void bet_array_refresh_estimate_tab ( void )
+void bet_array_refresh_estimate_tab ( gint account_number )
 {
     GtkWidget *notebook;
     GtkWidget *widget;
@@ -299,7 +310,6 @@
     gchar *str_amount;
     gchar *title;
     gchar *tmp_str;
-    gint account_nb;
     GDate *date_init;
     GDate *date_min;
     GDate *date_max;
@@ -311,21 +321,12 @@
     notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     tmp_range = struct_initialise_bet_range ( );
 
-    /* find the selected account */
-    account_nb = gsb_gui_navigation_get_current_account ( );
-
-    if ( account_nb == -1 )
-        return;
-
-    /* Initializes account settings */
-    bet_array_initializes_account_settings ( account_nb );
-
     /* calculate date_min and date_max with user choice */
-    date_min = gsb_data_account_get_bet_start_date ( account_nb );
+    date_min = gsb_data_account_get_bet_start_date ( account_number );
     
-    date_max = bet_data_array_get_date_max ( account_nb );
+    date_max = bet_data_array_get_date_max ( account_number );
 
-    widget = g_object_get_data ( G_OBJECT ( notebook ), "initial_date");
+    widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_initial_date");
     gsb_calendar_entry_set_date ( widget, date_min );
 
     str_date_min = gsb_format_gdate ( date_min );
@@ -343,11 +344,11 @@
      * in the future in the account. So we need to calculate the balance
      * of today */
     current_balance = gsb_data_account_calculate_current_day_balance (
-                        account_nb, date_min );
+                        account_number, date_min );
 
     str_amount = gsb_real_save_real_to_string ( current_balance, 2 );
     str_current_balance = gsb_real_get_string_with_currency ( current_balance,
-                        gsb_data_account_get_currency ( account_nb ), TRUE );
+                        gsb_data_account_get_currency ( account_number ), TRUE );
 
     if ( current_balance.mantissa < 0 )
         color_str = "red";
@@ -357,7 +358,7 @@
     /* set the titles of tabs module budget */
     title = g_strdup_printf (
                         _("Balance estimate of the account \"%s\" from %s to %s"),
-                        gsb_data_account_get_name ( account_nb ),
+                        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") );
@@ -366,7 +367,7 @@
 
     title = g_strdup_printf (
                         _("Please select the data source for the account: \"%s\""),
-                        gsb_data_account_get_name ( account_nb ) );
+                        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 );
@@ -405,13 +406,13 @@
     
     /* search transactions of the account which are in the period */
     bet_array_refresh_transactions_data ( tree_model,
-                        account_nb,
+                        account_number,
                         date_min,
                         date_max );
 
     /* for each schedulded operation */
     bet_array_refresh_scheduled_data ( tree_model,
-                        account_nb,
+                        account_number,
                         date_min,
                         date_max );
 
@@ -529,13 +530,19 @@
 			            "key-press-event",
 			            G_CALLBACK ( bet_array_entry_key_press ),
 			            NULL );
-    g_object_set_data ( G_OBJECT ( notebook ), "initial_date", initial_date );
+    g_object_set_data ( G_OBJECT ( notebook ), "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 );
     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 );
 
     /* create the estimate treeview */
     tree_view = gtk_tree_view_new ( );
@@ -1475,6 +1482,7 @@
     gint origine;
     gint number;
     gint mother_row;
+    gint account_number;
 
     if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ), &model, &iter ) )
         return;
@@ -1486,9 +1494,12 @@
                         -1 );
 
     if ( origine == SPP_ORIGIN_FUTURE )
-        bet_data_future_remove_lines ( gsb_gui_navigation_get_current_account ( ), number, mother_row );
+    {
+        account_number = gsb_gui_navigation_get_current_account ( );
+        bet_data_future_remove_lines ( account_number, number, mother_row );
 
-    bet_array_refresh_estimate_tab ( );
+        bet_array_refresh_estimate_tab ( account_number );
+    }
 }
 
 
@@ -1744,19 +1755,19 @@
                         GdkEventFocus *ev,
                         gpointer data )
 {
-    gint account_nb;
+    gint account_number;
     GDate *date;
 
     devel_debug (NULL);
     gtk_editable_select_region ( GTK_EDITABLE ( entry ), 0, 0 );
-    account_nb = gsb_gui_navigation_get_current_account ( );
+    account_number = gsb_gui_navigation_get_current_account ( );
     date = gsb_parse_date_string ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
-    gsb_data_account_set_bet_start_date ( account_nb, date );
+    gsb_data_account_set_bet_start_date ( account_number, date );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_array_refresh_estimate_tab ( );
+    bet_array_refresh_estimate_tab ( account_number );
 
     return FALSE;
 }
@@ -1834,18 +1845,27 @@
     GtkWidget *ancestor;
     GtkWidget *widget = NULL;
     GtkWidget *button = NULL;
+    GtkWidget *toggled = NULL;
     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" );
+
     param = gsb_data_account_get_bet_spin_range ( account_number );
     months = gsb_data_account_get_bet_months ( account_number );
 
+    g_signal_handlers_block_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK ( bet_config_duration_number_changed ),
+                        GINT_TO_POINTER ( 1 ) );
+
     if ( param == 0 )
     {
         widget = g_object_get_data ( G_OBJECT ( notebook ), "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_value ( GTK_SPIN_BUTTON ( button ),
@@ -1854,12 +1874,34 @@
     else
     {
         widget = g_object_get_data ( G_OBJECT ( notebook ), "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_value ( GTK_SPIN_BUTTON ( button ),
                         (gdouble) months / 12.0 );
     }
 
+    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 ),
+                        GINT_TO_POINTER ( 1 ) );
+
+    toggled = g_object_get_data ( G_OBJECT ( notebook ), "bet_auto_inc_month" );
+    g_signal_handlers_block_by_func ( G_OBJECT ( toggled ),
+                        G_CALLBACK ( bet_array_auto_inc_month_toggle ),
+                        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 );
@@ -1869,11 +1911,18 @@
     else
         button = g_object_get_data ( G_OBJECT ( notebook ), "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 = g_object_get_data ( G_OBJECT ( notebook ), "fyear_combo" );
+    widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo" );
+    g_signal_handlers_block_by_func ( G_OBJECT ( widget ),
+                        G_CALLBACK ( bet_config_fyear_clicked ),
+                        GINT_TO_POINTER ( 1 ) );
+
     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 ) );
 
     return FALSE;
 }
@@ -2173,6 +2222,31 @@
 
     return desc;
 }
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_array_auto_inc_month_toggle ( GtkToggleButton *togglebutton, gpointer  data )
+{
+    gint account_number;
+    gboolean value;
+    
+    devel_debug_int (gtk_toggle_button_get_active ( togglebutton ));
+
+    account_number = gsb_gui_navigation_get_current_account ( );
+    if ( ( value = gtk_toggle_button_get_active ( togglebutton ) ) !=
+        gsb_data_account_get_bet_auto_inc_month ( account_number ) )
+    {
+        gsb_data_account_set_bet_auto_inc_month ( account_number, value );
+
+        if ( etat.modification_fichier == 0 )
+            modification_fichier ( TRUE );
+    }
+}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: balance_estimate_future.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- balance_estimate_future.c	5 Apr 2010 21:24:53 -0000	1.7
+++ balance_estimate_future.c	17 Apr 2010 15:37:03 -0000	1.8
@@ -67,7 +67,7 @@
                         GdkEventButton *ev,
                         gint *ptr_origin );
 static gboolean bet_form_clean ( gint account_number );
-static gboolean bet_form_create_current_form ( GtkWidget *table );
+static gboolean bet_form_create_current_form ( GtkWidget *table, gint account_number );
 static gboolean bet_form_create_scheduler_part ( GtkWidget *table );
 static gboolean bet_form_entry_get_focus ( GtkWidget *entry );
 static gboolean bet_form_entry_lose_focus ( GtkWidget *entry,
@@ -80,7 +80,7 @@
 						       gpointer null );
 static GtkWidget *bet_form_scheduler_get_element_widget ( gint element_number );
 static GtkWidget *bet_form_widget_get_widget ( gint element_number );
-static gboolean bet_future_create_dialog ( void );
+static gboolean bet_future_create_dialog ( gint account_number );
 static gboolean bet_future_get_budget_data ( GtkWidget *widget,
                         gint budget_type,
                         struct_futur_data *scheduled );
@@ -124,14 +124,19 @@
     GDate *date;
     GDate *date_jour;
     gint result;
+    gint account_number;
 
+    account_number = gsb_gui_navigation_get_current_account ( );
+    if ( account_number == -1 )
+        return FALSE;
+    
     if ( bet_dialog == NULL )
     {
-        bet_future_create_dialog ( );
+        bet_future_create_dialog ( account_number );
     }
     else
     {
-        bet_form_clean ( gsb_gui_navigation_get_current_account ( ) );
+        bet_form_clean ( account_number );
         gtk_widget_show ( bet_dialog );
     }
 
@@ -187,7 +192,7 @@
         else
             bet_data_future_add_lines ( scheduled );
 
-        bet_array_refresh_estimate_tab ( );
+        bet_array_refresh_estimate_tab ( account_number );
     }
 
     gtk_widget_hide ( bet_dialog );
@@ -202,7 +207,7 @@
  *
  *
  * */
-gboolean bet_future_create_dialog ( void )
+gboolean bet_future_create_dialog ( gint account_number )
 {
     GtkWidget *vbox;
     GtkWidget *table;
@@ -230,7 +235,7 @@
     gtk_box_pack_start ( GTK_BOX ( vbox ), table, FALSE, FALSE, 5 );
 
     bet_form_create_scheduler_part ( table );
-    bet_form_create_current_form ( table );
+    bet_form_create_current_form ( table, account_number );
 
 	gtk_widget_show ( vbox );
 
@@ -372,15 +377,14 @@
  * 
  * \return FALSE
  * */
-gboolean bet_form_create_current_form ( GtkWidget *table )
+gboolean bet_form_create_current_form ( GtkWidget *table, gint account_number )
 {
 	GtkWidget *widget;
     GtkWidget *credit;
     gint element_number;
     gint width = 250;
     gint row = 2;
-    gint column = 0;
-    gint account_number;
+    gint column = 0;;
     struct_element *element;
     GSList *tmp_list;
 
@@ -1605,11 +1609,11 @@
 
     if ( bet_dialog == NULL )
     {
-        bet_future_create_dialog ( );
+        bet_future_create_dialog ( account_number );
     }
     else
     {
-        bet_form_clean ( gsb_gui_navigation_get_current_account ( ) );
+        bet_form_clean ( account_number );
         gtk_widget_show ( bet_dialog );
     }
 
@@ -1647,7 +1651,7 @@
             bet_data_future_modify_lines ( scheduled );
         }
 
-        bet_array_refresh_estimate_tab ( );
+        bet_array_refresh_estimate_tab ( account_number );
     }
 
     gtk_widget_hide ( bet_dialog );

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- balance_estimate_hist.c	5 Apr 2010 21:24:53 -0000	1.21
+++ balance_estimate_hist.c	17 Apr 2010 15:37:03 -0000	1.22
@@ -178,11 +178,11 @@
     if ( bet_historical_fyear_create_combobox_store ( ) )
     {
         widget = gsb_fyear_make_combobox_new ( bet_fyear_model_filter, TRUE );
-        gtk_widget_set_name ( GTK_WIDGET ( widget ), "fyear_combo" );
+        gtk_widget_set_name ( GTK_WIDGET ( widget ), "bet_hist_fyear_combo" );
         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_historical_fyear", widget );
+        g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo", widget );
 
         gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5);
 
@@ -324,7 +324,7 @@
             }
         }
 
-        bet_array_refresh_estimate_tab ( );
+        bet_array_refresh_estimate_tab ( account_nb );
     }
 
     if ( etat.modification_fichier == 0 )
@@ -438,7 +438,7 @@
             g_free ( tmp_str );
         }
 
-        bet_array_refresh_estimate_tab ( );
+        bet_array_refresh_estimate_tab ( account_nb );
 
         if ( etat.modification_fichier == 0 )
             modification_fichier ( TRUE );
@@ -633,12 +633,11 @@
  *
  *
  * */
-void bet_historical_populate_data ( void )
+void bet_historical_populate_data ( gint account_number )
 {
     GtkWidget *notebook;
     GtkWidget *tree_view;
     GtkTreeModel *model;
-    gint account_number;
     gint fyear_number;
     GDate *date_min;
     GDate *date_max;
@@ -646,11 +645,6 @@
     GHashTable  *list_div;
 
     //~ devel_debug (NULL);
-    /* récuperation du n° de compte à utiliser */
-    account_number = gsb_gui_navigation_get_current_account ( );
-    if ( account_number == -1 )
-        return;
-
     notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     tree_view = g_object_get_data (G_OBJECT ( notebook ), "bet_historical_treeview" );
     if ( GTK_IS_TREE_VIEW ( tree_view ) == FALSE )
@@ -1475,7 +1469,7 @@
                         SPP_HISTORICAL_EDITED_COLUMN, FALSE,
                         -1);
 
-    bet_array_refresh_estimate_tab ( );
+    bet_array_refresh_estimate_tab ( account_number );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -1519,7 +1513,7 @@
     gint fyear_number;
 
     notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
-    combo = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_fyear" );
+    combo = g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_fyear_combo" );
 
     fyear_number = gsb_data_account_get_bet_hist_fyear ( account_number );
 

Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- gsb_data_account.h	5 Apr 2010 21:24:53 -0000	1.43
+++ gsb_data_account.h	17 Apr 2010 15:37:03 -0000	1.44
@@ -22,6 +22,7 @@
 
 
 /* START_DECLARATION */
+gboolean gsb_data_account_bet_update_initial_date_if_necessary ( gint account_number );
 gsb_real gsb_data_account_calculate_current_and_marked_balances ( gint account_number );
 gsb_real gsb_data_account_calculate_current_day_balance ( gint account_number,
                         GDate *day );
@@ -42,6 +43,7 @@
 gchar *gsb_data_account_get_bank_account_key ( gint account_number );
 gchar *gsb_data_account_get_bank_account_number ( gint account_number );
 gchar *gsb_data_account_get_bank_branch_code ( gint account_number );
+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_months ( gint account_number );
@@ -100,6 +102,8 @@
                         const gchar *bank_account_number );
 gboolean gsb_data_account_set_bank_branch_code ( gint account_number,
                         const gchar *bank_branch_code );
+gboolean gsb_data_account_set_bet_auto_inc_month ( gint account_number,
+                        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_months ( gint account_number, gint months );



More information about the cvs mailing list