[grisbi-cvs] grisbi/src accueil.c, 1.203, 1.204 categories_onglet.h, 1.19, 1.20 gsb_currency_config.c, 1.53, 1.54 gsb_data_account.c, 1.86, 1.87 gsb_data_partial_balance.c, 1.1, 1.2 gsb_data_partial_balance.h, 1.1, 1.2 gsb_file_config.c, 1.79, 1.80 gsb_file_save.c, 1.135, 1.136 gsb_scheduler.c, 1.25, 1.26 imputation_budgetaire.h, 1.15, 1.16 meta_payee.c, 1.34, 1.35 navigation.c, 1.125, 1.126 parametres.c, 1.199, 1.200 transaction_list_select.c, 1.7, 1.8 utils_files.c, 1.41, 1.42

Pierre Biava pbiava at users.sourceforge.net
Sun Aug 9 20:31:44 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3401/src

Modified Files:
	accueil.c categories_onglet.h gsb_currency_config.c 
	gsb_data_account.c gsb_data_partial_balance.c 
	gsb_data_partial_balance.h gsb_file_config.c gsb_file_save.c 
	gsb_scheduler.c imputation_budgetaire.h meta_payee.c 
	navigation.c parametres.c transaction_list_select.c 
	utils_files.c 
Log Message:
Added an option to take account of planned operations in the calculation of the balances. program execution mk_update. Changing the management of partial balances WARNING feature development

Index: gsb_currency_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_config.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- gsb_currency_config.c	22 Jul 2009 19:45:42 -0000	1.53
+++ gsb_currency_config.c	9 Aug 2009 18:31:42 -0000	1.54
@@ -1412,10 +1412,10 @@
 	return TRUE;
     }
 
-    gchar* tmpstr = g_strdup_printf ( "failed to find '%s' in '%s'",
-				    conv -> int_curr_symbol, country );
-    warning_debug (tmpstr);
-    g_free ( tmpstr );
+    //~ gchar* tmpstr = g_strdup_printf ( "failed to find '%s' in '%s'",
+				    //~ conv -> int_curr_symbol, country );
+    //~ warning_debug (tmpstr);
+    //~ g_free ( tmpstr );
 
     return FALSE;
 }

Index: gsb_data_partial_balance.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_partial_balance.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gsb_data_partial_balance.h	22 Jul 2009 19:45:42 -0000	1.1
+++ gsb_data_partial_balance.h	9 Aug 2009 18:31:42 -0000	1.2
@@ -27,5 +27,13 @@
                         const gchar *name );
 gint gsb_data_partial_balance_set_new_number ( gint partial_balance_number,
                         gint new_no_partial_balance );
+void gsb_partial_balance_add ( GtkWidget *button, GtkWidget *main_widget );
+void gsb_partial_balance_delete ( GtkWidget *button, GtkWidget *main_widget );
+void gsb_partial_balance_fill_model ( GtkListStore *list_store, kind_account kind );
+gboolean gsb_partial_balance_select_func ( GtkTreeSelection *selection,
+                        GtkTreeModel *model,
+                        GtkTreePath *path,
+                        gboolean path_currently_selected,
+                        GObject *main_widget );
 /* END_DECLARATION */
 #endif

Index: meta_payee.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/meta_payee.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- meta_payee.c	22 Jul 2009 19:45:43 -0000	1.34
+++ meta_payee.c	9 Aug 2009 18:31:42 -0000	1.35
@@ -28,10 +28,10 @@
 #include "./gsb_data_payee.h"
 #include "./gsb_data_transaction.h"
 #include "./utils_str.h"
+#include "./tiers_onglet.h"
 #include "./metatree.h"
 #include "./include.h"
 #include "./gsb_real.h"
-#include "./tiers_onglet.h"
 /*END_INCLUDE*/
 
 

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- gsb_file_save.c	22 Jul 2009 19:45:43 -0000	1.135
+++ gsb_file_save.c	9 Aug 2009 18:31:42 -0000	1.136
@@ -1905,7 +1905,7 @@
 
 	partial_balance_number = gsb_data_partial_balance_get_number ( list_tmp -> data );
 
-	new_string = g_markup_printf_escaped ( "\t<Partial_balance Nb=\"%d\" Na=\"%s\" Acc=\"%s\" kind=\"%d\" Currency=\"%d\" />\n",
+	new_string = g_markup_printf_escaped ( "\t<Partial_balance Nb=\"%d\" Na=\"%s\" Acc=\"%s\" Kind=\"%d\" Currency=\"%d\" />\n",
 					       partial_balance_number,
 					       my_safe_null_str(gsb_data_partial_balance_get_name ( partial_balance_number )),
 					       my_safe_null_str(gsb_data_partial_balance_get_liste_cptes ( partial_balance_number )),

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- navigation.c	11 Jun 2009 20:51:55 -0000	1.125
+++ navigation.c	9 Aug 2009 18:31:42 -0000	1.126
@@ -1405,7 +1405,8 @@
     selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW(navigation_tree_view) );
     g_return_val_if_fail ( selection, FALSE );
     
-    gtk_tree_selection_get_selected ( selection, &model, &iter );
+    if ( !gtk_tree_selection_get_selected ( selection, &model, &iter ) )
+        return TRUE;
     path = gtk_tree_model_get_path ( model, &iter );
     g_return_val_if_fail ( path, TRUE );
 
@@ -1448,7 +1449,8 @@
     selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW(navigation_tree_view) );
     g_return_val_if_fail ( selection, FALSE );
     
