[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.8, 1.9 balance_estimate_config.h, 1.2, 1.3 balance_estimate_data.c, 1.11, 1.12 balance_estimate_hist.c, 1.11, 1.12 balance_estimate_hist.h, 1.4, 1.5 balance_estimate_tab.c, 1.47, 1.48 balance_estimate_tab.h, 1.9, 1.10 fenetre_principale.c, 1.124, 1.125 gsb_file_load.c, 1.208, 1.209 gsb_file_save.c, 1.154, 1.155 navigation.c, 1.136, 1.137 structures.h, 1.240, 1.241

Pierre Biava pbiava at users.sourceforge.net
Wed Mar 3 23:21:51 CET 2010


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

Modified Files:
	balance_estimate_config.c balance_estimate_config.h 
	balance_estimate_data.c balance_estimate_hist.c 
	balance_estimate_hist.h balance_estimate_tab.c 
	balance_estimate_tab.h fenetre_principale.c gsb_file_load.c 
	gsb_file_save.c navigation.c structures.h 
Log Message:
Moving Estimates in accounts

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -d -r1.240 -r1.241
--- structures.h	20 Feb 2010 08:54:00 -0000	1.240
+++ structures.h	3 Mar 2010 22:21:49 -0000	1.241
@@ -132,7 +132,6 @@
     gint add_archive_in_total_balance;      /* Add transactions archived in the totals */
 
     /* variables for the module estimate balance */
-    gint bet_last_account;
     gint bet_deb_period;
     gint bet_end_period;
     gint bet_spin_range;

Index: balance_estimate_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- balance_estimate_config.c	20 Feb 2010 08:54:00 -0000	1.8
+++ balance_estimate_config.c	3 Mar 2010 22:21:48 -0000	1.9
@@ -69,15 +69,23 @@
 
 
 /*START_STATIC*/
+static GtkWidget *bet_config_get_duration_widget ( GtkWidget *container );
 static GtkWidget *bet_config_select_historical_data ( GtkWidget *container );
-
 /*END_STATIC*/
 
 /*START_EXTERN*/
 extern GtkTreeModel *bet_fyear_model;
 extern GtkTreeModel *bet_fyear_model_filter;
+extern GtkWidget *notebook_general;
 /*END_EXTERN*/
 
+gchar* bet_duration_array[] = {
+    N_("Month"),
+    N_("Year"),
+    NULL
+};
+
+
 
 /**
  *
@@ -98,7 +106,7 @@
     paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
                         _("Calculation of period") );
 
-    bet_parameter_get_duration_widget ( paddingbox, TRUE );
+    bet_config_get_duration_widget ( paddingbox );
 
     /* Sources of historical data */
     paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
@@ -117,6 +125,162 @@
  *
  *
  * */
+GtkWidget *bet_config_get_duration_widget ( GtkWidget *container )
+{
+    GtkWidget* main_vbox;
+    GtkWidget *label;
+    GtkWidget *button_1, *button_2, *button_3, *button_4;
+    GtkWidget *spin_button = NULL;
+    GtkWidget *widget = NULL;
+    GtkWidget *hbox;
+    GtkWidget *previous = NULL;
+    GtkSizeGroup *size_group;
+    gint iduration;
+
+    //~ devel_debug (NULL);
+    size_group = gtk_size_group_new ( GTK_SIZE_GROUP_HORIZONTAL );
+
+    main_vbox = gtk_vbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( container ), main_vbox, FALSE, FALSE, 5) ;
+
+    label = gtk_label_new ( _("Beginning of period") );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 5) ;
+
+    button_1 = gtk_radio_button_new_with_label ( NULL,
+                        _("1st day of month") );
+    gtk_widget_set_name ( button_1, "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 );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_2 ), TRUE );
+
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
+
+    label = gtk_label_new ( _("End of period") );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 5) ;
+
+    button_3 = gtk_radio_button_new_with_label ( NULL,
+                        _("last day of the month") );
+    gtk_widget_set_name ( button_3, "button_3" );
+    gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), button_3 );
+    
+    button_4 = gtk_radio_button_new_with_label_from_widget (
+                        GTK_RADIO_BUTTON ( button_3 ),
+                        _("From date to date") );
+    gtk_widget_set_name ( button_4, "button_4" );
+
+    if ( etat.bet_end_period == 1 )
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_3 ), TRUE );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_4 ), TRUE );
+
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_3, FALSE, FALSE, 5) ;
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button_4, FALSE, FALSE, 5) ;
+
+    /*set the signals */
+    g_signal_connect (G_OBJECT ( button_1 ),
+                        "released",
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        button_3 );
+    g_signal_connect (G_OBJECT ( button_2 ),
+                        "released",
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        button_4 );
+    g_signal_connect (G_OBJECT ( button_3 ),
+                        "released",
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        NULL );
+    g_signal_connect (G_OBJECT ( button_4 ),
+                        "released",
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        NULL );
+
+    /* partie mensuelle */
+    label = gtk_label_new ( _("Duration estimation") );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), label, FALSE, FALSE, 5) ;
+
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 5) ;
+
+    if ( etat.bet_spin_range == 0 )
+    {
+        spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
+        gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
+                        (gdouble) etat.bet_months );
+    }
+    else
+    {
+        spin_button = gtk_spin_button_new_with_range ( 1.0, 20.0, 1.0 );
+        gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
+                        (gdouble) ( etat.bet_months / 12 ) );
+    }
+    gtk_widget_set_name ( spin_button, "spin_button" );
+
+    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 );
+    }
+
+    if ( etat.bet_spin_range == 0 )
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
+    else
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
+
+    g_signal_connect ( G_OBJECT ( spin_button ),
+                        "value-changed",
+                        G_CALLBACK ( bet_config_duration_number_changed ),
+                        widget );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
+    
+    gtk_widget_show_all ( main_vbox );
+
+    return main_vbox;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
 GtkWidget *bet_config_select_historical_data ( GtkWidget *container )
 {
     GtkWidget *widget;
@@ -132,6 +296,10 @@
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("Categories") );
     gtk_widget_set_name ( button_1, "button_1" );
