[grisbi-cvs] grisbi/src balance_estimate_config.c, 1.10, 1.11 balance_estimate_config.h, 1.3, 1.4 balance_estimate_data.c, 1.12, 1.13 balance_estimate_data.h, 1.9, 1.10 balance_estimate_hist.c, 1.14, 1.15 balance_estimate_hist.h, 1.6, 1.7 balance_estimate_tab.c, 1.51, 1.52 categories_onglet.c, 1.203, 1.204 fenetre_principale.c, 1.128, 1.129 gsb_data_account.c, 1.99, 1.100 gsb_data_transaction.c, 1.82, 1.83 gsb_file_config.c, 1.91, 1.92 gsb_file_load.c, 1.212, 1.213 gsb_file_save.c, 1.158, 1.159 import.c, 1.324, 1.325 main.c, 1.166, 1.167 navigation.c, 1.140, 1.141 parametres.c, 1.212, 1.213 structures.h, 1.242, 1.243 traitement_variables.c, 1.190, 1.191 utils.c, 1.61, 1.62
Pierre Biava
pbiava at users.sourceforge.net
Sat Mar 13 22:07:00 CET 2010
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.100, 1.101 da.po, 1.106, 1.107 de.po, 1.180, 1.181 el.po, 1.70, 1.71 eo.po, 1.63, 1.64 es.po, 1.176, 1.177 fa.po, 1.93, 1.94 fr.po, 1.239, 1.240 grisbi.pot, 1.141, 1.142 he.po, 1.99, 1.100 it.po, 1.99, 1.100 nl.po, 1.98, 1.99 pl.po, 1.104, 1.105 pt_BR.po, 1.101, 1.102 ro.po, 1.100, 1.101 ru.po, 1.98, 1.99 zh_CN.po, 1.94, 1.95
- Next message: [grisbi-cvs] grisbi/src balance_estimate_hist.c, 1.15, 1.16 gsb_file_config.c, 1.92, 1.93 main.c, 1.167, 1.168 structures.h, 1.243, 1.244
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22914/src
Modified Files:
balance_estimate_config.c balance_estimate_config.h
balance_estimate_data.c balance_estimate_data.h
balance_estimate_hist.c balance_estimate_hist.h
balance_estimate_tab.c categories_onglet.c
fenetre_principale.c gsb_data_account.c gsb_data_transaction.c
gsb_file_config.c gsb_file_load.c gsb_file_save.c import.c
main.c navigation.c parametres.c structures.h
traitement_variables.c utils.c
Log Message:
Moving the module budgetary in the accounts's pages and fixes several bugs.
Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- structures.h 8 Mar 2010 21:30:01 -0000 1.242
+++ structures.h 13 Mar 2010 21:06:58 -0000 1.243
@@ -13,7 +13,7 @@
#define VERSION_FICHIER "0.6.0"
/* Define this when in CVS development branch. */
-#define IS_DEVELOPMENT_VERSION (1)
+#define IS_DEVELOPMENT_VERSION 1
#define VERSION_FICHIER_ETAT "0.6.0"
#define VERSION_FICHIER_CATEG "0.6.0"
@@ -113,10 +113,6 @@
/* variables for the module estimate balance */
gint bet_deb_period;
- gint bet_spin_range;
- gint bet_months;
- gint bet_hist_data;
- gint bet_hist_fyear;
} etat;
Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- gsb_data_transaction.c 5 Mar 2010 22:18:55 -0000 1.82
+++ gsb_data_transaction.c 13 Mar 2010 21:06:58 -0000 1.83
@@ -47,6 +47,7 @@
#include "./include.h"
#include "./structures.h"
#include "./gsb_real.h"
+#include "./balance_estimate_data.h"
/*END_INCLUDE*/
@@ -2304,8 +2305,13 @@
complete_transactions_list = g_slist_remove ( complete_transactions_list,
transaction );
-
gsb_data_transaction_free (transaction);
+
+#ifdef ENABLE_BALANCE_ESTIMATE
+ /* force the update module budget */
+ bet_data_set_maj ( TRUE );
+#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.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- balance_estimate_config.c 8 Mar 2010 21:30:00 -0000 1.10
+++ balance_estimate_config.c 13 Mar 2010 21:06:58 -0000 1.11
@@ -33,6 +33,7 @@
#include "./balance_estimate_data.h"
#include "./balance_estimate_hist.h"
#include "./balance_estimate_tab.h"
+#include "./gsb_account.h"
#include "./parametres.h"
#include "./menu.h"
#include "./utils.h"
@@ -69,10 +70,13 @@
/*START_STATIC*/
-static void bet_config_fyear_clicked ( GtkWidget *combo, gpointer data );
+static gboolean bet_config_change_account ( GtkWidget *combo,
+ gpointer null );
static GtkWidget *bet_config_get_duration_widget ( GtkWidget *container );
+static GtkWidget *bet_config_get_period_widget ( GtkWidget *container );
static GtkWidget *bet_config_select_historical_data ( GtkWidget *container );
-static void bet_config_origin_data_clicked ( GtkWidget *togglebutton, gpointer data );
+static void bet_config_period_clicked ( GtkWidget *togglebutton,
+ GtkWidget *button );
/*END_STATIC*/
/*START_EXTERN*/
@@ -98,25 +102,59 @@
GtkWidget *bet_config_create_page ( void )
{
- GtkWidget *vbox_pref, *paddingbox;
+ GtkWidget *notebook;
+ GtkWidget *vbox_pref;
+ GtkWidget *hbox;
+ GtkWidget *combo;
+ GtkWidget *paddingbox;
+ GtkWidget *label;
+ GtkWidget *widget;
+ notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
- vbox_pref = new_vbox_with_title_and_icon ( _("Balance estimate"),
+ vbox_pref = new_vbox_with_title_and_icon ( _("Accounts data"),
"balance_estimate.png" );
-
+ gtk_container_set_border_width ( GTK_CONTAINER ( vbox_pref ), 12 );
+
/* Calculation of period */
paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
- _("Calculation of period") );
+ _("Common data") );
- bet_config_get_duration_widget ( paddingbox );
+ widget = bet_config_get_period_widget ( paddingbox );
+ g_object_set_data ( G_OBJECT ( notebook ), "period_widget", widget );
- /* Sources of historical data */
+ /* add a separator */
+ gtk_box_pack_start ( GTK_BOX ( vbox_pref ), gtk_hseparator_new (), FALSE, FALSE, 5 );
+
+ /* set the choice of account */
paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
- _("Sources of historical data") );
- bet_config_select_historical_data ( paddingbox );
+ _("Data Per Account") );
+
+ hbox = gtk_hbox_new ( FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 5 );
+
+ label = gtk_label_new (COLON(_("Account")));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
+ gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
+ gtk_box_pack_start ( GTK_BOX (hbox ), label, FALSE, FALSE, 0 );
+
+ combo = gsb_account_create_combo_list ( (GtkSignalFunc) bet_config_change_account,
+ NULL, FALSE );
+ gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo ), 0 );
+ gtk_box_pack_start ( GTK_BOX (hbox ), combo, FALSE, FALSE, 0 );
+
+ /* Calculation of duration */
+ widget = bet_config_get_duration_widget ( paddingbox );
+ g_object_set_data ( G_OBJECT ( notebook ), "duration_widget", widget );
+
+ /* Sources of historical data */
+ widget = bet_config_select_historical_data ( paddingbox );
+ g_object_set_data ( G_OBJECT ( notebook ), "historical_data", widget );
gtk_widget_show_all ( vbox_pref );
+ bet_config_change_account ( combo, NULL );
+
return vbox_pref;
}
@@ -127,35 +165,25 @@
*
*
* */
-GtkWidget *bet_config_get_duration_widget ( GtkWidget *container )
+GtkWidget *bet_config_get_period_widget ( GtkWidget *container )
{
- GtkWidget* main_vbox;
+ GtkWidget *main_vbox;
GtkWidget *label;
GtkWidget *button_1, *button_2;
- 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) ;
+ 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) ;
- label = gtk_label_new (
- _("Note: This option is used if no starting date for forecasts.") );
- 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) ;
@@ -177,17 +205,50 @@
gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
-
/*set the signals */
g_signal_connect (G_OBJECT ( button_1 ),
"released",
- G_CALLBACK ( bet_config_duration_period_clicked ),
+ G_CALLBACK ( bet_config_period_clicked ),
NULL );
g_signal_connect (G_OBJECT ( button_2 ),
"released",
- G_CALLBACK ( bet_config_duration_period_clicked ),
+ G_CALLBACK ( bet_config_period_clicked ),
NULL );
+ label = gtk_label_new (
+ _("Note: This option is used if no starting date for forecasts.") );
+ 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) ;
+
+
+ gtk_widget_show_all ( main_vbox );
+
+ return main_vbox;
+}
+
+/**
+ *
+ *
+ *
+ *
+ * */
+GtkWidget *bet_config_get_duration_widget ( GtkWidget *container )
+{
+ GtkWidget* main_vbox;
+ GtkWidget *label;
+ GtkWidget *spin_button = NULL;
+ GtkWidget *widget = NULL;
+ GtkWidget *hbox;
+ GtkWidget *previous = NULL;
+ GtkSizeGroup *size_group;
+ gint iduration;
+
+ 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);
+
/* partie mensuelle */
label = gtk_label_new ( _("Duration estimation") );
gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0.5);
@@ -197,19 +258,10 @@
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 ) );
- }
+ 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, 5 );
for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
{
@@ -233,17 +285,13 @@
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 );
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
g_signal_connect ( G_OBJECT ( spin_button ),
"value-changed",
G_CALLBACK ( bet_config_duration_number_changed ),
widget );
- gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
-
+
gtk_widget_show_all ( main_vbox );
return main_vbox;
@@ -258,15 +306,25 @@
* */
GtkWidget *bet_config_select_historical_data ( GtkWidget *container )
{
+ GtkWidget *main_vbox;
+ GtkWidget *label;
GtkWidget *widget;
GtkWidget *hbox;
GtkWidget *button_1, *button_2;
gchar *str_year;
gint year;
+ main_vbox = gtk_vbox_new ( FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX ( container ), main_vbox, FALSE, FALSE, 5);
+
+ label = gtk_label_new ( _("Sources of historical data") );
+ 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) ;
+
/* Choix des données sources */
hbox = gtk_hbox_new ( FALSE, 5 );
- gtk_box_pack_start ( GTK_BOX ( container ), hbox, FALSE, FALSE, 15 );
+ gtk_box_pack_start ( GTK_BOX ( main_vbox ), hbox, FALSE, FALSE, 15 );
button_1 = gtk_radio_button_new_with_label ( NULL,
_("Categories") );
@@ -301,16 +359,7 @@
gsb_fyear_hide_iter_by_name ( bet_fyear_model, str_year );
g_free ( str_year );
- /* show the old choice */
- if ( etat.bet_hist_fyear > 0 )
- {
- gsb_fyear_select_iter_by_number ( widget,
- bet_fyear_model,
- bet_fyear_model_filter,
- etat.bet_hist_fyear );
- }
-
- //~ /* set the signal */
+ /* set the signal */
g_signal_connect ( G_OBJECT ( widget ),
"changed",
G_CALLBACK ( bet_config_fyear_clicked ),
@@ -326,13 +375,13 @@
* 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 )
+void bet_config_period_clicked ( GtkWidget *togglebutton, GtkWidget *button )
{
const gchar *name;
if ( button )
g_signal_handlers_block_by_func ( G_OBJECT ( button ),
- G_CALLBACK ( bet_config_duration_period_clicked ),
+ G_CALLBACK ( bet_config_period_clicked ),
button );
name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
@@ -347,7 +396,7 @@
}
if ( button )
g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
- G_CALLBACK ( bet_config_duration_period_clicked ),
+ G_CALLBACK ( bet_config_period_clicked ),
button );
if ( etat.modification_fichier == 0 )
@@ -365,30 +414,38 @@
GtkWidget *spin_button )
{
const gchar *name;
+ gint account_number;
+ gint months;
name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+ account_number = gsb_gui_navigation_get_current_account ( );
if ( g_strcmp0 ( name, "Year" ) == 0 )
{
- etat.bet_spin_range = 1;
+ gsb_data_account_set_bet_spin_range ( account_number, 1 );
gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
- if ( etat.bet_months > 20 )
+ months = gsb_data_account_get_bet_months ( account_number );
+ if ( months > 20 )
{
gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20.0 );
- etat.bet_months = 240;
+ gsb_data_account_set_bet_months ( account_number, 240 );
}
else
- etat.bet_months *= 12;
+ gsb_data_account_set_bet_months ( account_number, months * 12 );
}
else
{
- etat.bet_spin_range = 0;
- etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+ 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 (
+ 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 ( );
}
@@ -399,16 +456,18 @@
* the bet container
*/
gboolean bet_config_duration_number_changed ( GtkWidget *spin_button,
- GtkWidget *togglebutton )
+ gpointer data )
{
- gboolean toggled;
+ gint account_number;
+ gint months;
- //~ devel_debug (NULL);
- etat.bet_months = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ) );
+ account_number = gsb_gui_navigation_get_current_account ( );
- toggled = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( togglebutton ) );
- if ( toggled == 1 )
- etat.bet_months *= 12;
+ 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;
+
+ gsb_data_account_set_bet_months ( account_number, months );
if ( etat.modification_fichier == 0 )
modification_fichier ( TRUE );
@@ -427,20 +486,38 @@
* */
void bet_config_origin_data_clicked ( GtkWidget *togglebutton, gpointer data )
{
+ GtkWidget *notebook;
+ GtkTreeViewColumn *column;
const gchar *name;
+ gchar *title;
+ gint account_number;
+ account_number = gsb_gui_navigation_get_current_account ( );
name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
+ //~ devel_debug (name);
+ notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+
if ( g_strcmp0 ( name, "button_1" ) == 0 )
{
- etat.bet_hist_data = 0;
+ gsb_data_account_set_bet_hist_data ( account_number, 0 );
+ bet_data_set_div_ptr ( 0 );
+ title = g_strdup ( _("Category") );
}
else
{
- etat.bet_hist_data = 1;
+ gsb_data_account_set_bet_hist_data ( account_number, 1 );
+ bet_data_set_div_ptr ( 1 );
+ title = g_strdup ( _("Budgetary line") );
}
+ 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_array_update_estimate_tab ( );
}
@@ -452,7 +529,11 @@
* */
void bet_config_fyear_clicked ( GtkWidget *combo, gpointer data )
{
- etat.bet_hist_fyear = bet_historical_get_fyear_from_combobox ( combo );
+ gint account_number;
+
+ account_number = gsb_gui_navigation_get_current_account ( );
+ gsb_data_account_set_bet_hist_fyear ( account_number,
+ bet_historical_get_fyear_from_combobox ( combo ) );
if ( etat.modification_fichier == 0 )
modification_fichier ( TRUE );
@@ -461,6 +542,103 @@
}
+/**
+ *
+ *
+ *
+ *
+ * */
+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
+ *
+ * \param button
+ * \param null
+ *
+ * \return FALSE
+ * */
+gboolean bet_config_change_account ( GtkWidget *combo,
+ gpointer null )
+{
+ GtkWidget *notebook;
+ GtkWidget *ancestor;
+ GtkWidget *widget;
+ GtkWidget *button;
+ gint account_number;
+ gint param;
+ gint months;
+
+ 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" );
+
+ if ( param == 1 )
+ {
+ widget = utils_get_child_widget_by_name ( ancestor, "Year" );
+ 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 );
+ }
+ else
+ {
+ widget = utils_get_child_widget_by_name ( ancestor, "Month" );
+ 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 ),
+ (gdouble) months );
+ }
+
+ ancestor = g_object_get_data ( G_OBJECT ( notebook ), "historical_data" );
+
+ param = gsb_data_account_get_bet_hist_data ( account_number );
+
+ if ( param == 1 )
+ button = utils_get_child_widget_by_name ( ancestor, "button_2" );
+ else
+ button = utils_get_child_widget_by_name ( ancestor, "button_1" );
+
+ 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" );
+ bet_historical_set_fyear_from_combobox ( widget, param );
+
+ return FALSE;
+}
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- parametres.c 8 Mar 2010 21:30:01 -0000 1.212
+++ parametres.c 13 Mar 2010 21:06:58 -0000 1.213
@@ -540,7 +540,7 @@
gtk_tree_store_append (GTK_TREE_STORE (preference_tree_model), &iter2, &iter);
gtk_tree_store_set (GTK_TREE_STORE (preference_tree_model),
&iter2,
- 0, _("General options"),
+ 0, _("Accounts data"),
1, BET_GENERAL_PAGE,
2, 400,
-1);
Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- traitement_variables.c 8 Mar 2010 21:30:01 -0000 1.190
+++ traitement_variables.c 13 Mar 2010 21:06:58 -0000 1.191
@@ -383,10 +383,6 @@
bet_data_init_variables ( );
#endif /* ENABLE_BALANCE_ESTIMATE */
etat.bet_deb_period = 1;
- etat.bet_spin_range = 0;
- etat.bet_months = 1;
- etat.bet_hist_data = 0;
- etat.bet_hist_fyear = 0;
}
Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- gsb_file_save.c 8 Mar 2010 21:30:01 -0000 1.158
+++ gsb_file_save.c 13 Mar 2010 21:06:58 -0000 1.159
@@ -1055,9 +1055,8 @@
"\t\tForm_lines_number=\"%d\"\n"
"\t\tForm_organization=\"%s\"\n"
"\t\tForm_columns_width=\"%s\"\n"
- "\t\tBet_Ddte=\"%d\"\n"
"\t\tBet_start_date=\"%s\"\n"
- "\t\tBet_Nbre=\"%d\"\n"
+ "\t\tBet_months=\"%d\"\n"
"\t\tBet_UT=\"%d\"\n"
"\t\tBet_SD=\"%d\"\n"
"\t\tBet_Fi=\"%d\" />\n",
@@ -1094,7 +1093,6 @@
gsb_data_form_get_nb_rows (account_number),
my_safe_null_str(form_organization),
my_safe_null_str(form_columns_width),
- gsb_data_account_get_bet_deb_period ( account_number ),
my_safe_null_str ( gsb_format_gdate_safe (
gsb_data_account_get_bet_start_date ( account_number ) ) ),
gsb_data_account_get_bet_months ( account_number ),
@@ -2636,13 +2634,7 @@
gint i;
/* save the general informations */
- new_string = g_markup_printf_escaped ( "\t<Bet Ddte=\"%d\" "
- "Nbre=\"%d\" UT=\"%d\" SD=\"%d\" Fi=\"%d\" />\n",
- etat.bet_deb_period,
- etat.bet_months,
- etat.bet_spin_range,
- etat.bet_hist_data,
- etat.bet_hist_fyear );
+ new_string = g_markup_printf_escaped ( "\t<Bet Ddte=\"%d\" />\n", etat.bet_deb_period );
/* append the new string to the file content */
iterator = gsb_file_save_append_part ( iterator,
Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- balance_estimate_data.h 28 Feb 2010 22:10:26 -0000 1.9
+++ balance_estimate_data.h 13 Mar 2010 21:06:58 -0000 1.10
@@ -64,6 +64,7 @@
GHashTable *list_div );
gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
gboolean bet_data_search_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
+void bet_data_select_bet_pages ( gint account_number );
gboolean bet_data_set_div_amount ( gint account_nb,
gint div_number,
gint sub_div_nb,
Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- navigation.c 8 Mar 2010 21:30:01 -0000 1.140
+++ navigation.c 13 Mar 2010 21:06:58 -0000 1.141
@@ -994,6 +994,10 @@
gsb_file_update_window_title ( );
}
+#ifdef ENABLE_BALANCE_ESTIMATE
+ bet_data_select_bet_pages ( new_account );
+#endif /* ENABLE_BALANCE_ESTIMATE */
+
/* unset the last date written */
gsb_date_free_last_date ();
Index: utils.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- utils.c 8 Mar 2010 21:30:01 -0000 1.61
+++ utils.c 13 Mar 2010 21:06:58 -0000 1.62
@@ -509,7 +509,7 @@
if ( tmp_str && g_strcmp0 ( name, tmp_str ) == 0 )
return widget;
- if ( GTK_IS_CONTAINER ( widget ) )
+ if ( GTK_IS_CONTAINER ( widget ) == TRUE )
{
widget = utils_get_child_widget_by_name ( widget, name );
if ( widget )
Index: balance_estimate_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_config.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- balance_estimate_config.h 3 Mar 2010 22:21:48 -0000 1.3
+++ balance_estimate_config.h 13 Mar 2010 21:06:58 -0000 1.4
@@ -11,9 +11,13 @@
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 );
+ gpointer data );
+void bet_config_fyear_clicked ( GtkWidget *combo, gpointer data );
+void bet_config_origin_data_clicked ( GtkWidget *togglebutton, gpointer data );
+gboolean bet_config_set_property_widget_mirror ( GtkWidget *widget,
+ gchar *ancestor_name,
+ gint widget_type,
+ gboolean value );
/* END_DECLARATION */
Index: categories_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/categories_onglet.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -d -r1.203 -r1.204
--- categories_onglet.c 14 Feb 2010 17:48:49 -0000 1.203
+++ categories_onglet.c 13 Mar 2010 21:06:58 -0000 1.204
@@ -41,6 +41,7 @@
#include "./gsb_transactions_list.h"
#include "./metatree.h"
#include "./structures.h"
+#include "./traitement_variables.h"
#include "./include.h"
#include "./erreur.h"
/*END_INCLUDE*/
@@ -781,6 +782,10 @@
/* update the transactions list */
transaction_list_update_element (ELEMENT_CATEGORY);
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+
return TRUE;
}
Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- fenetre_principale.c 8 Mar 2010 21:30:00 -0000 1.128
+++ fenetre_principale.c 13 Mar 2010 21:06:58 -0000 1.129
@@ -307,12 +307,11 @@
gsb_form_set_expander_visible ( TRUE, TRUE );
break;
-#ifdef ENABLE_BALANCE_ESTIMATE
case 1:
case 2:
- gsb_form_set_expander_visible (FALSE, FALSE );
- bet_array_update_estimate_tab ( );
- break;
+#ifdef ENABLE_BALANCE_ESTIMATE
+ if ( bet_data_get_maj ( ) )
+ bet_array_update_estimate_tab ( );
#endif /* ENABLE_BALANCE_ESTIMATE */
case 3:
gsb_form_set_expander_visible (FALSE, FALSE );
Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- import.c 5 Mar 2010 22:18:55 -0000 1.324
+++ import.c 13 Mar 2010 21:06:58 -0000 1.325
@@ -2020,7 +2020,10 @@
{
/* the id exists with the same account_nb, so the transaction is already
* in grisbi we will forget that transaction */
- imported_transaction -> action = IMPORT_TRANSACTION_LEAVE_TRANSACTION;
+ if ( g_date_get_year ( imported_transaction -> date ) == g_date_get_year (
+ gsb_data_transaction_get_date ( transaction_no ) ) )
+
+ imported_transaction -> action = IMPORT_TRANSACTION_LEAVE_TRANSACTION;
}
/* if no id, check the cheque */
Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- gsb_data_account.c 7 Mar 2010 15:56:04 -0000 1.99
+++ gsb_data_account.c 13 Mar 2010 21:06:58 -0000 1.100
@@ -118,7 +118,6 @@
/** @name bet data */
GDate *bet_start_date; /* date de début */
- gint bet_deb_period; /* définition de la période 1 = premier jour du mois, 2 date jour */
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_hist_data; /* origine des données catégories ou IB */
@@ -730,7 +729,7 @@
account = gsb_data_account_get_structure ( account_number );
- if (!account )
+ if ( !account )
return 0;
return account -> account_kind;
@@ -2921,7 +2920,10 @@
if (!account )
return 0;
- return account -> bet_months;
+ if ( account -> bet_months == 0 )
+ return 1;
+ else
+ return account -> bet_months;
}
@@ -3021,42 +3023,6 @@
}
-/**
- *
- *
- *
- * */
-gint gsb_data_account_get_bet_deb_period ( gint account_number )
-{
- struct_account *account;
-
- account = gsb_data_account_get_structure ( account_number );
-
- if (!account )
- return 0;
-
- return account -> bet_deb_period;
-}
-
-
-/**
- *
- *
- *
- * */
-gboolean gsb_data_account_set_bet_deb_period ( gint account_number, gint deb_period )
-{
- struct_account *account;
-
- account = gsb_data_account_get_structure ( account_number );
-
- if (!account )
- return FALSE;
-
- account -> bet_deb_period = deb_period;
-
- return TRUE;
-}
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: balance_estimate_hist.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- balance_estimate_hist.h 8 Mar 2010 21:30:00 -0000 1.6
+++ balance_estimate_hist.h 13 Mar 2010 21:06:58 -0000 1.7
@@ -43,6 +43,7 @@
SPP_HISTORICAL_DIV_NUMBER,
SPP_HISTORICAL_SUB_DIV_NUMBER,
SPP_HISTORICAL_EDITED_COLUMN,
+ SPP_HISTORICAL_BACKGROUND_COLOR,
SPP_HISTORICAL_NUM_COLUMNS
};
@@ -58,6 +59,7 @@
void bet_historical_refresh_data ( GtkTreeModel *tab_model,
GDate *date_min,
GDate *date_max );
+void bet_historical_set_fyear_from_combobox ( GtkWidget *combo_box, gint fyear );
/* END_DECLARATION */
#endif /*_BALANCE_ESTIMATE_HIST_H*/
Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- gsb_file_load.c 8 Mar 2010 21:30:00 -0000 1.212
+++ gsb_file_load.c 13 Mar 2010 21:06:58 -0000 1.213
@@ -1748,14 +1748,6 @@
continue;
}
- if ( !strcmp ( attribute_names[i], "Bet_Ddte" ))
- {
- gsb_data_account_set_bet_deb_period ( account_number,
- utils_str_atoi ( attribute_values[i] ) );
- i++;
- continue;
- }
-
if ( !strcmp ( attribute_names[i], "Bet_start_date" ))
{
gsb_data_account_set_bet_start_date ( account_number,
@@ -1764,7 +1756,7 @@
continue;
}
- if ( !strcmp ( attribute_names[i], "Bet_Nbre" ))
+ if ( !strcmp ( attribute_names[i], "Bet_months" ))
{
gsb_data_account_set_bet_months ( account_number,
utils_str_atoi ( attribute_values[i] ) );
@@ -3686,34 +3678,6 @@
continue;
}
- if ( !strcmp ( attribute_names[i], "Nbre" ) )
- {
- etat.bet_months = utils_str_atoi ( attribute_values[i] );
- i++;
- continue;
- }
-
- if ( !strcmp ( attribute_names[i], "UT" ) )
- {
- etat.bet_spin_range = utils_str_atoi ( attribute_values[i] );
- i++;
- continue;
- }
-
- if ( !strcmp ( attribute_names[i], "SD" ) )
- {
- etat.bet_hist_data = utils_str_atoi ( attribute_values[i] );
- i++;
- continue;
- }
-
- if ( !strcmp ( attribute_names[i], "Fi" ) )
- {
- etat.bet_hist_fyear = utils_str_atoi ( attribute_values[i] );
- i++;
- continue;
- }
-
/* normally, shouldn't come here */
i++;
}
Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- balance_estimate_tab.c 8 Mar 2010 21:30:00 -0000 1.51
+++ balance_estimate_tab.c 13 Mar 2010 21:06:58 -0000 1.52
@@ -72,15 +72,10 @@
gint sub_div_nb,
gsb_real amount,
GtkTreeModel *model );
-//~ static void bet_array_create_page ( GtkWidget *notebook );
static gint bet_array_date_sort_function ( GtkTreeModel *model,
GtkTreeIter *itera,
GtkTreeIter *iterb,
gpointer data );
-static void bet_array_duration_button_clicked ( GtkWidget *togglebutton,
- GtkWidget *spin_button );
-static gboolean bet_array_duration_number_changed ( GtkWidget *spin_button,
- gpointer data );
static gboolean bet_array_entry_key_press ( GtkWidget *entry,
GdkEventKey *ev,
gpointer data );
@@ -122,15 +117,16 @@
/*END_EXTERN*/
enum bet_estimation_tree_columns {
- SPP_ESTIMATE_TREE_SELECT_COLUMN, /* select column for the balance */
- SPP_ESTIMATE_TREE_DIVISION_COLUMN,
+ SPP_ESTIMATE_TREE_SELECT_COLUMN, /* select column for the balance */
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, /* div_number */
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, /* sub_div_nb */
SPP_ESTIMATE_TREE_DATE_COLUMN,
SPP_ESTIMATE_TREE_DESC_COLUMN,
SPP_ESTIMATE_TREE_DEBIT_COLUMN,
SPP_ESTIMATE_TREE_CREDIT_COLUMN,
SPP_ESTIMATE_TREE_BALANCE_COLUMN,
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
- SPP_ESTIMATE_TREE_AMOUNT_COLUMN, /* the amount without currency */
+ SPP_ESTIMATE_TREE_AMOUNT_COLUMN, /* the amount without currency */
SPP_ESTIMATE_TREE_BALANCE_COLOR,
SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
SPP_ESTIMATE_TREE_NUM_COLUMNS
@@ -467,20 +463,11 @@
gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
gtk_box_pack_start( GTK_BOX ( hbox ), label, 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 );
- gtk_widget_grab_focus ( spin_button );
- }
- 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.0 ) );
- gtk_widget_grab_focus ( spin_button );
- }
+ 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_grab_focus ( spin_button );
+
+ gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 5 );
for (iduration = 0; bet_duration_array[iduration] != NULL; iduration++)
{
@@ -500,7 +487,7 @@
gtk_box_pack_start ( GTK_BOX ( hbox ), widget, FALSE, FALSE, 5 );
g_signal_connect (G_OBJECT ( widget ),
"released",
- G_CALLBACK ( bet_array_duration_button_clicked ),
+ G_CALLBACK ( bet_config_duration_button_clicked ),
spin_button );
}
@@ -508,16 +495,12 @@
g_object_set_data ( G_OBJECT ( notebook ), "bet_account_widget", widget );
g_object_set_data ( G_OBJECT ( notebook ), "bet_account_spin_button", 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 );
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( previous ), TRUE );
g_signal_connect ( G_OBJECT ( spin_button ),
"value-changed",
- G_CALLBACK ( bet_array_duration_number_changed ),
+ G_CALLBACK ( bet_config_duration_number_changed ),
NULL );
- gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
label = gtk_label_new ( COLON ( _("Start date" ) ) );
gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
@@ -543,7 +526,8 @@
/* create the model */
tree_model = gtk_tree_store_new ( SPP_ESTIMATE_TREE_NUM_COLUMNS,
G_TYPE_BOOLEAN, /* SPP_ESTIMATE_TREE_SELECT_COLUMN */
- G_TYPE_BOOLEAN, /* SPP_ESTIMATE_TREE_DIVISION_COLUMN */
+ G_TYPE_INT, /* SPP_ESTIMATE_TREE_DIVISION_COLUMN */
+ G_TYPE_INT, /* SPP_ESTIMATE_TREE_SUB_DIV_COLUMN */
G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DATE_COLUMN */
G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DESC_COLUMN */
G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DEBIT_COLUMN */
@@ -568,8 +552,8 @@
scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
gtk_widget_show ( scrolled_window );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW ( scrolled_window ),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_container_add ( GTK_CONTAINER ( scrolled_window ), tree_view );
gtk_widget_show ( scrolled_window );
gtk_box_pack_start ( GTK_BOX ( vbox ),
@@ -582,9 +566,13 @@
"text", SPP_ESTIMATE_TREE_DATE_COLUMN,
"cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
NULL);
+ g_object_set (cell, "xalign", 0.5, NULL);
+
+ gtk_tree_view_column_set_alignment ( column, 0.5 );
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(column), 150);
+ //~ gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(column), 150);
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* Description column */
cell = gtk_cell_renderer_text_new ();
@@ -593,10 +581,11 @@
"text", SPP_ESTIMATE_TREE_DESC_COLUMN,
"cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
NULL);
- gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
- GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width(column, 300);
- gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW ( tree_view ),
+ GTK_TREE_VIEW_COLUMN ( column ) );
+ //~ gtk_tree_view_column_set_min_width (column, 300 );
+ gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* Debit column */
cell = gtk_cell_renderer_text_new ();
@@ -607,10 +596,11 @@
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width(column, 140);
+ //~ gtk_tree_view_column_set_min_width(column, 140);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment(column, 1);
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* Credit column */
cell = gtk_cell_renderer_text_new ();
@@ -622,10 +612,11 @@
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width(column, 140);
+ //~ gtk_tree_view_column_set_min_width(column, 140);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
- gtk_tree_view_column_set_alignment(column, 1);
+ gtk_tree_view_column_set_alignment ( column, 1 );
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* Balance column */
cell = gtk_cell_renderer_text_new ();
@@ -637,10 +628,11 @@
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
- gtk_tree_view_column_set_min_width(column, 170);
+ //~ gtk_tree_view_column_set_min_width(column, 170);
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment(column, 1);
gtk_tree_view_column_set_expand(GTK_TREE_VIEW_COLUMN(column), FALSE);
+ gtk_tree_view_column_set_resizable ( column, TRUE );
g_signal_connect ( G_OBJECT ( tree_view ),
"button-press-event",
G_CALLBACK ( bet_array_list_button_press ),
@@ -698,7 +690,9 @@
div_number = bet_data_get_div_number ( scheduled_number, FALSE );
sub_div_nb = bet_data_get_sub_div_nb ( scheduled_number, FALSE );
- if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) )
+ if ( div_number > 0
+ &&
+ bet_data_search_div_hist ( account_number, div_number, 0 ) )
continue;
if ( gsb_data_scheduled_is_transfer ( scheduled_number ) )
@@ -776,7 +770,8 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &iter,
- SPP_ESTIMATE_TREE_DIVISION_COLUMN, FALSE,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, 0,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, 0,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -809,11 +804,13 @@
GDate *date_min,
GDate *date_max )
{
- GDate *date_jour;
+ GDate *date_jour_1;
GSList *tmp_list;
//~ devel_debug (NULL);
- date_jour = gdate_today ( );
+ date_jour_1 = gsb_date_copy ( date_min );
+ if ( g_date_get_day ( date_min ) > 1 )
+ g_date_set_day ( date_jour_1, 1 );
/* search transactions of the account which are in the period */
tmp_list = gsb_data_transaction_get_transactions_list ( );
@@ -845,9 +842,6 @@
date = gsb_data_transaction_get_date ( transaction_number );
- /* ignore transaction which are before date_min (today) */
- if ( g_date_compare ( date, date_min ) < 0 )
- continue;
/* ignore transaction which are after date_max */
if ( g_date_compare (date, date_max ) > 0 )
continue;
@@ -857,18 +851,30 @@
transaction_number ) != 0 )
continue;
+ /* Ignore transactions that are before the first day of the month */
+ if ( g_date_compare ( date, date_jour_1 ) < 0 )
+ continue;
+
amount = gsb_data_transaction_get_amount ( transaction_number );
div_number = bet_data_get_div_number ( transaction_number, TRUE );
sub_div_nb = bet_data_get_sub_div_nb ( transaction_number, TRUE );
- if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) )
+ //~ if ( div_number == 18 || div_number == 27 )
+ //~ printf ("div_number = %d sub_div_number = %d\n", div_number, sub_div_nb);
+ if ( div_number > 0
+ &&
+ bet_data_search_div_hist ( account_number, div_number, 0 ) )
{
- if ( g_date_compare ( date, date_jour ) > 1 )
- continue;
- else if ( g_date_get_month ( date ) >= g_date_get_month ( date_jour ) )
+
+ //~ printf ("après test div_number = %d sub_div_nb = %d\n", div_number, sub_div_nb);
+ if ( g_date_get_month ( date ) == g_date_get_month ( date_jour_1 ) )
bet_array_adjust_hist_data ( div_number, sub_div_nb, amount, tab_model );
}
+ /* ignore transaction which are before date_min */
+ if ( g_date_compare ( date, date_min ) < 0 )
+ continue;
+
str_date = gsb_format_gdate ( date );
g_value_init ( &date_value, G_TYPE_DATE );
g_value_set_boxed ( &date_value, date );
@@ -909,7 +915,8 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &iter,
- SPP_ESTIMATE_TREE_DIVISION_COLUMN, FALSE,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, 0,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, 0,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -970,7 +977,7 @@
if ( sub_div_nb > 0 )
{
g_free ( str_description );
- str_description = bet_data_get_div_name ( div_number, sub_div_nb, FALSE );
+ str_description = bet_data_get_div_name ( div_number, sub_div_nb, NULL );
}
amount = gsb_real_get_from_string ( str_amount );
@@ -1010,7 +1017,8 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &tab_iter,
- SPP_ESTIMATE_TREE_DIVISION_COLUMN, TRUE,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, div_number,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, sub_div_nb,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -1165,10 +1173,10 @@
/**
- *
- *
- *
- *
+ * Cette fonction recalcule le montant des données historiques en fonction de la
+ * consommation mensuelle précédente. affiche le nouveau montant si même signe ou 0
+ * et un message pour budget dépassé.
+ *
* */
void bet_array_adjust_hist_data ( gint div_number,
gint sub_div_nb,
@@ -1188,24 +1196,37 @@
GDate *date;
GDate *date_today;
gsb_real number;
+ gint sign = 1;
+ gint tmp_div_number;
+ gint tmp_sub_div_nb;
do
{
gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
&iter,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &tmp_div_number,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, &tmp_sub_div_nb,
SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, &str_desc,
SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &str_amount,
-1 );
- div_name = bet_data_get_div_name ( div_number, sub_div_nb, FALSE );
- if ( g_strstr_len ( str_desc, -1, div_name ) )
+ if ( tmp_div_number == 0 || tmp_div_number != div_number )
+ continue;
+ //~ printf ("ligne analysée div_number = %d, sub_div_number = %d\n", tmp_div_number, tmp_sub_div_nb);
+
+ if ( tmp_sub_div_nb == 0 || tmp_sub_div_nb == sub_div_nb )
{
+ div_name = bet_data_get_div_name ( tmp_div_number, tmp_sub_div_nb, FALSE );
+ //~ printf ("div_number = %d, sub_div_number = %d div_name = %s str_desc = %s\n",
+ //~ tmp_div_number, tmp_sub_div_nb, div_name, str_desc );
date = gsb_parse_date_string ( str_date );
date_today = gdate_today ( );
if ( g_date_get_month ( date ) - g_date_get_month ( date_today ) == 0 )
{
number = gsb_real_import_from_string ( str_amount );
+ if ( number .mantissa < 0 )
+ sign = -1;
number = gsb_real_sub ( number, amount );
if ( number.mantissa == 0 )
gtk_tree_store_remove ( GTK_TREE_STORE ( model ), &iter );
@@ -1213,21 +1234,49 @@
{
if ( str_amount )
g_free ( str_amount );
+ if ( str_desc )
+ g_free ( str_desc );
+
str_amount = gsb_real_save_real_to_string ( number, 2 );
- if ( number.mantissa < 0 )
+ if ( number.mantissa < 0 && sign < 0 )
+ {
str_debit = gsb_real_get_string_with_currency (
gsb_real_abs ( number ),
bet_data_get_selected_currency ( ),
TRUE );
- else
+ str_desc = g_strconcat ( div_name, _(" (still available)"), NULL);
+ }
+ else if ( number.mantissa > 0 && sign > 0 )
+ {
str_credit = gsb_real_get_string_with_currency (
gsb_real_abs ( number ),
bet_data_get_selected_currency ( ),
TRUE );
- if ( str_desc )
- g_free ( str_desc );
- str_desc = g_strconcat ( div_name, _(" (still available)"), NULL);
-
+ str_desc = g_strconcat ( div_name, _(" (yet to receive)"), NULL);
+ }
+ else if ( sign == -1 )
+ {
+ str_debit = gsb_real_get_string_with_currency (
+ null_real,
+ bet_data_get_selected_currency ( ),
+ TRUE );
+ if ( str_amount )
+ g_free ( str_amount );
+ str_amount = g_strdup ( "0.00" );
+ str_desc = g_strconcat ( div_name, _(" (budget exceeded)"), NULL);
+ }
+ else
+ {
+ str_credit = gsb_real_get_string_with_currency (
+ null_real,
+ bet_data_get_selected_currency ( ),
+ TRUE );
+ if ( str_amount )
+ g_free ( str_amount );
+ str_amount = g_strdup ( "0.00" );
+ str_desc = g_strconcat ( div_name, _(" (budget exceeded)"), NULL);
+ }
+
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_desc,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -1244,11 +1293,11 @@
g_free ( div_name );
break;
}
+ g_free ( div_name );
}
g_free ( str_date );
g_free ( str_desc );
g_free ( str_amount );
- g_free ( div_name );
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
}
@@ -1360,16 +1409,18 @@
if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
{
- gint div = 0;
+ gint div_number = 0;
+ gint sub_div_number;
gint current_color = 0;
do
{
gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
&iter,
- SPP_ESTIMATE_TREE_DIVISION_COLUMN, &div,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &div_number,
+ SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, &sub_div_number,
-1 );
- if ( div == 0 )
+ if ( div_number == 0 )
{
gtk_tree_store_set ( GTK_TREE_STORE ( model ),
&iter,
@@ -1390,52 +1441,6 @@
}
-/*
- * bet_array_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 account -> bet_spin_range
- */
-void bet_array_duration_button_clicked ( GtkWidget *togglebutton,
- GtkWidget *spin_button )
-{
- const gchar *name;
- gint account_number;
- gint months;
-
- //~ devel_debug (NULL);
- name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
- account_number = gsb_gui_navigation_get_current_account ( );
-
- if ( g_strcmp0 ( name, "Year" ) == 0 )
- {
- 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 );
- if ( months > 20 )
- {
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ), 20.0 );
- gsb_data_account_set_bet_months ( account_number, 240 );
- }
- else
- gsb_data_account_set_bet_months ( account_number, months * 12 );
- }
- else
- {
- 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 (
- 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 ( );
-}
-
-
/**
*
*
@@ -1445,65 +1450,52 @@
gboolean bet_array_initializes_account_settings ( gint account_number )
{
GtkWidget *notebook;
+ GtkWidget *ancestor;
GtkWidget *widget = NULL;
- GtkWidget *spin_button = NULL;
- gint spin_range;
+ GtkWidget *button = NULL;
+ gint param;
gint months;
+ //~ devel_debug_int ( account_number );
notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook" );
- spin_button = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_spin_button" );
- spin_range = gsb_data_account_get_bet_spin_range ( account_number );
+ 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 );
- if ( spin_range == 0 )
+ if ( param == 0 )
{
widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_previous" );
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
- gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 240.0 );
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
+ gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( button ), 1.0, 240.0 );
+ gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( button ),
(gdouble) months );
}
else
{
widget = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_widget" );
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
- gtk_spin_button_set_range ( GTK_SPIN_BUTTON ( spin_button ), 1.0, 20.0 );
- gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
+ 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 );
-
}
- return FALSE;
-}
-/*
- * bet_array_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_array_duration_number_changed ( GtkWidget *spin_button,
- gpointer data )
-{
- gint account_number;
- gint months;
+ ancestor = g_object_get_data ( G_OBJECT ( notebook ), "historical_data" );
- account_number = gsb_gui_navigation_get_current_account ( );
+ param = gsb_data_account_get_bet_hist_data ( 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;
-
- gsb_data_account_set_bet_months ( account_number, months );
+ if ( param == 1 )
+ button = g_object_get_data ( G_OBJECT ( notebook ), "button_2" );
+ else
+ button = g_object_get_data ( G_OBJECT ( notebook ), "button_1" );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
- bet_array_refresh_estimate_tab ( );
+ param = gsb_data_account_get_bet_hist_fyear ( account_number );
+ widget = g_object_get_data ( G_OBJECT ( notebook ), "fyear_combo" );
+ bet_historical_set_fyear_from_combobox ( widget, param );
- return ( FALSE );
+ return FALSE;
}
-
-
/**
*
*
Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- main.c 8 Mar 2010 21:30:01 -0000 1.166
+++ main.c 13 Mar 2010 21:06:58 -0000 1.167
@@ -286,7 +286,7 @@
gtk_window_set_default_size ( GTK_WINDOW ( window ), 900, 600 );
/* display window centered */
- gtk_window_set_position ( GTK_WINDOW (window), GTK_WIN_POS_CENTER );
+ //~ gtk_window_set_position ( GTK_WINDOW (window), GTK_WIN_POS_CENTER );
gtk_widget_show ( window );
Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- balance_estimate_data.c 3 Mar 2010 22:21:48 -0000 1.12
+++ balance_estimate_data.c 13 Mar 2010 21:06:58 -0000 1.13
@@ -21,6 +21,8 @@
/* */
/* ************************************************************************** */
+/* ./configure --with-balance-estimate */
+
#include "include.h"
#include <config.h>
@@ -61,6 +63,7 @@
/*START_EXTERN*/
extern gboolean balances_with_scheduled;
+extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
/*END_EXTERN*/
@@ -381,7 +384,7 @@
gint sub_div,
const gchar *return_value_error )
{
- return g_strdup ( ptr_div_name ( div_num, sub_div, FALSE ) );
+ return g_strdup ( ptr_div_name ( div_num, sub_div, NULL ) );
}
@@ -893,6 +896,52 @@
}
/**
+ * Sélectionne les onglets du module gestion budgétaire en fonction du type de compte
+ *
+ */
+void bet_data_select_bet_pages ( gint account_number )
+{
+ GtkWidget *notebook;
+ GtkWidget *page;
+ kind_account kind;
+ gint current_page;
+
+ notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
+ kind = gsb_data_account_get_kind ( account_number );
+ current_page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( notebook ) );
+
+ switch ( kind )
+ {
+ case GSB_TYPE_BANK:
+ case GSB_TYPE_CASH:
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
+ gtk_widget_show ( page );
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
+ gtk_widget_show ( page );
+ bet_array_update_estimate_tab ( );
+ break;
+ case GSB_TYPE_LIABILITIES:
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
+ gtk_widget_show ( page );
+ if ( current_page == 2 )
+ gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 1 );
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
+ gtk_widget_hide ( page );
+ bet_array_update_estimate_tab ( );
+ break;
+ case GSB_TYPE_ASSET:
+ if ( current_page < 2 )
+ gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook ), 0 );
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 1 );
+ gtk_widget_hide ( page );
+ page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( notebook ), 2 );
+ gtk_widget_hide ( page );
+ break;
+ }
+}
+
+
+/**
*
*
*
Index: gsb_file_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_config.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- gsb_file_config.c 8 Mar 2010 21:30:00 -0000 1.91
+++ gsb_file_config.c 13 Mar 2010 21:06:58 -0000 1.92
@@ -1334,30 +1334,30 @@
conf.dvips_command = "dvips";
/* mise en conformité avec les recommandations FreeDesktop. */
-#ifndef _WIN32
- if ( g_file_test ( "/usr/bin/firefox", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/firefox" );
- }
- else if ( g_file_test ( "/usr/bin/iceweasel", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/iceweasel" );
- }
- else if ( g_file_test ( "/usr/bin/opera", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/opera" );
- }
- else if ( g_file_test ( "/usr/bin/mozilla", G_FILE_TEST_EXISTS ) )
- {
- conf.browser_command = g_strdup ( "/usr/bin/mozilla" );
- }
- else
- {
-#endif /* _WIN32 */
+//~ #ifndef _WIN32
+ //~ if ( g_file_test ( "/usr/bin/firefox", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/firefox" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/iceweasel", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/iceweasel" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/opera", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/opera" );
+ //~ }
+ //~ else if ( g_file_test ( "/usr/bin/mozilla", G_FILE_TEST_EXISTS ) )
+ //~ {
+ //~ conf.browser_command = g_strdup ( "/usr/bin/mozilla" );
+ //~ }
+ //~ else
+ //~ {
+//~ #endif /* _WIN32 */
conf.browser_command = g_strdup (ETAT_WWW_BROWSER);
-#ifndef _WIN32
- }
-#endif /* _WIN32 */
+//~ #ifndef _WIN32
+ //~ }
+//~ #endif /* _WIN32 */
/* Print */
etat.print_config.printer = 0;
Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- balance_estimate_hist.c 8 Mar 2010 21:30:00 -0000 1.14
+++ balance_estimate_hist.c 13 Mar 2010 21:06:58 -0000 1.15
@@ -23,16 +23,6 @@
/* ./configure --with-balance-estimate */
-/*
- * prefix bet : Balance Estimate Tab
- *
- * TODO : change the color of each line in the graph :
- * red if balance is less than 0.
- * orange if balance is less than the minimum desired balance.
- * TODO : add a select button to display the selected line in the array
- * in the scheduler tab or in the account tab.
- */
-
#include "include.h"
#include <config.h>
@@ -40,6 +30,7 @@
/*START_INCLUDE*/
#include "balance_estimate_hist.h"
+#include "./balance_estimate_config.h"
#include "./balance_estimate_data.h"
#include "./balance_estimate_tab.h"
#include "./utils_dates.h"
@@ -101,10 +92,12 @@
GtkTreeModel *model );
static gboolean bet_historical_set_empty_sub_div ( GtkTreeModel *model, GtkTreeIter *parent );
static gboolean bet_historical_set_full_sub_div ( GtkTreeModel *model, GtkTreeIter *parent );
+static gboolean bet_historical_set_background_color ( GtkWidget *tree_view );
/*END_STATIC*/
/*START_EXTERN*/
extern gboolean balances_with_scheduled;
+extern GdkColor couleur_fond[0];
extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
@@ -129,7 +122,7 @@
*
*
* */
-GtkWidget * bet_historical_create_page ( void )
+GtkWidget *bet_historical_create_page ( void )
{
GtkWidget *notebook;
GtkWidget *widget;
@@ -177,7 +170,7 @@
gtk_widget_set_name ( button_1, "button_1" );
g_signal_connect ( G_OBJECT ( button_1 ),
"released",
- G_CALLBACK ( bet_historical_origin_data_clicked ),
+ G_CALLBACK ( bet_config_origin_data_clicked ),
NULL );
button_2 = gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON ( button_1 ),
@@ -185,22 +178,16 @@
gtk_widget_set_name ( button_2, "button_2" );
g_signal_connect ( G_OBJECT ( button_2 ),
"released",
- G_CALLBACK ( bet_historical_origin_data_clicked ),
+ G_CALLBACK ( bet_config_origin_data_clicked ),
NULL );
+ g_object_set_data ( G_OBJECT ( notebook ), "button_1", button_1 );
+ g_object_set_data ( G_OBJECT ( notebook ), "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) ;
- if ( etat.bet_hist_data == 0 )
- {
- gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
- bet_data_set_div_ptr ( etat.bet_hist_data );
- }
- else
- {
- gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_2 ), TRUE );
- bet_data_set_div_ptr ( etat.bet_hist_data );
- }
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
+ bet_data_set_div_ptr ( 0 );
/* création du sélecteur de périod */
if ( bet_historical_fyear_create_combobox_store ( ) )
@@ -220,19 +207,10 @@
gsb_fyear_hide_iter_by_name ( bet_fyear_model, str_year );
g_free ( str_year );
- /* show the old choice */
- if ( etat.bet_hist_fyear > 0 )
- {
- gsb_fyear_select_iter_by_number ( widget,
- bet_fyear_model,
- bet_fyear_model_filter,
- etat.bet_hist_fyear );
- }
-
/* set the signal */
g_signal_connect ( G_OBJECT ( widget ),
"changed",
- G_CALLBACK (bet_historical_fyear_clicked),
+ G_CALLBACK (bet_config_fyear_clicked),
NULL );
}
@@ -252,70 +230,6 @@
*
*
* */
-void bet_historical_origin_data_clicked ( GtkWidget *togglebutton, gpointer data )
-{
- GtkWidget *notebook;
- GtkTreeViewColumn *column;
- const gchar *name;
- gchar *title;
- gint account_number;
-
- account_number = gsb_gui_navigation_get_current_account ( );
- name = gtk_widget_get_name ( GTK_WIDGET ( togglebutton ) );
- //~ devel_debug (name);
- notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
-
- if ( g_strcmp0 ( name, "button_1" ) == 0 )
- {
- gsb_data_account_set_bet_hist_data ( account_number, 0 );
- bet_data_set_div_ptr ( 0 );
- title = g_strdup ( _("Category") );
- }
- else
- {
- gsb_data_account_set_bet_hist_data ( account_number, 1 );
- bet_data_set_div_ptr ( 1 );
- title = g_strdup ( _("Budgetary line") );
- }
-
- 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_array_update_estimate_tab ( );
-}
-
-
-/**
- *
- *
- *
- *
- * */
-void bet_historical_fyear_clicked ( GtkWidget *combo, gpointer data )
-{
- gint account_number;
-
- account_number = gsb_gui_navigation_get_current_account ( );
- gsb_data_account_set_bet_hist_fyear ( account_number,
- bet_historical_get_fyear_from_combobox ( combo ) );
-
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
-
- bet_array_update_estimate_tab ( );
-}
-
-
-/**
- *
- *
- *
- *
- * */
gboolean bet_historical_div_toggle_clicked ( GtkCellRendererToggle *renderer,
gchar *path_string,
GtkTreeModel *model )
@@ -327,8 +241,8 @@
{
gchar *str_amount;
gchar *str_average;
- gint div;
- gint sub_div;
+ gint div_number;
+ gint sub_div_nb;
gint nbre_fils;
gint account_nb;
gboolean valeur;
@@ -339,8 +253,8 @@
SPP_HISTORICAL_AVERAGE_COLUMN, &str_average,
SPP_HISTORICAL_AVERAGE_AMOUNT, &str_amount,
SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
- SPP_HISTORICAL_DIV_NUMBER, &div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, &div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
SPP_HISTORICAL_EDITED_COLUMN, &col_edited,
-1 );
@@ -351,28 +265,28 @@
if ( valeur == 1 )
{
//~ printf ("avant - account_nb = %d, div = %d, sub_div = %d\n", account_nb, div, sub_div);
- bet_data_add_div_hist ( account_nb, div, sub_div );
- bet_data_set_div_amount ( account_nb, div, sub_div,
+ bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ bet_data_set_div_amount ( account_nb, div_number, sub_div_nb,
gsb_real_import_from_string ( str_amount ) );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
SPP_HISTORICAL_SELECT_COLUMN, 1,
SPP_HISTORICAL_RETAINED_COLUMN, str_average,
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
- SPP_HISTORICAL_DIV_NUMBER, div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
-1 );
}
else
{
- bet_data_remove_div_hist ( account_nb, div, sub_div );
+ bet_data_remove_div_hist ( account_nb, div_number, sub_div_nb );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
SPP_HISTORICAL_SELECT_COLUMN, FALSE,
SPP_HISTORICAL_RETAINED_COLUMN, "",
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
- SPP_HISTORICAL_DIV_NUMBER, div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
SPP_HISTORICAL_EDITED_COLUMN, TRUE,
-1 );
}
@@ -409,13 +323,13 @@
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
-1);
if ( bet_historical_amount_differ_average ( model, &parent) )
- bet_data_set_div_amount ( account_nb, div, 0, amount );
+ bet_data_set_div_amount ( account_nb, div_number, 0, amount );
bet_historical_row_collapse_all ( NULL, &parent, model );
}
else
{
- bet_data_set_div_amount ( account_nb, div, 0, null_real );
+ bet_data_set_div_amount ( account_nb, div_number, 0, null_real );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &parent,
SPP_HISTORICAL_SELECT_COLUMN, FALSE,
SPP_HISTORICAL_RETAINED_COLUMN, "",
@@ -474,8 +388,8 @@
gboolean edited;
gint account_nb;
gint currency_number;
- gint div;
- gint sub_div;
+ gint div_number;
+ gint sub_div_nb;
gchar *tmp_str;
gchar *str_amount;
gboolean is_parent = FALSE;
@@ -484,8 +398,8 @@
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
SPP_HISTORICAL_SELECT_COLUMN, &valeur,
SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
- SPP_HISTORICAL_DIV_NUMBER, &div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, &div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
SPP_HISTORICAL_EDITED_COLUMN, &edited,
-1 );
@@ -503,11 +417,11 @@
currency_number = gsb_data_account_get_currency ( account_nb );
tmp_str = gsb_real_get_string_with_currency ( number, currency_number, TRUE );
//~ printf ("div = %d sub_div = %d tmp_str = %s\n", div, sub_div, tmp_str);
- if ( bet_data_search_div_hist ( account_nb, div, sub_div ) == FALSE )
- bet_data_add_div_hist ( account_nb, div, sub_div );
+ if ( bet_data_search_div_hist ( account_nb, div_number, sub_div_nb ) == FALSE )
+ bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
- bet_data_set_div_edited ( account_nb, div, sub_div, TRUE );
- bet_data_set_div_amount ( account_nb, div, sub_div, number );
+ bet_data_set_div_edited ( account_nb, div_number, sub_div_nb, TRUE );
+ bet_data_set_div_amount ( account_nb, div_number, sub_div_nb, number );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
SPP_HISTORICAL_SELECT_COLUMN, TRUE,
SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
@@ -523,7 +437,7 @@
if ( is_parent && bet_historical_get_full_div ( model, &parent ) )
{
number = bet_historical_get_children_amount ( model, &parent );
- bet_data_set_div_amount ( account_nb, div, 0, number );
+ bet_data_set_div_amount ( account_nb, div_number, 0, number );
str_amount = gsb_real_save_real_to_string ( number, 2 );
if ( tmp_str )
g_free ( tmp_str );
@@ -583,7 +497,8 @@
G_TYPE_INT, /* SPP_HISTORICAL_ACCOUNT_NUMBER */
G_TYPE_INT, /* SPP_HISTORICAL_DIV_NUMBER */
G_TYPE_INT, /* SPP_HISTORICAL_SUB_DIV_NUMBER */
- G_TYPE_BOOLEAN ); /* SPP_HISTORICAL_EDITED_COLUMN */
+ G_TYPE_BOOLEAN, /* SPP_HISTORICAL_EDITED_COLUMN */
+ GDK_TYPE_COLOR ); /* SPP_HISTORICAL_BACKGROUND_COLOR */
gtk_tree_view_set_model ( GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL ( tree_model ) );
g_object_unref ( G_OBJECT ( tree_model ) );
@@ -595,7 +510,7 @@
scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_widget_set_size_request ( scrolled_window, -1, 250 );
gtk_container_add ( GTK_CONTAINER ( scrolled_window ), tree_view );
gtk_box_pack_start ( GTK_BOX ( container ), scrolled_window, TRUE, TRUE, 15 );
@@ -613,40 +528,43 @@
column = gtk_tree_view_column_new_with_attributes ( _("Select"),
cell,
"active", SPP_HISTORICAL_SELECT_COLUMN,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
gtk_tree_view_column_set_alignment ( column, 0.5 );
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ), column );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* name of the div sous-div column*/
- if ( etat.bet_hist_data == 0 )
- title = g_strdup ( _("Category") );
- else
- title = g_strdup ( _("Budgetary line") );
+ title = g_strdup ( _("Category") );
cell = gtk_cell_renderer_text_new ( );
column = gtk_tree_view_column_new_with_attributes ( title,
cell,
"text", SPP_HISTORICAL_DESC_COLUMN,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
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 ) );
- gtk_tree_view_column_set_min_width ( column, 300 );
+ //~ gtk_tree_view_column_set_min_width ( column, 300 );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* period analysis column */
cell = gtk_cell_renderer_text_new ( );
column = gtk_tree_view_column_new_with_attributes (
_("Period"), cell,
"text", SPP_HISTORICAL_PERIOD_COLUMN,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
g_object_set (cell, "xalign", 0.5, NULL);
gtk_tree_view_column_set_alignment ( column, 0.5 );
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN ( column ) );
- gtk_tree_view_column_set_min_width ( column, 120 );
+ //~ gtk_tree_view_column_set_min_width ( column, 120 );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* amount column */
cell = gtk_cell_renderer_text_new ( );
@@ -654,14 +572,16 @@
_("Amount"), cell,
"text", SPP_HISTORICAL_BALANCE_COLUMN,
"foreground", SPP_HISTORICAL_BALANCE_COLOR,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN ( column ) );
- gtk_tree_view_column_set_min_width ( column, 100 );
+ //~ gtk_tree_view_column_set_min_width ( column, 100 );
g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment ( column, 1 );
gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* average column */
cell = gtk_cell_renderer_text_new ( );
@@ -669,14 +589,16 @@
_("Average"), cell,
"text", SPP_HISTORICAL_AVERAGE_COLUMN,
"foreground", SPP_HISTORICAL_BALANCE_COLOR,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN ( column ) );
- gtk_tree_view_column_set_min_width ( column, 100 );
+ //~ gtk_tree_view_column_set_min_width ( column, 100 );
g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment ( column, 1 );
gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
/* amount retained column */
cell = gtk_cell_renderer_text_new ( );
@@ -685,14 +607,16 @@
"text", SPP_HISTORICAL_RETAINED_COLUMN,
"foreground", SPP_HISTORICAL_BALANCE_COLOR,
"editable", SPP_HISTORICAL_EDITED_COLUMN,
+ "cell-background-gdk", SPP_HISTORICAL_BACKGROUND_COLOR,
NULL);
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ),
GTK_TREE_VIEW_COLUMN ( column ) );
- gtk_tree_view_column_set_min_width ( column, 100 );
+ //~ gtk_tree_view_column_set_min_width ( column, 100 );
g_object_set ( G_OBJECT ( GTK_CELL_RENDERER ( cell ) ), "xalign", 1.0, NULL );
gtk_tree_view_column_set_alignment ( column, 1 );
gtk_tree_view_column_set_clickable ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
gtk_tree_view_column_set_expand ( GTK_TREE_VIEW_COLUMN ( column ), TRUE );
+ gtk_tree_view_column_set_resizable ( column, TRUE );
g_signal_connect ( cell,
"editing-started",
@@ -814,6 +738,8 @@
//~ bet_data_synchronise_hist_div_list ( list_div );
g_hash_table_remove_all ( list_div );
+
+ bet_historical_set_background_color ( tree_view );
}
@@ -870,7 +796,7 @@
gsb_real amount;
div_number = sh -> div;
- div_name = bet_data_get_div_name ( div_number, 0, FALSE );
+ div_name = bet_data_get_div_name ( div_number, 0, NULL );
account_nb = sh -> account_nb;
notebook = g_object_get_data ( G_OBJECT ( notebook_general ), "account_notebook");
@@ -921,7 +847,6 @@
}
g_free ( div_name );
- g_free ( str_balance );
g_free ( str_average );
g_free ( str_amount );
g_free ( str_retained );
@@ -937,21 +862,24 @@
GtkTreeIter fils;
gchar **tab_str = NULL;
- //~ printf ("division = %d sub_div = %d\n", div_number, sub_sh -> div);
- div_name = bet_data_get_div_name ( div_number, sub_sh -> div, FALSE );
-
+ div_name = bet_data_get_div_name ( div_number, sub_sh -> div, NULL );
+ //~ printf ("division = %d sub_div = %d div_name = %s\n",
+ //~ div_number, sub_sh -> div, div_name);
if ( div_name && g_utf8_strrchr ( div_name, -1, ':' ) )
{
tab_str = g_strsplit ( div_name, ":", 2 );
- if (tab_str[1])
+ if ( g_strv_length ( tab_str ) > 1 )
+ {
+ if ( div_name )
+ g_free ( div_name );
div_name = g_strdup ( g_strstrip ( tab_str[1] ) );
+ }
if ( tab_str )
g_strfreev ( tab_str );
}
str_balance = gsb_real_get_string_with_currency ( sub_sbr -> current_balance,
gsb_data_account_get_currency ( sh -> account_nb ), TRUE );
- //~ printf ("str_balance = %s\n", str_balance );
average = gsb_real_div ( sub_sbr -> current_balance, period );
str_amount = gsb_real_save_real_to_string ( average, 2 );
str_average = gsb_real_get_string_with_currency ( average,
@@ -1004,8 +932,7 @@
sub_div_visible = TRUE;
gtk_tree_view_expand_to_path ( tree_view, gtk_tree_model_get_path ( model, &fils ) );
}
-
- g_free ( div_name );
+ //~ g_free ( div_name );
g_free ( str_balance );
g_free ( str_average );
g_free ( str_amount );
@@ -1018,11 +945,12 @@
if ( str_amount )
g_free ( str_amount );
str_amount = gsb_real_save_real_to_string ( amount, 2 );
- //~ printf ("str_amount = %s\n", str_amount );
+
if ( str_retained )
g_free ( str_retained );
str_retained = gsb_real_get_string_with_currency ( amount,
gsb_data_account_get_currency ( account_nb ), TRUE );
+
gtk_tree_store_set ( GTK_TREE_STORE ( model ),
&parent,
SPP_HISTORICAL_SELECT_COLUMN, TRUE,
@@ -1105,6 +1033,20 @@
return fyear_number;
}
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_historical_set_fyear_from_combobox ( GtkWidget *combo_box, gint fyear )
+{
+ gsb_fyear_select_iter_by_number ( combo_box,
+ bet_fyear_model,
+ bet_fyear_model_filter,
+ fyear );
+}
+
/**
*
@@ -1216,8 +1158,8 @@
gchar *str_amount;
gchar *str_retained;
gint account_nb;
- gint div;
- gint sub_div;
+ gint div_number;
+ gint sub_div_nb;
gsb_real retained;
do
@@ -1225,14 +1167,14 @@
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &fils_iter,
SPP_HISTORICAL_AVERAGE_AMOUNT, &str_amount,
SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
- SPP_HISTORICAL_DIV_NUMBER, &div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, &div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
SPP_HISTORICAL_EDITED_COLUMN, &edited,
-1 );
retained = gsb_real_import_from_string ( str_amount );
- bet_data_add_div_hist ( account_nb, div, sub_div );
- bet_data_set_div_amount ( account_nb, div, sub_div,
+ bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ bet_data_set_div_amount ( account_nb, div_number, sub_div_nb,
gsb_real_import_from_string ( str_amount ) );
str_retained = gsb_real_get_string_with_currency ( retained,
gsb_data_account_get_currency ( account_nb ), TRUE );
@@ -1277,18 +1219,18 @@
{
gchar *str_amount;
gint account_nb;
- gint div;
- gint sub_div;
+ gint div_number;
+ gint sub_div_nb;
do
{
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &fils_iter,
SPP_HISTORICAL_AVERAGE_AMOUNT, &str_amount,
SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
- SPP_HISTORICAL_DIV_NUMBER, &div,
- SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div,
+ SPP_HISTORICAL_DIV_NUMBER, &div_number,
+ SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
-1 );
- bet_data_remove_div_hist ( account_nb, div, sub_div );
+ bet_data_remove_div_hist ( account_nb, div_number, sub_div_nb );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &fils_iter,
SPP_HISTORICAL_SELECT_COLUMN, FALSE,
SPP_HISTORICAL_RETAINED_COLUMN, "",
@@ -1357,6 +1299,7 @@
gtk_tree_view_collapse_row ( tree_view, path );
gtk_tree_selection_select_iter ( gtk_tree_view_get_selection ( tree_view ), iter );
}
+ bet_historical_set_background_color ( GTK_WIDGET ( tree_view ) );
}
@@ -1499,7 +1442,7 @@
GtkTreeModel *model;
GtkTreeIter parent;
GtkTreeIter iter;
- gint account_nb;
+ gint account_number;
gint div_number;
gint sub_div_nb;
gint currency_number;
@@ -1512,31 +1455,31 @@
return;
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
- SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
+ SPP_HISTORICAL_ACCOUNT_NUMBER, &account_number,
SPP_HISTORICAL_DIV_NUMBER, &div_number,
SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
-1 );
amount = gsb_data_transaction_get_last_transaction_with_div_sub_div (
- account_nb,
+ account_number,
div_number,
sub_div_nb,
- etat.bet_hist_data );
+ gsb_data_account_get_bet_hist_data ( account_number ) );
str_amount = gsb_real_save_real_to_string ( amount, 2 );
- currency_number = gsb_data_account_get_currency ( account_nb );
+ currency_number = gsb_data_account_get_currency ( account_number );
tmp_str = gsb_real_get_string_with_currency ( amount, currency_number, TRUE );
//~ printf ("div = %d sub_div_nb = %d tmp_str = %s\n", div_number, sub_div_nb, tmp_str);
- if ( bet_data_search_div_hist ( account_nb, div_number, sub_div_nb ) == FALSE )
- bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
+ if ( bet_data_search_div_hist ( account_number, div_number, sub_div_nb ) == FALSE )
+ bet_data_add_div_hist ( account_number, div_number, sub_div_nb );
- bet_data_set_div_edited ( account_nb, div_number, sub_div_nb, TRUE );
- bet_data_set_div_amount ( account_nb, div_number, sub_div_nb, amount );
+ bet_data_set_div_edited ( account_number, div_number, sub_div_nb, TRUE );
+ bet_data_set_div_amount ( account_number, div_number, sub_div_nb, amount );
gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
SPP_HISTORICAL_SELECT_COLUMN, TRUE,
SPP_HISTORICAL_RETAINED_COLUMN, tmp_str,
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
- SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
+ SPP_HISTORICAL_ACCOUNT_NUMBER, account_number,
SPP_HISTORICAL_DIV_NUMBER, div_number,
SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
-1 );
@@ -1565,52 +1508,16 @@
GtkTreeSelection *tree_selection )
{
GtkTreeModel *model;
- //~ GtkTreeIter parent;
GtkTreeIter iter;
- gint account_nb;
- gint div_number;
- gint sub_div_nb;
- gchar *str_average;
- gchar *str_amount;
- gsb_real amount;
+ gchar *path_string;
if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
&model, &iter ) )
return;
- gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
- SPP_HISTORICAL_AVERAGE_COLUMN, &str_average,
- SPP_HISTORICAL_AVERAGE_AMOUNT, &str_amount,
- SPP_HISTORICAL_ACCOUNT_NUMBER, &account_nb,
- SPP_HISTORICAL_DIV_NUMBER, &div_number,
- SPP_HISTORICAL_SUB_DIV_NUMBER, &sub_div_nb,
- -1 );
-
- amount = gsb_real_import_from_string ( str_amount );
- if ( bet_data_search_div_hist ( account_nb, div_number, sub_div_nb ) == FALSE )
- bet_data_add_div_hist ( account_nb, div_number, sub_div_nb );
-
- bet_data_set_div_edited ( account_nb, div_number, sub_div_nb, FALSE );
- bet_data_set_div_amount ( account_nb, div_number, sub_div_nb, amount );
- gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
- SPP_HISTORICAL_SELECT_COLUMN, TRUE,
- SPP_HISTORICAL_RETAINED_COLUMN, str_average,
- SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
- SPP_HISTORICAL_ACCOUNT_NUMBER, account_nb,
- SPP_HISTORICAL_DIV_NUMBER, div_number,
- SPP_HISTORICAL_SUB_DIV_NUMBER, sub_div_nb,
- -1 );
-
- //~ if ( gtk_tree_model_iter_parent ( GTK_TREE_MODEL ( model ), &parent, &iter ) )
- //~ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
- //~ &parent,
- //~ SPP_HISTORICAL_EDITED_COLUMN, TRUE,
- //~ -1);
-
- bet_array_refresh_estimate_tab ( );
-
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ path_string = gtk_tree_path_to_string ( gtk_tree_model_get_path ( model, &iter ) );
+ if ( path_string )
+ bet_historical_div_toggle_clicked ( NULL, path_string, model );
}
@@ -1641,11 +1548,65 @@
/**
+ * set the background colors of the list
+ *
+ * \param tree_view
+ *
+ * \return FALSE
+ * */
+gboolean bet_historical_set_background_color ( GtkWidget *tree_view )
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeIter fils_iter;
+
+ if ( !tree_view )
+ return FALSE;
+
+ model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+
+ if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
+ {
+ gint current_color = 0;
+
+ do
+ {
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &iter,
+ SPP_HISTORICAL_BACKGROUND_COLOR, &couleur_fond[current_color],
+ -1 );
+ current_color = !current_color;
+
+ if ( gtk_tree_model_iter_children ( GTK_TREE_MODEL ( model ), &fils_iter, &iter )
+ &&
+ gtk_tree_view_row_expanded ( GTK_TREE_VIEW ( tree_view ),
+ gtk_tree_model_get_path ( GTK_TREE_MODEL ( model ), &iter ) ) )
+ {
+ do
+ {
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &fils_iter,
+ SPP_HISTORICAL_BACKGROUND_COLOR, &couleur_fond[current_color],
+ -1 );
+ current_color = !current_color;
+ }
+ while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &fils_iter ) );
+ }
+ }
+ while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
+ }
+
+ return FALSE;
+}
+
+
+/**
*
*
*
*
* */
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.100, 1.101 da.po, 1.106, 1.107 de.po, 1.180, 1.181 el.po, 1.70, 1.71 eo.po, 1.63, 1.64 es.po, 1.176, 1.177 fa.po, 1.93, 1.94 fr.po, 1.239, 1.240 grisbi.pot, 1.141, 1.142 he.po, 1.99, 1.100 it.po, 1.99, 1.100 nl.po, 1.98, 1.99 pl.po, 1.104, 1.105 pt_BR.po, 1.101, 1.102 ro.po, 1.100, 1.101 ru.po, 1.98, 1.99 zh_CN.po, 1.94, 1.95
- Next message: [grisbi-cvs] grisbi/src balance_estimate_hist.c, 1.15, 1.16 gsb_file_config.c, 1.92, 1.93 main.c, 1.167, 1.168 structures.h, 1.243, 1.244
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list