-    gtk_tree_selection_get_selected ( selection, &model, &iter );
+    if ( !gtk_tree_selection_get_selected ( selection, &model, &iter ) )
+        return TRUE;
     path = gtk_tree_model_get_path ( model, &iter );
     g_return_val_if_fail ( path, TRUE );
 

Index: imputation_budgetaire.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/imputation_budgetaire.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- imputation_budgetaire.h	22 Jul 2009 19:45:43 -0000	1.15
+++ imputation_budgetaire.h	9 Aug 2009 18:31:42 -0000	1.16
@@ -5,10 +5,10 @@
 
 
 /* START_DECLARATION */
+gboolean budgetary_hold_position_set_expand ( gboolean expand );
+gboolean budgetary_hold_position_set_path ( GtkTreePath *path );
 gboolean gsb_budget_update_combofix ( void );
 GtkWidget *onglet_imputations ( void );
 void remplit_arbre_imputation ( void );
-gboolean budgetary_hold_position_set_expand ( gboolean expand );
-gboolean budgetary_hold_position_set_path ( GtkTreePath *path );
 /* END_DECLARATION */
 #endif

Index: gsb_data_partial_balance.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_partial_balance.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gsb_data_partial_balance.c	22 Jul 2009 19:45:42 -0000	1.1
+++ gsb_data_partial_balance.c	9 Aug 2009 18:31:42 -0000	1.2
@@ -31,10 +31,18 @@
 #include "gsb_data_partial_balance.h"
 #include "./dialog.h"
 #include "./gsb_data_account.h"
+#include "./gsb_data_currency.h"
+#include "./navigation.h"
 #include "./gsb_real.h"
+#include "./accueil.h"
 #include "./utils_str.h"
-#include "./gsb_real.h"
+#include "./utils.h"
+#include "./structures.h"
+#include "./fenetre_principale.h"
 #include "./gsb_data_account.h"
+#include "./include.h"
+#include "./erreur.h"
+#include "./gsb_real.h"
 /*END_INCLUDE*/
 
 /** \struct
@@ -55,15 +63,18 @@
 static gint gsb_data_partial_balance_cmp_func ( struct_partial_balance *partial_balance_1,
                         struct_partial_balance *partial_balance_2 );
 static gpointer gsb_data_partial_balance_get_structure ( gint partial_balance_number );
-static gboolean gsb_data_partial_balance_remove ( gint partial_balance_number );
+static void gsb_partial_balance_renumerote ( void );
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern GtkWidget *main_vbox;
+extern gint mise_a_jour_liste_comptes_accueil;
 extern gsb_real null_real;
+extern GtkWidget *window;
 /*END_EXTERN*/
 
 /** contains the g_slist of struct_partial_balance */
-static GSList *partial_balance_list = NULL;
+GSList *partial_balance_list = NULL;
 
 /** a pointer to the last partial_balance used (to increase the speed) */
 static struct_partial_balance *partial_balance_buffer;
@@ -200,6 +211,7 @@
     partial_balance_list = g_slist_insert_sorted ( partial_balance_list,
                         partial_balance,
                         (GCompareFunc) gsb_data_partial_balance_cmp_func );
+
     partial_balance_buffer = partial_balance;
 
     return partial_balance -> partial_balance_number;