+    g_signal_connect (G_OBJECT ( button_1 ),
+                        "released",
+                        G_CALLBACK ( bet_historical_origin_data_clicked ),
+                        NULL );
 
     button_2 = gtk_radio_button_new_with_label_from_widget (
                         GTK_RADIO_BUTTON ( button_1 ),
@@ -177,6 +345,148 @@
 }
 
 
+/*
+ * bet_config_duration_period_clicked
+ * This function is called when a radio button is called to change the inial period.
+ * It copies the new durations from the data parameter (of the radio button) into
+ * the bet_period property of the bet container
+ */
+void bet_config_duration_period_clicked ( GtkWidget *togglebutton, GtkWidget *button )
+{
+    const gchar *name;
+
+    //~ devel_debug (NULL);
+    if ( button )
+        g_signal_handlers_block_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        button );
+
+    name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+
+    if ( g_strcmp0 ( name, "button_1" ) == 0 )
+    {
+        etat.bet_deb_period = 1;
+        etat.bet_end_period = 1;
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
+    }
+    else if ( g_strcmp0 ( name, "button_2" ) == 0 )
+    {
+        etat.bet_deb_period = 2;
+        etat.bet_end_period = 2;
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
+    }
+    else if ( g_strcmp0 ( name, "button_3" ) == 0 )
+        etat.bet_end_period = 1;
+
+    else if ( g_strcmp0 ( name, "button_4" ) == 0 )
+        etat.bet_end_period = 2;
+
+    if ( button )
+        g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK ( bet_config_duration_period_clicked ),
+                        button );
+
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_array_refresh_estimate_tab ( );
+}
+
+
+/*
+ * bet_config_duration_button_clicked
+ * This function is called when a radio button is called to change the estimate duration.
+ * It copies the new durations from the data parameter (of the radio button) into
+ * the bet_months property of the bet container
+ */
+void bet_config_duration_button_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *spin_button )
+{
+    GtkWidget *notebook;
+    GtkWidget *ancestor;
+    GtkWidget *widget;
+    const gchar *name;
+
+    //~ devel_debug (NULL);
+    name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_duration" );
+    if ( gtk_widget_is_ancestor ( togglebutton, ancestor ) == FALSE )
+    {
+        widget = utils_get_child_widget_by_name ( ancestor, name );
+        if ( widget )
+            gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
+    }
+
+    if ( g_strcmp0 ( name, "Year" ) == 0 )
+    {
+        etat.bet_spin_range = 1;
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
+        if ( etat.bet_months > 20 )
+        {
+            gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20.0 );
+            etat.bet_months = 240;
+        }
+        else
+            etat.bet_months *= 12;
+    }
+    else
+    {
+        etat.bet_spin_range = 0;
+        etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+        gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 240.0 );
+    }
+
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_array_refresh_estimate_tab ( );
+}
+
+
+/*
+ * bet_duration_button changed
+ * This function is called when a spin button is changed.
+ * It copies the new duration from the spin_button into the bet_months property of
+ * the bet container
+ */
+gboolean bet_config_duration_number_changed ( GtkWidget *spin_button,
+                        GtkWidget *togglebutton )
+{
+    GtkWidget *notebook;
+    GtkWidget *ancestor;
+    GtkWidget *widget;
+    const gchar *name;
+    gboolean toggled;
+
+    //~ devel_debug (NULL);
+    etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+
+    toggled = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( togglebutton ) );
+    if ( toggled == 1 )
+        etat.bet_months *= 12;
+
+    name = gtk_widget_get_name ( GTK_WIDGET ( spin_button ) );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_duration" );
+    if ( gtk_widget_is_ancestor ( togglebutton, ancestor ) == FALSE )
+    {
+        widget = utils_get_child_widget_by_name ( ancestor, name );
+        if ( widget )
+            gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( widget ),
+                        gtk_spin_button_get_value (
+                        GTK_SPIN_BUTTON ( spin_button ) ) );
+    }
+
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    bet_array_refresh_estimate_tab ( );
+
+    return ( FALSE );
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- fenetre_principale.c	20 Feb 2010 08:54:00 -0000	1.124
+++ fenetre_principale.c	3 Mar 2010 22:21:49 -0000	1.125
@@ -25,6 +25,8 @@
 
 /*START_INCLUDE*/
 #include "fenetre_principale.h"
+#include "./balance_estimate_data.h"
+#include "./balance_estimate_hist.h"
 #include "./balance_estimate_tab.h"
 #include "./navigation.h"
 #include "./gsb_transactions_list.h"
@@ -186,34 +188,26 @@
     /* the main right page is a vbox with a notebook on the top
      * and the form on the bottom */
 
-    vbox = gtk_vbox_new ( FALSE,
-			  0);
+    vbox = gtk_vbox_new ( FALSE, 0 );
 
     /* append the notebook */
-    notebook_general = gtk_notebook_new();
-    gtk_notebook_set_show_tabs ( GTK_NOTEBOOK(notebook_general), FALSE );
-    gtk_notebook_set_show_border ( GTK_NOTEBOOK(notebook_general), FALSE );
-    gtk_box_pack_start ( GTK_BOX (vbox),
-			 notebook_general,
-			 TRUE,
-			 TRUE,
-			 0 );
-    gtk_widget_show (notebook_general);
+    notebook_general = gtk_notebook_new ( );
+    gtk_notebook_set_show_tabs ( GTK_NOTEBOOK ( notebook_general ), FALSE );
+    gtk_notebook_set_show_border ( GTK_NOTEBOOK ( notebook_general ), FALSE );
+    gtk_box_pack_start ( GTK_BOX ( vbox ), notebook_general, TRUE, TRUE, 0 );
+    gtk_widget_show ( notebook_general );
 
     /* append the form */
-    form = gsb_form_new ();
-    gtk_box_pack_start ( GTK_BOX (vbox),
-			 form,
-			 FALSE,
-			 FALSE,
-			 0 );
-    gtk_widget_hide (form);
+    form = gsb_form_new ( );
+    gtk_box_pack_start ( GTK_BOX ( vbox ), form, FALSE, FALSE, 0 );
+    gtk_widget_hide ( form );
 
     /* fill the notebook */
-    gsb_gui_fill_main_notebook(notebook_general);
+    gsb_gui_fill_main_notebook ( notebook_general );
 
-    gtk_widget_show (vbox);
-    return (vbox);
+    gtk_widget_show ( vbox );
+
+    return vbox;
 }
 
 
@@ -238,20 +232,31 @@
     gtk_widget_show ( account_page );
 
     gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
-			       account_page,
-			       gtk_label_new (SPACIFY(_("Accounts"))) );
+                        account_page,
+                        gtk_label_new (SPACIFY(_("Accounts"))) );
+    g_object_set_data ( G_OBJECT (notebook), "account_notebook", account_page );
+    
+    gtk_notebook_append_page ( GTK_NOTEBOOK ( account_page ),
+                        creation_fenetre_operations (),
+                        gtk_label_new (SPACIFY(_("Transactions"))) );
+    gtk_notebook_append_page ( GTK_NOTEBOOK ( account_page ),
+                        creation_onglet_comptes (),
+                        gtk_label_new (SPACIFY(_("Properties"))) );
 
+#ifdef ENABLE_BALANCE_ESTIMATE
+     /* append the balance estimate pages */
     gtk_notebook_append_page ( GTK_NOTEBOOK ( account_page ),
-			       creation_fenetre_operations (),
-			       gtk_label_new (SPACIFY(_("Transactions"))) );
+                        bet_array_create_page ( ),
+                        gtk_label_new (SPACIFY(_("Forecast"))) );
     gtk_notebook_append_page ( GTK_NOTEBOOK ( account_page ),
-			       creation_onglet_comptes (),
-			       gtk_label_new (SPACIFY(_("Properties"))) );
+                        bet_historical_create_page ( ),
+                        gtk_label_new (SPACIFY(_("Historical data"))) );
+
+#endif /* ENABLE_BALANCE_ESTIMATE */
     g_signal_connect ( G_OBJECT (account_page),
-		       "switch_page",
-		       G_CALLBACK (gsb_gui_on_account_switch_page),
-		       NULL );
-    g_object_set_data ( G_OBJECT (notebook), "account_notebook", account_page );
+                        "switch_page",
+                        G_CALLBACK (gsb_gui_on_account_switch_page),
+                        NULL );
 
     /* append the scheduled transactions page */
     gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
@@ -263,14 +268,6 @@
 			       onglet_tiers(),
 			       gtk_label_new (SPACIFY(_("Payee"))) );
 