@@ -223,31 +235,6 @@
 
 
 /**
- * remove a partial_balance
- *
- * \param partial_balance_number the partial_balance we want to remove
- *
- * \return TRUE ok
- * */
-gboolean gsb_data_partial_balance_remove ( gint partial_balance_number )
-{
-    struct_partial_balance *partial_balance;
-
-    partial_balance = gsb_data_partial_balance_get_structure ( partial_balance_number );
-
-    if ( !partial_balance )
-        return FALSE;
-    
-    /* remove the partial_balance from the list */
-    partial_balance_list = g_slist_remove ( partial_balance_list, partial_balance );
-
-    _gsb_data_partial_balance_free ( partial_balance );
-
-    return TRUE;
-}
-
-
-/**
  * set a new number for the partial_balance
  * normally used only while loading the file because
  * the number are given automaticly
@@ -506,6 +493,297 @@
     else
         return 1;
 }
+
+
+/** 
+ *
+ * \param 
+ * \param 
+ *
+ * */
+
+void gsb_partial_balance_fill_model ( GtkListStore *list_store, kind_account kind )
+{
+    GSList *list_tmp;
+    GtkTreeIter iter;
+    gboolean test = FALSE;
+
+    list_tmp = partial_balance_list;
+    gtk_list_store_clear ( GTK_LIST_STORE (list_store) );
+
+    if ( kind < GSB_TYPE_LIABILITIES )
+        test = TRUE;
+
+    while ( list_tmp )
+    {
+        struct_partial_balance *partial_balance;
+
+        partial_balance = list_tmp -> data;
+
+        if ( test || partial_balance -> kind == kind )
+        {
+            gchar *kind_str = "";
+            gchar *currency_str = "";
+
+            switch ( partial_balance -> kind )
+            {
+            case GSB_TYPE_CASH:
+                kind_str = g_strdup ( _("Cash account") );
+                break;
+
+            case GSB_TYPE_LIABILITIES:
+                kind_str = g_strdup ( _("Liabilities account") );
+                break;
+
+            case GSB_TYPE_ASSET:
+                kind_str = g_strdup ( _("Assets account") );
+                break;
+
+            default:
+                kind_str = g_strdup ( _("Bank account") );
+            }
+            currency_str = gsb_data_currency_get_name ( partial_balance -> currency );
+
+            gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
+            gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
+                        0, partial_balance -> balance_name,
+                        1, partial_balance -> liste_cptes,
+                        2, kind_str,
+                        3, currency_str,
+                        4, partial_balance -> partial_balance_number,
+                        -1);
+        }
+        list_tmp = list_tmp -> next;
+    }
+}
+
+
+/**
+ * add a partial_balance
+ *
+ * */
+void gsb_partial_balance_add ( GtkWidget *button, GtkWidget *main_widget )
+{
+    GtkTreeView *treeview;
+    GtkWidget *dialog, *label, *table, *paddingbox, * main_vbox, * vbox;
+    GtkWidget *entry_name, *entry_list, *bouton;
+    //~ GtkTreeModel *model;
+    //~ GtkTreeIter iter;
+    //~ GSList *list_tmp;
+    //~ gint partial_balance_number;
+    gint result;
+
+    devel_debug ( NULL);
+
+    dialog = gtk_dialog_new_with_buttons ( _("Add a partial balance"),
+                        GTK_WINDOW ( window ),
+                        GTK_DIALOG_MODAL,
+                        GTK_STOCK_CANCEL, 0,
+                        GTK_STOCK_OK, 1,
+                        NULL );
+    gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
+
+    main_vbox = new_vbox_with_title_and_icon ( _("Add a partial balance"), NULL );
+    gtk_box_pack_start ( GTK_BOX ( GTK_DIALOG ( dialog ) -> vbox ), main_vbox, TRUE, TRUE, 0 );
+
+    vbox = gtk_vbox_new ( FALSE, 12 );
+    gtk_box_pack_start ( GTK_BOX ( main_vbox ), vbox, TRUE, TRUE, 0 );
+    gtk_container_set_border_width ( GTK_CONTAINER ( vbox ), 12 );
+
+    paddingbox = new_paddingbox_with_title ( vbox,FALSE, _("Details") );
+
+    /* Create table */
+    table = gtk_table_new ( 5, 2, FALSE );
+    gtk_table_set_col_spacings ( GTK_TABLE ( table ), 5 );
+    gtk_table_set_row_spacings ( GTK_TABLE ( table ), 5 );
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), table, TRUE, TRUE, 0 );
+
+    /* Partial balance name */
+    label = gtk_label_new ( COLON ( _("Name") ) );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1 );
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_RIGHT );
+    gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1,
+		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+    entry_name = gtk_entry_new ( );
+    gtk_entry_set_activates_default ( GTK_ENTRY ( entry_name ), TRUE );
+    gtk_table_attach ( GTK_TABLE ( table ), entry_name, 1, 2, 0, 1,
+		       GTK_EXPAND|GTK_FILL, 0, 0, 0 );
+
+    /* List of the accounts */
+    label = gtk_label_new ( COLON ( _("Accounts list") ) );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1);
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2,
+		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+    entry_list = gtk_entry_new ();
+    gtk_table_attach ( GTK_TABLE ( table ), entry_list, 1, 2, 1, 2,
+		       GTK_EXPAND|GTK_FILL, 0, 0, 0 );
+
+    /* create the position */
+    label = gtk_label_new ( COLON ( _("Position in the list of accounts") ) );
+    gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1);
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 2, 3,
+		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+    bouton = gtk_spin_button_new_with_range ( 1.0, 100.0, 1.0);
+    gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( bouton ),
+                        g_slist_length ( partial_balance_list ) + 1 );
+    gtk_table_attach ( GTK_TABLE ( table ), bouton, 1, 2, 2, 3,
+		       GTK_EXPAND | GTK_FILL, 0, 0, 0 );
+
+dialog_return:
+    gtk_widget_show_all ( GTK_WIDGET ( dialog ) );
+    result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
+
+    if ( result == 1)
+    {
+        const gchar *name, *list;
+        gint position;
+
+        name = gtk_entry_get_text ( GTK_ENTRY ( entry_name ) );
+        list = gtk_entry_get_text ( GTK_ENTRY ( entry_list ) );
+        //~ kind = gtk_entry_get_text ( GTK_ENTRY ( entry_kind ) );
+
+        if ( strlen ( name ) && strlen ( list ) )
+        {
+            //~ currency_name = gtk_entry_get_text ( GTK_ENTRY ( entry_currency ));
+            position = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( bouton ) );
+            treeview = g_object_get_data ( G_OBJECT (main_widget), "treeview" );
+            //~ if ( !gtk_tree_selection_get_selected (
+                                //~ gtk_tree_view_get_selection (treeview),
+                                //~ &model,
+                                //~ &iter ))
+                //~ return;
+
+            //~ gtk_tree_model_get ( model, &iter, 4, &partial_balance_number, -1 );
+
+            //~ if ( partial_balance_number > 0 )
+            //~ {
+            //~ list_tmp = partial_balance_list;
+            //~ while ( list_tmp )
+            //~ {
+                //~ struct_partial_balance *partial_balance;
+
+                //~ partial_balance = list_tmp -> data;
+
+                //~ if ( partial_balance -> partial_balance_number == partial_balance_number )
+                //~ {
+                    //~ GtkWidget *del_button;
+                    //~ gint partial_balance_kind;
+
+                    //~ partial_balance_kind = partial_balance -> kind;
+                    //~ partial_balance_list = g_slist_remove (
+                            //~ partial_balance_list, partial_balance );
+                    //~ gsb_partial_balance_fill_model ( GTK_LIST_STORE ( model ),
+                            //~ partial_balance_kind );
+                    //~ del_button = g_object_get_data ( G_OBJECT (main_widget), "remove_button" );
+                    //~ gtk_widget_set_sensitive ( button, FALSE );
+                    //~ break;
+                //~ }
+                //~ list_tmp = list_tmp -> next;
+            //~ }
+            //~ }
+        }
+        else
+        {
+            dialogue_warning_hint ( _("The name of the partial balance "
+                        "and the list of accounts must be completed."),
+                        _("All fields are not filled in") );
+            goto dialog_return;
+        }
+    }
+    gtk_widget_destroy ( GTK_WIDGET ( dialog ));
+}
+
+
+/**
+ * remove a partial_balance
+ *
+ * */
+void gsb_partial_balance_delete ( GtkWidget *button, GtkWidget *main_widget )
+{
+    GtkTreeView *treeview;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GSList *list_tmp;
+    gint partial_balance_number;
+
+    treeview = g_object_get_data ( G_OBJECT (main_widget), "treeview" );
+    if ( !gtk_tree_selection_get_selected (
+                        gtk_tree_view_get_selection (treeview),
+                        &model,
+                        &iter ))
+        return;
+
+    gtk_tree_model_get ( model, &iter, 4, &partial_balance_number, -1 );
+
+    if ( partial_balance_number > 0 )
+    {
+        list_tmp = partial_balance_list;
+        while ( list_tmp )
+        {
+            struct_partial_balance *partial_balance;
+
+            partial_balance = list_tmp -> data;
+
+            if ( partial_balance -> partial_balance_number == partial_balance_number )
+            {
+                GtkWidget *del_button;
+
+                partial_balance_list = g_slist_remove (
+                        partial_balance_list, partial_balance );
+                gsb_partial_balance_renumerote ( );
+                gtk_list_store_remove  ( GTK_LIST_STORE ( model ), &iter );
+                if ( gsb_gui_navigation_get_current_page ( ) == GSB_HOME_PAGE )
+                    mise_a_jour_accueil ( TRUE );
+                else
+                    mise_a_jour_liste_comptes_accueil = ( TRUE );
+                del_button = g_object_get_data ( G_OBJECT (main_widget), "remove_button" );
+                gtk_widget_set_sensitive ( button, FALSE );
+                break;
+            }
+            list_tmp = list_tmp -> next;
+        }
+    }
+}
+
+
+gboolean gsb_partial_balance_select_func ( GtkTreeSelection *selection,
+                        GtkTreeModel *model,
+                        GtkTreePath *path,
+                        gboolean path_currently_selected,
+                        GObject *main_widget )
+{
+    GtkWidget *button;
+
+    button = g_object_get_data ( G_OBJECT (main_widget), "remove_button" );
+    gtk_widget_set_sensitive ( button, TRUE );
+
+    return TRUE;
+}
+
+
+/**
+ * renumerote la liste des soldes partiels
+ *
+ * */
+void gsb_partial_balance_renumerote ( void )
+{
+    GSList *list_tmp;
+    gint i = 1;
+
+    list_tmp = partial_balance_list;
+    while ( list_tmp )
+    {
+        struct_partial_balance *partial_balance;
+
+        partial_balance = list_tmp -> data;
+        partial_balance -> partial_balance_number = i;
+        i++;
+        list_tmp = list_tmp -> next;
+    }
+}
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -d -r1.203 -r1.204
--- accueil.c	29 Jul 2009 11:51:38 -0000	1.203
+++ accueil.c	9 Aug 2009 18:31:42 -0000	1.204
@@ -91,6 +91,7 @@
 extern GdkColor couleur_solde_alarme_verte_prelight;
 extern GtkWidget *form_transaction_part;
 extern gsb_real null_real;
+extern GSList *partial_balance_list;
 extern GSList *scheduled_transactions_taken;
 extern GSList *scheduled_transactions_to_take;
 extern gchar *titre_fichier;
@@ -472,8 +473,7 @@
 
             if ( !gsb_data_account_get_closed_account (account_number) &&
              gsb_data_account_get_currency (account_number) == currency_number
-             && gsb_data_account_get_kind (account_number) != GSB_TYPE_LIABILITIES
-             && gsb_data_account_get_kind (account_number) != GSB_TYPE_ASSET )
+             && gsb_data_account_get_kind (account_number) < GSB_TYPE_LIABILITIES )
             {
                 /* on affiche la ligne du compte avec les soldes pointé et courant */
                 gsb_main_page_affiche_ligne_du_compte  ( pTable, account_number, i );
@@ -1744,15 +1744,125 @@
 /* *******************************************************************************/
 GtkWidget *onglet_accueil (void)
 {
-    GtkWidget *vbox_pref, *paddingbox;
+    GtkWidget *vbox_pref, *vbox, *paddingbox, *button;
+    GtkWidget *hbox, *vbox2, *sw, *treeview ;
+    //~ GtkWidget *table, *label, *entry;
+    GtkListStore *list_store;
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *cell;
+    GtkTreeSelection *selection;
+    //~ gchar *texte;
+
 
     vbox_pref = new_vbox_with_title_and_icon ( _("Configuration of the main page"),
                         "title.png" );
 
+    vbox = gtk_vbox_new ( FALSE, 12 );
+    gtk_box_pack_start ( GTK_BOX ( vbox_pref ), vbox, TRUE, TRUE, 0 );
+    gtk_container_set_border_width ( GTK_CONTAINER ( vbox ), 12 );
+
     /* Data import settings */
-    paddingbox = new_paddingbox_with_title (vbox_pref, FALSE, 
+    paddingbox = new_paddingbox_with_title (vbox, FALSE, 
                         _("Balances partial of the list of bank accounts") );
 
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, TRUE, TRUE, 0);
+
+    sw = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+                        GTK_SHADOW_ETCHED_IN);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+                        GTK_POLICY_NEVER,
+                        GTK_POLICY_ALWAYS);
+    gtk_box_pack_start ( GTK_BOX (hbox), sw, TRUE,TRUE, 0 );
+
+    /* Create Add/Remove buttons */
+    vbox2 = gtk_vbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), vbox2, FALSE, FALSE, 0 );
+
+    /* Button "Add" */
+    button = gtk_button_new_from_stock (GTK_STOCK_ADD);
+    g_signal_connect ( G_OBJECT ( button ),
+                        "clicked",
+                        G_CALLBACK  ( gsb_partial_balance_add ),
+                        vbox_pref );
+    gtk_box_pack_start ( GTK_BOX ( vbox2 ), button, FALSE, FALSE, 5 );
+    g_object_set_data ( G_OBJECT (vbox_pref), "add_button", button );
+
+    /* Button "Remove" */
+    button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+    g_signal_connect ( G_OBJECT ( button ),
+                        "clicked",
+                        G_CALLBACK ( gsb_partial_balance_delete ),
+                        vbox_pref );
+    gtk_box_pack_start ( GTK_BOX ( vbox2 ), button, FALSE, FALSE, 5 );
+    gtk_widget_set_sensitive ( button, FALSE );
+    g_object_set_data ( G_OBJECT (vbox_pref), "remove_button", button );
+
+    /* create the model */
+    list_store = gtk_list_store_new ( 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                        G_TYPE_STRING, G_TYPE_INT );
+
+    /* remplit le modèle si nécessaire */
+    if ( g_slist_length ( partial_balance_list ) > 0 )
+        gsb_partial_balance_fill_model ( list_store, 0 );
+
+    /* create the treeview */
+    treeview = gtk_tree_view_new_with_model (
+                        GTK_TREE_MODEL (list_store) );
+    g_object_unref (list_store);
+
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
+    gtk_widget_set_size_request ( treeview, -1, 230 );
+    selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (treeview) );
+    gtk_tree_selection_set_select_function ( selection,
+                        (GtkTreeSelectionFunc) gsb_partial_balance_select_func,
+                        vbox_pref, NULL );
+    gtk_container_add (GTK_CONTAINER (sw), treeview);
+    gtk_container_set_resize_mode (GTK_CONTAINER (sw), GTK_RESIZE_PARENT);
+    g_object_set_data ( G_OBJECT (vbox_pref), "treeview", treeview );
+
+    /* Nom du solde partiel */
+    cell = gtk_cell_renderer_text_new ( );
+    column = gtk_tree_view_column_new_with_attributes ( _("Partial balance"),
+                        cell, "text", 0, NULL);
+    gtk_tree_view_column_set_expand ( column, TRUE );
+    gtk_tree_view_column_set_alignment ( column, 0.5 );
+    gtk_tree_view_column_set_sort_column_id (column, 0);
+    gtk_tree_view_append_column ( GTK_TREE_VIEW (treeview), column);
+
+    /* Liste des comptes */
+    cell = gtk_cell_renderer_text_new ( );
+    g_object_set (cell, "editable", TRUE, NULL);
+    //~ g_signal_connect ( cell,
+                        //~ "edited",
+                        //~ G_CALLBACK (gsb_import_associations_cell_edited),
+                        //~ vbox_main );
+    column = gtk_tree_view_column_new_with_attributes ( _("Accounts list"),
+                        cell, "text", 1, NULL);
+    gtk_tree_view_column_set_expand ( column, TRUE );
+    gtk_tree_view_column_set_alignment ( column, 0.5 );
+    gtk_tree_view_column_set_sort_column_id (column, 1);
+    gtk_tree_view_append_column ( GTK_TREE_VIEW (treeview), column);
+
+    /* Type de compte */
+    cell = gtk_cell_renderer_text_new ( );
+    column = gtk_tree_view_column_new_with_attributes ( _("Account kind"),
+                        cell, "text", 2, NULL);
+    gtk_tree_view_column_set_expand ( column, TRUE );
+    gtk_tree_view_column_set_alignment ( column, 0.5 );
+    gtk_tree_view_column_set_sort_column_id (column, 2);
+    gtk_tree_view_append_column ( GTK_TREE_VIEW (treeview), column);
+
+    /* Devise */
+    cell = gtk_cell_renderer_text_new ( );
+    column = gtk_tree_view_column_new_with_attributes ( _("Currency"),
+                        cell, "text", 3, NULL);
+    gtk_tree_view_column_set_expand ( column, TRUE );
+    gtk_tree_view_column_set_alignment ( column, 0.5 );
+    gtk_tree_view_column_set_sort_column_id (column, 3);
+    gtk_tree_view_append_column ( GTK_TREE_VIEW (treeview), column);
+
     gtk_widget_show_all ( vbox_pref );
 
     return ( vbox_pref );

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- gsb_data_account.c	29 Jul 2009 12:13:45 -0000	1.86
+++ gsb_data_account.c	9 Aug 2009 18:31:42 -0000	1.87
@@ -127,6 +127,7 @@
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern gboolean balances_with_scheduled;
 extern gsb_real error_real;
 extern gsb_real null_real;
 extern gint tab_affichage_ope[TRANSACTION_LIST_ROWS_NB][CUSTOM_MODEL_VISIBLE_COLUMNS];