-
-    /* append the balance estimate page */
-#ifdef ENABLE_BALANCE_ESTIMATE 
-    gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
-			       bet_array_create_estimate_page (),
-			       gtk_label_new (SPACIFY(_("Balance estimate"))) );
-#endif /* ENABLE_BALANCE_ESTIMATE */
-
     /* append the categories page */
     gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
 			       onglet_categories (),
@@ -290,9 +287,6 @@
 }
 
 
-
-
-
 /**
  * called when the account notebook changed page between
  * transactions list and account description
@@ -311,15 +305,19 @@
 {
     switch ( page_number )
     {
-	case 0:
-	    gsb_form_set_expander_visible (TRUE,
-					   TRUE );
-	    break;
+    case 0:
+        gsb_form_set_expander_visible ( TRUE, TRUE );
+        break;
+
+    case 1:
+        gsb_form_set_expander_visible (FALSE, FALSE );
+        break;
+    case 2:
+    case 3:
+        gsb_form_set_expander_visible (FALSE, FALSE );
+        bet_array_update_estimate_tab ( );
+        break;
 
-	case 1:
-	    gsb_form_set_expander_visible (FALSE,
-					   FALSE );
-	    break;
     }
     return ( FALSE );
 }

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- gsb_file_save.c	25 Feb 2010 21:38:17 -0000	1.154
+++ gsb_file_save.c	3 Mar 2010 22:21:49 -0000	1.155
@@ -2614,9 +2614,8 @@
     gint i;
 
     /* save the general informations */
-    new_string = g_markup_printf_escaped ( "\t<Bet Ac=\"%d\" Ddte=\"%d\" Edte=\"%d\" "
+    new_string = g_markup_printf_escaped ( "\t<Bet Ddte=\"%d\" Edte=\"%d\" "
                         "Nbre=\"%d\" UT=\"%d\" SD=\"%d\" Fi=\"%d\" />\n",
-    etat.bet_last_account,
     etat.bet_deb_period,
     etat.bet_end_period,
     etat.bet_months,

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- navigation.c	23 Feb 2010 21:36:45 -0000	1.136
+++ navigation.c	3 Mar 2010 22:21:49 -0000	1.137
@@ -25,6 +25,7 @@
 
 /*START_INCLUDE*/
 #include "navigation.h"
+#include "./balance_estimate_data.h"
 #include "./balance_estimate_tab.h"
 #include "./gsb_account_property.h"
 #include "./gsb_calendar.h"
@@ -290,24 +291,24 @@
 		       NAVIGATION_SENSITIVE, 1,
 		       -1 );
 
-#ifdef ENABLE_BALANCE_ESTIMATE 
-    /* Balance estimate */
-    tmpstr = g_build_filename( PIXMAPS_DIR,
-			       "balance_estimate.png", NULL );
-    pixbuf = gdk_pixbuf_new_from_file ( tmpstr , NULL );
-    g_free ( tmpstr );
-    gtk_tree_store_append(GTK_TREE_STORE(navigation_model), &iter, NULL);
-    gtk_tree_store_set(GTK_TREE_STORE(navigation_model), &iter, 
-		       NAVIGATION_PIX, pixbuf,
-		       NAVIGATION_TEXT, _("Balance estimate"), 
-		       NAVIGATION_PIX_VISIBLE, TRUE, 
-		       NAVIGATION_FONT, 800,
-		       NAVIGATION_PAGE, GSB_BALANCE_ESTIMATE_PAGE,
-		       NAVIGATION_ACCOUNT, -1,
-		       NAVIGATION_REPORT, -1,
-		       NAVIGATION_SENSITIVE, 1,
-		       -1 );
-#endif /* ENABLE_BALANCE_ESTIMATE */
+//~ #ifdef ENABLE_BALANCE_ESTIMATE 
+    //~ /* Balance estimate */
+    //~ tmpstr = g_build_filename( PIXMAPS_DIR,
+			       //~ "balance_estimate.png", NULL );
+    //~ pixbuf = gdk_pixbuf_new_from_file ( tmpstr , NULL );
+    //~ g_free ( tmpstr );
+    //~ gtk_tree_store_append(GTK_TREE_STORE(navigation_model), &iter, NULL);
+    //~ gtk_tree_store_set(GTK_TREE_STORE(navigation_model), &iter, 
+		       //~ NAVIGATION_PIX, pixbuf,
+		       //~ NAVIGATION_TEXT, _("Balance estimate"), 
+		       //~ NAVIGATION_PIX_VISIBLE, TRUE, 
+		       //~ NAVIGATION_FONT, 800,
+		       //~ NAVIGATION_PAGE, GSB_BALANCE_ESTIMATE_PAGE,
+		       //~ NAVIGATION_ACCOUNT, -1,
+		       //~ NAVIGATION_REPORT, -1,
+		       //~ NAVIGATION_SENSITIVE, 1,
+		       //~ -1 );
+//~ #endif /* ENABLE_BALANCE_ESTIMATE */
 
 
     /* Categories */
@@ -969,7 +970,7 @@
     transaction_list_select ( gsb_data_account_get_current_transaction_number ( new_account ) );
     gsb_transactions_list_set_row_align ( gsb_data_account_get_row_align ( new_account ) );
 
-    /*     mise en place de la date du dernier relevé */
+    /* mise en place de la date du dernier relevé */
     gsb_navigation_update_statement_label ( new_account );
 
     gsb_gui_sensitive_menu_item ( "EditMenu", "MoveToAnotherAccount", 
@@ -1176,14 +1177,22 @@
 
 	    /* set the form */
 	    account_notebook = g_object_get_data ( G_OBJECT (notebook_general), "account_notebook" );
-	    if ( gtk_notebook_get_current_page ( GTK_NOTEBOOK (account_notebook )) == 1 )
-	    {
-		gsb_form_set_expander_visible ( FALSE, FALSE );
-	    }
-	    else
-	    {
-		gsb_form_set_expander_visible ( TRUE, TRUE );
-	    }
+        switch ( gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_notebook ) ) )
+        {
+        case 0:
+            gsb_form_set_expander_visible ( TRUE, TRUE );
+            break;
+
+        case 1:
+            gsb_form_set_expander_visible (FALSE, FALSE );
+            break;
+        case 2:
+        case 3:
+            gsb_form_set_expander_visible (FALSE, FALSE );
+            bet_array_update_estimate_tab ( );
+            break;
+
+        }
 	    gsb_form_show ( FALSE );
 
 	    buffer_last_account = account_number;
@@ -1225,18 +1234,18 @@
 		payee_fill_tree ();
 	    break;
 
-#ifdef ENABLE_BALANCE_ESTIMATE 
-	case GSB_BALANCE_ESTIMATE_PAGE:
-	    notice_debug ("Sold balance estimate page selected");
+//~ #ifdef ENABLE_BALANCE_ESTIMATE 
+	//~ case GSB_BALANCE_ESTIMATE_PAGE:
+	    //~ notice_debug ("Sold balance estimate page selected");
 
-	    /* set the title */
-	    title = g_strdup(_("Balance estimate"));
+	    //~ /* set the title */
+	    //~ title = g_strdup(_("Balance estimate"));
 
-	    /* what to be done if switch to that page */
-	    gsb_form_set_expander_visible (FALSE, FALSE);
-        bet_array_update_estimate_tab ( );
-	    break;
-#endif /*_BALANCE_ESTIMATE_TAB_H*/
+	    //~ /* what to be done if switch to that page */
+	    //~ gsb_form_set_expander_visible (FALSE, FALSE);
+        //~ bet_array_update_estimate_tab ( );
+	    //~ break;
+//~ #endif /*_BALANCE_ESTIMATE_TAB_H*/
 
 	case GSB_CATEGORIES_PAGE:
 	    notice_debug ("Category page selected");

Index: balance_estimate_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- balance_estimate_config.h	20 Feb 2010 08:54:00 -0000	1.2
+++ balance_estimate_config.h	3 Mar 2010 22:21:48 -0000	1.3
@@ -8,6 +8,12 @@
 
 /* START_DECLARATION */
 GtkWidget *bet_config_create_page ( void );
+void bet_config_duration_button_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *spin_button );
+gboolean bet_config_duration_number_changed ( GtkWidget *spin_button,
+                        GtkWidget *togglebutton );
+void bet_config_duration_period_clicked ( GtkWidget *togglebutton,
+                        GtkWidget *button );
 /* END_DECLARATION */
 
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- balance_estimate_tab.h	20 Feb 2010 08:54:00 -0000	1.9
+++ balance_estimate_tab.h	3 Mar 2010 22:21:49 -0000	1.10
@@ -26,7 +26,8 @@
 /* END_INCLUDE_H */
 
 /* START_DECLARATION */
-GtkWidget *bet_array_create_estimate_page ( void );
+GtkWidget * bet_array_create_page ( void );
+//~ GtkWidget *bet_array_create_estimate_page ( void );
 void bet_array_list_add_new_line ( GtkTreeModel *tab_model,
                         GtkTreeModel *model,
                         GtkTreeIter *iter,
@@ -34,9 +35,6 @@
                         GDate *date_max );
 void bet_array_refresh_estimate_tab ( void );
 void bet_array_update_estimate_tab ( void );
-gint bet_parameter_get_account_selected ( void );
-GtkWidget *bet_parameter_get_duration_widget ( GtkWidget *container, gboolean config );
-GtkWidget *bet_parameter_get_list_accounts ( GtkWidget *container );
 /* END_DECLARATION */
 
 #endif /*_BALANCE_ESTIMATE_TAB_H*/

Index: balance_estimate_hist.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- balance_estimate_hist.h	28 Feb 2010 08:40:57 -0000	1.4
+++ balance_estimate_hist.h	3 Mar 2010 22:21:48 -0000	1.5
@@ -49,7 +49,7 @@
 /* START_DECLARATION */
 gboolean bet_historical_affiche_div ( GHashTable  *list_div,
                         GtkWidget *tree_view );