@@ -990,8 +991,11 @@
     gint res = 0;
 
 	transaction_number = gsb_data_transaction_get_transaction_number (tmp_list->data);
-    /* on calcule le solde à la date du jour */
-    res = g_date_compare ( date_jour,
+    /* on regarde si on tient compte ou pas des échéances pour les soldes */
+    if ( balances_with_scheduled )
+        res = 0;
+    else
+        res = g_date_compare ( date_jour,
                         gsb_data_transaction_get_date ( transaction_number ) );
 	if ( gsb_data_transaction_get_account_number (transaction_number) == account_number
 	     &&

Index: gsb_file_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_config.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- gsb_file_config.c	27 Jun 2009 20:50:40 -0000	1.79
+++ gsb_file_config.c	9 Aug 2009 18:31:42 -0000	1.80
@@ -60,6 +60,7 @@
 
 
 /*START_EXTERN*/
+extern gboolean balances_with_scheduled;
 extern gboolean execute_scheduled_of_month;
 extern GtkWidget *main_hpaned;
 extern gint max;
@@ -303,6 +304,15 @@
                         "Execute scheduled of month",
                         NULL );
 
+    int_ret = g_key_file_get_integer ( config,
+                        "Scheduled",
+                        "Balances with scheduled",
+                        &err );
+    if ( err == NULL )
+        balances_with_scheduled = int_ret;
+    else
+        err = NULL;
+
     /* get shown section */
     etat.formulaire_toujours_affiche = g_key_file_get_integer ( config,
                         "Display",
@@ -630,6 +640,10 @@
                         "Scheduled",
                         "Execute scheduled of month",
                         execute_scheduled_of_month );
+    g_key_file_set_integer ( config,
+                        "Scheduled",
+                        "Balances with scheduled",
+                        balances_with_scheduled );
 
     /* save shown section */
     g_key_file_set_integer ( config,
@@ -1192,6 +1206,7 @@
     etat.entree = 1;    /* la touche entree provoque l'enregistrement de l'opération */
     nb_days_before_scheduled = 0;     /* nb de jours avant l'échéance pour prévenir */
     execute_scheduled_of_month = FALSE;
+    balances_with_scheduled = TRUE;
     etat.formulaire_toujours_affiche = 0;       /* le formulaire ne s'affiche que lors de l'edition d'1 opé */
     etat.affichage_exercice_automatique = 0;        /* l'exercice est choisi en fonction de la date */
     etat.get_fyear_by_value_date = 0;        /* By default use transaction-date */

Index: gsb_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- gsb_scheduler.c	10 May 2009 13:06:56 -0000	1.25
+++ gsb_scheduler.c	9 Aug 2009 18:31:42 -0000	1.26
@@ -68,6 +68,8 @@
 /** warn/execute scheduled at expiration (FALSE) or of the month (TRUE) */
 gboolean execute_scheduled_of_month;
 
+/** Take into account the planned operations in the calculation of the balances (TRUE default) */
+gboolean balances_with_scheduled;
 
 
 /**

Index: categories_onglet.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/categories_onglet.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- categories_onglet.h	22 Jul 2009 19:45:42 -0000	1.19
+++ categories_onglet.h	9 Aug 2009 18:31:42 -0000	1.20
@@ -7,9 +7,9 @@
 
 
 /* START_DECLARATION */
-GtkWidget *onglet_categories ( void );
-void remplit_arbre_categ ( void );
 gboolean category_hold_position_set_expand ( gboolean expand );
 gboolean category_hold_position_set_path ( GtkTreePath *path );
+GtkWidget *onglet_categories ( void );
+void remplit_arbre_categ ( void );
 /* END_DECLARATION */
 #endif

Index: utils_files.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_files.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- utils_files.c	23 May 2009 19:25:10 -0000	1.41
+++ utils_files.c	9 Aug 2009 18:31:42 -0000	1.42
@@ -367,8 +367,8 @@
  */
 gboolean utils_files_create_XDG_dir (void)
 {
-    if ( g_mkdir_with_parents ( C_PATH_CONFIG, 450 ) == 0 &&
-         g_mkdir_with_parents ( C_PATH_DATA_FILES, 450 ) == 0 )
+    if ( g_mkdir_with_parents ( C_PATH_CONFIG, S_IRUSR | S_IWUSR | S_IXUSR ) == 0 &&
+         g_mkdir_with_parents ( C_PATH_DATA_FILES, S_IRUSR | S_IWUSR | S_IXUSR ) == 0 )
         return TRUE;
     else
         return FALSE;

Index: transaction_list_select.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list_select.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- transaction_list_select.c	3 May 2009 19:53:18 -0000	1.7
+++ transaction_list_select.c	9 Aug 2009 18:31:42 -0000	1.8
@@ -31,7 +31,10 @@
 
 /*START_INCLUDE*/
 #include "transaction_list_select.h"
+#include "./gsb_data_account.h"
 #include "./gsb_data_transaction.h"
+#include "./barre_outils.h"
+#include "./menu.h"
 #include "./gsb_transactions_list.h"
 #include "./transaction_model.h"
 #include "./custom_list.h"
@@ -94,6 +97,20 @@
 	record = iter.user_data;
     }
 
+    /* si l'opération n'est pas visible on la rend visible */
+    if ( ( record -> mother_row && record -> mother_row -> filtered_pos == -1 )
+     ||
+     record -> filtered_pos == -1 )
+    {
+        gint account_number;
+
+        account_number = gsb_data_transaction_get_account_number ( transaction_number );
+        gsb_data_account_set_r ( account_number, TRUE );
+        gsb_gui_update_bouton_affiche_ope_r ( TRUE );
+        gsb_menu_update_view_menu ( account_number );
+        mise_a_jour_affichage_r ( TRUE );
+    }
+
     return_value = transaction_list_select_record (record);
 
     /* if we are on a child, open the expander if necessary */
@@ -408,32 +425,41 @@
 
     if (record)
     {
-	/* get the path of the row */
-	path = gtk_tree_path_new ();
-	if (record -> mother_row)
-	    /* it's a child, need to get the path of the mother */
-	    gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);
+        /* si l'opération n'est pas visible on sort */
+        if ( ( record -> mother_row && record -> mother_row -> filtered_pos == -1 )
+         ||
+         record -> filtered_pos == -1 )
+        {
+            custom_list -> selected_row = NULL;
+            return;
+        }
 
-	gtk_tree_path_append_index (path, record -> filtered_pos);
+        /* get the path of the row */
+        path = gtk_tree_path_new ();
+        if (record -> mother_row)
+            /* it's a child, need to get the path of the mother */
+            gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);
 
-	for (i=0 ; i < custom_list -> nb_rows_by_transaction ; i++)
-	{
-	    record -> row_bg = record -> row_bg_save;
-	    record -> row_bg_save = NULL;
+        gtk_tree_path_append_index (path, record -> filtered_pos);
 
-	    /* inform the world that the row has changed */
-	    iter.user_data = record;
-	    gtk_tree_model_row_changed(GTK_TREE_MODEL(custom_list), path, &iter);
+        for (i=0 ; i < custom_list -> nb_rows_by_transaction ; i++)
+        {
+            record -> row_bg = record -> row_bg_save;
+            record -> row_bg_save = NULL;
 
-	    /* if the selection was a child, we stop now, only 1 line */
-	    if (record -> mother_row)
-		break;
+            /* inform the world that the row has changed */
+            iter.user_data = record;
+            gtk_tree_model_row_changed(GTK_TREE_MODEL(custom_list), path, &iter);
 
-	    /* go to the next row of the transaction */
-	    record = custom_list -> visibles_rows [record -> filtered_pos + 1];
-	    gtk_tree_path_next (path);
-	}
-	gtk_tree_path_free (path);
+            /* if the selection was a child, we stop now, only 1 line */
+            if (record -> mother_row)
+            break;
+
+            /* go to the next row of the transaction */
+            record = custom_list -> visibles_rows [record -> filtered_pos + 1];
+            gtk_tree_path_next (path);
+        }
+        gtk_tree_path_free (path);
     }
     custom_list -> selected_row = NULL;
 }