-void bet_historical_create_page ( GtkWidget *notebook );
+GtkWidget * bet_historical_create_page ( void );
 void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data );
 gboolean bet_historical_fyear_create_combobox_store ( void );
 gint bet_historical_get_fyear_from_combobox ( GtkWidget *combo_box );

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- gsb_file_load.c	21 Feb 2010 20:48:38 -0000	1.208
+++ gsb_file_load.c	3 Mar 2010 22:21:49 -0000	1.209
@@ -3603,13 +3603,6 @@
         continue;
     }
 
-    if ( !strcmp ( attribute_names[i], "Ac" ) )
-    {
-        etat.bet_last_account = utils_str_atoi ( attribute_values[i] );
-        i++;
-        continue;
-    }
-
     if ( !strcmp ( attribute_names[i], "Ddte" ) )
     {
         etat.bet_deb_period = utils_str_atoi ( attribute_values[i] );

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- balance_estimate_tab.c	1 Mar 2010 22:22:53 -0000	1.47
+++ balance_estimate_tab.c	3 Mar 2010 22:21:48 -0000	1.48
@@ -40,6 +40,7 @@
 
 /*START_INCLUDE*/
 #include "balance_estimate_tab.h"
+#include "./balance_estimate_config.h"
 #include "./balance_estimate_data.h"
 #include "./balance_estimate_hist.h"
 #include "./utils_dates.h"
@@ -70,7 +71,7 @@
                         gint sub_div_nb,
                         gsb_real amount,
                         GtkTreeModel *model );
[...964 lines suppressed...]
-    tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_account_treeview" );
-    tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
-    model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
-
-    valid = gtk_tree_model_get_iter_first ( model, &iter );
-    while (valid)
-    {
-        gint number;
-
-        gtk_tree_model_get ( model, &iter, SPP_ACCOUNT_TREE_NUM_COLUMN, &number, -1 );
-        if ( number == account_nb )
-            break;
-        
-        valid = gtk_tree_model_iter_next ( model, &iter );
-    }
-    gtk_tree_selection_select_iter ( GTK_TREE_SELECTION ( tree_selection ), &iter );
+    return vbox;
 }
 
 

Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- balance_estimate_data.c	28 Feb 2010 22:10:26 -0000	1.11
+++ balance_estimate_data.c	3 Mar 2010 22:21:48 -0000	1.12
@@ -43,6 +43,7 @@
 #include "./gsb_scheduler.h"
 #include "./gsb_transactions_list_sort.h"
 #include "./main.h"
+#include "./navigation.h"
 #include "./include.h"
 #include "./structures.h"
 #include "./traitement_variables.h"
@@ -133,7 +134,7 @@
     gchar *key;
     gchar *sub_key;
     struct_hist_div *shd;
-printf ("account_nb = %d, div_number = %d, sub_div_nb = %d\n", account_nb, div_number, sub_div_nb);
+//~ printf ("account_nb = %d, div_number = %d, sub_div_nb = %d\n", account_nb, div_number, sub_div_nb);
     if ( account_nb == 0 )
         key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
     else
@@ -591,7 +592,7 @@
     gint selected_account;
     gint currency_number;
 
-    selected_account = bet_parameter_get_account_selected ( );
+    selected_account = gsb_gui_navigation_get_current_account ( );
     if ( selected_account == -1 )
         return 0;
 
@@ -679,14 +680,12 @@
 {
     GPtrArray *tab = NULL;
     gchar *tmp_str = NULL;
-    //~ gchar *str_amount;
     GHashTableIter iter;
     gpointer key, value;
 
     if ( g_hash_table_size ( bet_hist_div_list ) == 0 )
         return NULL;
 
-    //~ printf ("long bet_hist_div_list = %d\n", g_hash_table_size ( bet_hist_div_list ));
     tab = g_ptr_array_new ( );
 
     g_hash_table_iter_init ( &iter, bet_hist_div_list );
@@ -696,9 +695,6 @@
 
         if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
         {
-            //~ str_amount = gsb_real_save_real_to_string ( shd -> amount, 2 );
-            //~ printf ("amount.mantissa = %ld amount.exponent = %d str_amount = %s\n",
-                    //~ shd -> amount.mantissa, shd -> amount.exponent, str_amount );
             tmp_str = g_markup_printf_escaped ( "\t<Bet_historical Nb=\"%d\" Ac=\"%d\" "
                         "Div=\"%d\" Edit=\"%d\" Damount=\"%s\" SDiv=\"%d\" "
                         "SEdit=\"%d\" SDamount=\"%s\" />\n",
@@ -715,7 +711,6 @@
         {
             GHashTableIter new_iter;
 
-            //~ printf ("long shd -> sub_div_list = %d\n", g_hash_table_size ( shd -> sub_div_list ));
             g_hash_table_iter_init ( &new_iter, shd -> sub_div_list );
             while ( g_hash_table_iter_next ( &new_iter, &key, &value ) )
             {
@@ -737,7 +732,7 @@
             }
         }
     }
-    //~ printf ("long_tab = %d\n", tab -> len);
+
     return tab;
 }
 

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- balance_estimate_hist.c	1 Mar 2010 22:22:53 -0000	1.11
+++ balance_estimate_hist.c	3 Mar 2010 22:21:48 -0000	1.12
@@ -56,6 +56,7 @@
 #include "./gsb_transactions_list_sort.h"
 #include "./main.h"
 #include "./mouse.h"
+#include "./navigation.h"
 #include "./include.h"
 #include "./structures.h"
 #include "./traitement_variables.h"
@@ -96,7 +97,7 @@
 
 /*START_EXTERN*/
 extern gboolean balances_with_scheduled;
-extern GtkWidget *bet_container;
+extern GtkWidget *notebook_general;
 extern gsb_real null_real;
 extern GtkWidget *window;
 /*END_EXTERN*/
@@ -120,8 +121,9 @@
  *
  *
  * */
-void bet_historical_create_page ( GtkWidget *notebook )
+GtkWidget * bet_historical_create_page ( void )
 {
+    GtkWidget *notebook;
     GtkWidget *widget;
     GtkWidget *page;
     GtkWidget *vbox;
@@ -133,12 +135,9 @@
     gint year;
 
     devel_debug (NULL);
-    widget = gtk_label_new( _("Historical data") );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
     page = gtk_vbox_new ( FALSE, 5 );
 
-    gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ),
-                        GTK_WIDGET ( page ), GTK_WIDGET ( widget ) );
-
     /* titre de la page */
     hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( page ), hbox, FALSE, FALSE, 15 );
@@ -150,11 +149,12 @@
     vbox = gtk_vbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( hbox ), vbox, FALSE, FALSE, 5) ;
 
-    widget = gtk_label_new ( NULL );
+    widget = gtk_label_new ( "bet_hist_title" );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_hist_title", widget);
     title = g_strdup_printf (
                         _("Please select the data source for the account: \"%s\""),
                         gsb_data_account_get_name (
-                        bet_parameter_get_account_selected ( ) ) );
+                        gsb_gui_navigation_get_current_account ( ) ) );
     gtk_label_set_markup ( GTK_LABEL ( widget ), title );
     g_free ( title );
     gtk_box_pack_start ( GTK_BOX ( vbox ), widget, FALSE, FALSE, 5 );
@@ -162,7 +162,7 @@
     /* Choix des données sources */
     hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( vbox ), hbox, FALSE, FALSE, 15 );
-    g_object_set_data ( G_OBJECT ( bet_container ), "bet_historical_data", hbox );
+    g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_data", hbox );
 
     button_1 = gtk_radio_button_new_with_label ( NULL,
                         _("Categories") );
@@ -233,6 +233,8 @@
     g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_treeview", tree_view );
 
     gtk_widget_show_all ( page );
+
+    return page;
 }
 
 
@@ -244,15 +246,17 @@
  * */
 void bet_historical_origin_data_clicked ( GtkWidget *togglebutton, gpointer data )
 {
+    GtkWidget *notebook;
     GtkWidget *ancestor;
     GtkWidget *widget;
     GtkTreeViewColumn *column;
     const gchar *name;
     gchar *title;
 
-    devel_debug (NULL);
     name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
-    ancestor = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_data" );
+    //~ devel_debug (name);
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_data" );
     if ( gtk_widget_is_ancestor ( togglebutton, ancestor ) == FALSE )
     {
         widget = utils_get_child_widget_by_name ( ancestor, name );
@@ -273,15 +277,14 @@
         title = g_strdup ( _("Budgetary line") );
     }
 
-    column = g_object_get_data ( G_OBJECT ( bet_container ),
+    column = g_object_get_data ( G_OBJECT ( notebook ),
                         "historical_column_source" );
     gtk_tree_view_column_set_title ( GTK_TREE_VIEW_COLUMN ( column ), title );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_historical_populate_data ( );
-    bet_array_refresh_estimate_tab ( );
+    bet_array_update_estimate_tab ( );
 }
 
 
@@ -293,15 +296,17 @@
  * */
 void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data )
 {
+    GtkWidget *notebook;
     GtkWidget *ancestor;
     GtkWidget *widget;
     const gchar *name;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     etat.bet_hist_fyear = bet_historical_get_fyear_from_combobox ( combo );
 
     name = gtk_widget_get_name ( GTK_WIDGET ( combo ) );
-    ancestor = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_data" );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    ancestor = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_data" );
     if ( gtk_widget_is_ancestor ( combo, ancestor ) == FALSE )
     {
         widget = utils_get_child_widget_by_name ( ancestor, name );
@@ -318,8 +323,7 @@
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
-    bet_historical_populate_data ( );
-    bet_array_refresh_estimate_tab ( );
+    bet_array_update_estimate_tab ( );
 }
 
 