@@ -468,9 +494,10 @@
 
     /* get the path of the row we want to select */
     path = gtk_tree_path_new ();
-    if (record -> mother_row)
-	/* it's a child, need to get the path of the mother */
-	gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);
+    if ( record -> mother_row )
+        /* it's a child, need to get the path of the mother */
+        gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);
+
     gtk_tree_path_append_index (path, record -> filtered_pos);
 
     /* colorize the record */

Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- parametres.c	26 Jul 2009 12:00:00 -0000	1.199
+++ parametres.c	9 Aug 2009 18:31:42 -0000	1.200
@@ -47,9 +47,9 @@
 #include "./gsb_payment_method_config.h"
 #include "./gsb_reconcile_config.h"
 #include "./gsb_reconcile_sort_config.h"
+#include "./accueil.h"
 #include "./traitement_variables.h"
 #include "./utils_files.h"
-#include "./accueil.h"
 #include "./affichage_liste.h"
 #include "./affichage.h"
 #include "./tiers_onglet.h"
@@ -66,6 +66,7 @@
 static gboolean gsb_config_metatree_sort_transactions ( GtkWidget *checkbutton,
                         gpointer null );
 static  GtkWidget *gsb_config_scheduler_page ( void );
+static gboolean gsb_config_scheduler_switch_balances_with_scheduled ( void );
 static gboolean gsb_gui_messages_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
                         GtkTreeModel * model );
 static GtkWidget *onglet_fichier ( void );