@@ -335,7 +339,7 @@
 {
     GtkTreeIter iter;
 
-    devel_debug (path_string);
+    //~ devel_debug (path_string);
     if ( gtk_tree_model_get_iter_from_string ( GTK_TREE_MODEL ( model ), &iter, path_string ) )
     {
         gchar *str_amount;
@@ -478,8 +482,7 @@
     GtkTreeModel *model;
     GtkTreeIter iter;
 
-    devel_debug (new_text);
-    
+    //~ devel_debug (new_text);
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
     if ( gtk_tree_model_get_iter_from_string ( GTK_TREE_MODEL ( model ), &iter, path_string ) )
     {
@@ -564,6 +567,7 @@
  * */
 GtkWidget *bet_historical_get_data ( GtkWidget *container )
 {
+    GtkWidget *notebook;
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
     GtkTreeStore *tree_model;
@@ -573,6 +577,7 @@
     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);
 
@@ -633,7 +638,7 @@
                         cell,
                         "text", SPP_HISTORICAL_DESC_COLUMN,
                         NULL);
-    g_object_set_data ( G_OBJECT ( bet_container ), "historical_column_source",
+    g_object_set_data ( G_OBJECT ( notebook ), "historical_column_source",
                         column );
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
                         GTK_TREE_VIEW_COLUMN ( column ) );
@@ -728,6 +733,7 @@
  * */
 void bet_historical_populate_data ( void )
 {
+    GtkWidget *notebook;
     GtkWidget *tree_view;
     GtkWidget *combo;
     GtkTreeModel *model;
@@ -740,11 +746,12 @@
 
     //~ devel_debug (NULL);
     /* récuperation du n° de compte à utiliser */
-    selected_account = bet_parameter_get_account_selected ( );
+    selected_account = gsb_gui_navigation_get_current_account ( );
     if ( selected_account == -1 )
         return;
 
-    tree_view = g_object_get_data (G_OBJECT ( bet_container ), "bet_historical_treeview" );
+    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 )
         return;
 
@@ -752,7 +759,7 @@
     gtk_tree_store_clear ( GTK_TREE_STORE ( model ) );
 
     /* calculate date_min and date_max */
-    combo = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_fyear" );
+    combo = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_fyear" );
     fyear_number = bet_historical_get_fyear_from_combobox ( combo );
     if ( fyear_number == 0 )
     {
@@ -760,14 +767,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 ( bet_container ), "bet_historical_period",
+        g_object_set_data ( G_OBJECT ( notebook ), "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 ( bet_container ), "bet_historical_period",
+        g_object_set_data ( G_OBJECT ( notebook ), "bet_historical_period",
                 g_strdup ( gsb_data_fyear_get_name ( fyear_number ) ) );
     }
     list_div = g_hash_table_new_full ( g_str_hash,
@@ -844,6 +851,7 @@
                         gpointer value,
                         gpointer user_data )
 {
+    GtkWidget *notebook;
     SH *sh = ( SH* ) value;
     SBR *sbr = sh -> sbr;
     GtkTreeView *tree_view = ( GtkTreeView * ) user_data;
@@ -870,7 +878,8 @@
     div_name = bet_data_get_div_name ( div_number, 0, FALSE );
     account_nb = sh -> account_nb;
 
-    titre = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_period" );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    titre = g_object_get_data ( G_OBJECT ( notebook ), "bet_historical_period" );
 
     model = gtk_tree_view_get_model ( tree_view );
 
@@ -1102,13 +1111,15 @@
                         GDate *date_min,
                         GDate *date_max )
 {
+    GtkWidget *notebook;
     GtkWidget *tree_view;
     GtkTreeModel *model;
     GtkTreeIter iter;
     GtkTreeIter fils_iter;
 
     //~ devel_debug (NULL);
-    tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_treeview" );
+    notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+    tree_view = g_object_get_data ( G_OBJECT ( notebook ), "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 ) )
@@ -1233,7 +1244,9 @@
 
     if ( edited )
     {
-        tree_view = g_object_get_data ( G_OBJECT ( bet_container ),
+        tree_view = g_object_get_data ( G_OBJECT (
+                        g_object_get_data ( G_OBJECT ( notebook_general ),
+                        "account_notebook") ),
                         "bet_historical_treeview" );
         gtk_tree_view_collapse_row ( tree_view,
                         gtk_tree_model_get_path ( model, parent ) );
@@ -1375,7 +1388,8 @@
                         GtkTreeModel *model )
 {
     if ( tree_view == NULL )
-        tree_view = g_object_get_data ( G_OBJECT ( bet_container ),
+        tree_view = g_object_get_data ( G_OBJECT (
+                g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook") ),
                 "bet_historical_treeview" );
     gtk_tree_view_collapse_row ( tree_view,
                 gtk_tree_model_get_path ( model, iter ) );



More information about the cvs mailing list