@@ -92,8 +93,10 @@
 
 
 /*START_EXTERN*/
+extern gboolean balances_with_scheduled;
 extern gboolean execute_scheduled_of_month;
 extern struct conditional_message messages[];
+extern gint mise_a_jour_liste_comptes_accueil;
 extern gint nb_days_before_scheduled;
 extern gint nb_max_derniers_fichiers_ouverts;
 extern GtkWidget *window;
@@ -673,7 +676,7 @@
     GtkWidget *label;
     GtkWidget *button;
     GtkWidget *dialog;
-devel_debug (NULL);
+
     vbox_pref = new_vbox_with_title_and_icon ( _("Files"), "files.png" );
 
     /* Account file handling */
@@ -914,7 +917,7 @@
  * */
 static GtkWidget *gsb_config_scheduler_page ( void )
 {
-    GtkWidget *vbox_pref;
+    GtkWidget *vbox_pref, *paddingbox;
     GtkWidget *hbox;
     GtkWidget *label;
     GtkWidget *entry;
@@ -932,7 +935,7 @@
                         NULL, NULL );
 
     hbox = gtk_hbox_new ( FALSE, 0);
-    gtk_box_pack_start ( GTK_BOX (vbox_pref), hbox, FALSE, FALSE, 0);
+    gtk_box_pack_start ( GTK_BOX ( vbox_pref ), hbox, FALSE, FALSE, 0 );
 
     label = gtk_label_new ( SPACIFY ( COLON (
                         _("Number of days before the warning or the execution"))) );
@@ -941,10 +944,51 @@
     entry = gsb_automem_spin_button_new ( &nb_days_before_scheduled, NULL, NULL );
     gtk_box_pack_start ( GTK_BOX (hbox), entry, FALSE, FALSE, 0 );
 
+    /* Take into account the planned operations in the calculation of balances */
+    paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE, _("Calculation of balances") );
+
+    hbox = gtk_hbox_new ( FALSE, 0 );
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0 );
+
+    button = gsb_automem_checkbutton_new (
+                        _("Take into account the scheduled operations "
+                          "in the calculation of balances"),
+                        &balances_with_scheduled,
+                        G_CALLBACK ( gsb_config_scheduler_switch_balances_with_scheduled ),
+                        NULL );
+
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
+
     return vbox_pref;
 }
 
 
+gboolean gsb_config_scheduler_switch_balances_with_scheduled ( void )
+{
+    GSList *list_tmp;
+
+    devel_debug ( NULL );
+
+    list_tmp = gsb_data_account_get_list_accounts ();
+
+    while ( list_tmp )
+    {
+        gint account_number;
+
+        account_number = gsb_data_account_get_no_account ( list_tmp -> data );
+        gsb_data_account_set_balances_are_dirty ( account_number );
+
+        if ( gsb_gui_navigation_get_current_page ( ) == GSB_HOME_PAGE )
+            mise_a_jour_accueil ( TRUE );
+        else
+            mise_a_jour_liste_comptes_accueil = ( TRUE );
+
+        list_tmp = list_tmp -> next;
+    }
+    return FALSE;
+}
+
+
 /**
  * create the metatree config page
  *
@@ -981,10 +1025,8 @@
 {
     gint page_number;
 
-    devel_debug_int (etat.metatree_sort_transactions);
-
     page_number = gsb_gui_navigation_get_current_page ( );
-    devel_debug_int ( page_number );
+
     switch ( page_number )
     {
 	case GSB_PAYEES_PAGE:



More information about the cvs mailing list