[grisbi-cvs] grisbi/src balance_estimate_data.c, 1.27, 1.28 balance_estimate_data.h, 1.18, 1.19 balance_estimate_future.c, 1.13, 1.14 balance_estimate_hist.c, 1.25, 1.26 balance_estimate_tab.c, 1.70, 1.71 balance_estimate_tab.h, 1.17, 1.18 gsb_data_transaction.c, 1.91, 1.92 gsb_file_load.c, 1.223, 1.224 gsb_form.c, 1.166, 1.167 gsb_transactions_list.c, 1.212, 1.213 import.c, 1.334, 1.335

Pierre Biava pbiava at users.sourceforge.net
Sun May 23 23:05:46 CEST 2010


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

Modified Files:
	balance_estimate_data.c balance_estimate_data.h 
	balance_estimate_future.c balance_estimate_hist.c 
	balance_estimate_tab.c balance_estimate_tab.h 
	gsb_data_transaction.c gsb_file_load.c gsb_form.c 
	gsb_transactions_list.c import.c 
Log Message:
Works in the budgetary module. Adding transfert between accounts

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- gsb_data_transaction.c	18 May 2010 20:12:54 -0000	1.91
+++ gsb_data_transaction.c	23 May 2010 21:05:42 -0000	1.92
@@ -45,10 +45,8 @@
 #include "./utils_dates.h"
 #include "./gsb_real.h"
 #include "./utils_str.h"
-#include "./balance_estimate_data.h"
 #include "./include.h"
 #include "./structures.h"
-#include "./gsb_real.h"
 /*END_INCLUDE*/
 
 

Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- balance_estimate_data.h	18 May 2010 20:12:54 -0000	1.18
+++ balance_estimate_data.h	23 May 2010 21:05:42 -0000	1.19
@@ -59,6 +59,9 @@
     gint sub_budgetary_number;
     gchar *notes;
 
+    gboolean is_transfert;
+    gint account_transfert;
+
     gint frequency;                     /*  0=once, 1=week, 2=month, 5=year, 6=perso */
     gint user_interval;					/*  0=days, 1= week 2=month, 3=years */
     gint user_entry;
@@ -72,7 +75,7 @@
     gint number;
     gint account_number;
     gint type;
-    gint replace_account;
+    gint replace_account;       /* Account number or partial balance concerned */
     gint replace_transaction;
     gint auto_inc_month;
     GDate *date;

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- gsb_transactions_list.c	18 May 2010 20:12:54 -0000	1.212
+++ gsb_transactions_list.c	23 May 2010 21:05:43 -0000	1.213
@@ -59,7 +59,6 @@
 #include "./transaction_list_select.h"
 #include "./transaction_list_sort.h"
 #include "./transaction_model.h"
-#include "./balance_estimate_data.h"
 #include "./structures.h"
 #include "./custom_list.h"
 #include "./fenetre_principale.h"
@@ -68,7 +67,6 @@
 #include "./mouse.h"
 #include "./dialog.h"
 #include "./erreur.h"
-#include "./gsb_real.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- gsb_form.c	20 May 2010 21:14:54 -0000	1.166
+++ gsb_form.c	23 May 2010 21:05:43 -0000	1.167
@@ -71,7 +71,6 @@
 #include "./transaction_list.h"
 #include "./transaction_list_select.h"
 #include "./utils_operations.h"
-#include "./balance_estimate_data.h"
 #include "./fenetre_principale.h"
 #include "./gsb_data_payment.h"
 #include "./gtk_combofix.h"
@@ -83,7 +82,6 @@
 #include "./include.h"
 #include "./structures.h"
 #include "./erreur.h"
-#include "./gsb_real.h"
 #include "./gsb_form_widget.h"
 /*END_INCLUDE*/
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- balance_estimate_tab.h	18 May 2010 20:12:54 -0000	1.17
+++ balance_estimate_tab.h	23 May 2010 21:05:42 -0000	1.18
@@ -32,6 +32,7 @@
                         GtkTreeIter *iter,
                         GDate *date_min,
                         GDate *date_max );
+gboolean bet_array_list_select_path ( GtkWidget *tree_view, GtkTreePath *path );
 void bet_array_update_estimate_tab ( gint account_number, gint type_maj );
 /* END_DECLARATION */
 

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -d -r1.334 -r1.335
--- import.c	18 May 2010 20:12:54 -0000	1.334
+++ import.c	23 May 2010 21:05:43 -0000	1.335
@@ -71,7 +71,6 @@
 #include "./qif.h"
 #include "./transaction_list.h"
 #include "./utils_files.h"
-#include "./balance_estimate_data.h"
 #include "./structures.h"
 #include "./gsb_transactions_list.h"
 #include "./go-charmap-sel.h"
@@ -82,7 +81,6 @@
 #include "./gsb_data_transaction.h"
 #include "./gsb_form_scheduler.h"
 #include "./erreur.h"
-#include "./gsb_real.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -d -r1.223 -r1.224
--- gsb_file_load.c	8 May 2010 05:54:13 -0000	1.223
+++ gsb_file_load.c	23 May 2010 21:05:42 -0000	1.224
@@ -79,7 +79,6 @@
 #include "./gsb_real.h"
 #include "./gsb_currency_config.h"
 #include "./gsb_data_report.h"
-#include "./balance_estimate_data.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/
@@ -3972,6 +3971,20 @@
         continue;
     }
 
+    if ( !strcmp ( attribute_names[i], "IsT" ) )
+    {
+        scheduled -> is_transfert =  utils_str_atoi ( attribute_values[i] );
+        i++;
+        continue;
+    }
+
+    if ( !strcmp ( attribute_names[i], "Tra" ) )
+    {
+        scheduled -> account_transfert =  utils_str_atoi ( attribute_values[i] );
+        i++;
+        continue;
+    }
+
     if ( !strcmp ( attribute_names[i], "Ca" ) )
     {
         scheduled -> category_number = utils_str_atoi ( attribute_values[i] );

Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- balance_estimate_data.c	18 May 2010 20:12:54 -0000	1.27
+++ balance_estimate_data.c	23 May 2010 21:05:42 -0000	1.28
@@ -53,7 +53,8 @@
 
 /*START_STATIC*/
 static GDate *bet_data_futur_get_next_date ( struct_futur_data *scheduled,
-				     const GDate *date );
+				        const GDate *date,
+                        const GDate *date_max );
 static struct_futur_data *bet_data_future_copy_struct ( struct_futur_data *scheduled );
 static void bet_data_future_set_max_number ( gint number );
 static gboolean bet_data_update_div ( SH *sh, gint transaction_number, gint sub_div );
@@ -97,6 +98,7 @@
 void bet_data_select_bet_pages ( gint account_number )
 {
     GtkWidget *page;
+    GtkWidget *tree_view;
     kind_account kind;
     gint current_page;
     gint bet_use_budget;
@@ -109,11 +111,14 @@
     if ( bet_use_budget <= 0 )
         kind = GSB_TYPE_ASSET;
 
+    tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_estimate_treeview" );
+
     switch ( kind )
     {
     case GSB_TYPE_BANK:
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
         gtk_widget_show ( page );
+        bet_array_list_select_path ( tree_view, NULL );
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
         gtk_widget_show ( page );
         bet_historical_g_signal_unblock_tree_view ( );
@@ -136,6 +141,7 @@
     case GSB_TYPE_LIABILITIES:
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
         gtk_widget_show ( page );
+        bet_array_list_select_path ( tree_view, NULL );
         if ( current_page == GSB_HISTORICAL_PAGE )
             gtk_notebook_set_current_page ( GTK_NOTEBOOK ( account_page ), GSB_ESTIMATE_PAGE );
         page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( account_page ), GSB_HISTORICAL_PAGE );
@@ -176,8 +182,6 @@
 
     kind = gsb_data_account_get_kind ( account_number );
 
-    printf ("account_number = %d kind = %d page = %d type_maj = %d\n",
-                        account_number, kind, page, type_maj );
 
     if ( page == -1 && gsb_gui_navigation_get_current_page ( ) == GSB_ACCOUNT_PAGE )
         page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_page ) );
@@ -837,14 +841,16 @@
         limit_date = gsb_format_gdate_safe ( scheduled -> limit_date );
 
         tmp_str = g_markup_printf_escaped ( "\t<Bet_future Nb=\"%d\" Dt=\"%s\" Ac=\"%d\" "
-                        "Am=\"%s\" Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Pn=\"%d\" "
-                        "Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" No=\"%s\" Au=\"0\" "
+                        "Am=\"%s\" Pa=\"%d\" IsT=\"%d\" Tra=\"%d\" Ca=\"%d\" Sca=\"%d\" "
+                        "Pn=\"%d\" Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" No=\"%s\" Au=\"0\" "
                         "Pe=\"%d\" Pei=\"%d\" Pep=\"%d\" Dtl=\"%s\" Mo=\"%d\" />\n",
 					    scheduled -> number,
 					    my_safe_null_str ( date ),
 					    scheduled -> account_number,
 					    my_safe_null_str ( amount ),
 					    scheduled -> party_number,
+                        scheduled -> is_transfert,
+                        scheduled -> account_transfert,
 					    scheduled -> category_number,
 					    scheduled -> sub_category_number,
 					    scheduled -> payment_number,
@@ -1127,9 +1133,10 @@
         mother_row = future_number;
 
         date_max = bet_data_array_get_date_max ( scheduled -> account_number );
+
         /* we don't change the initial date */
         date = gsb_date_copy ( scheduled -> date );
-        while ( date != NULL && g_date_valid ( date ) && g_date_compare ( date, date_max ) <= 0 )
+        while ( date != NULL && g_date_valid ( date ) )
         {
             if ( scheduled -> account_number == 0 )
                 key = g_strconcat ("0:", utils_str_itoa ( future_number ), NULL );
@@ -1145,7 +1152,7 @@
             new_sch -> number = future_number;
             g_hash_table_insert ( bet_future_list, key, new_sch );
 
-            date = bet_data_futur_get_next_date ( new_sch, date );
+            date = bet_data_futur_get_next_date ( new_sch, date, date_max );
             if ( date == NULL )
                 break;
             future_number ++;
@@ -1221,7 +1228,8 @@
  * \return a newly allocated date, the next date or NULL if over the limit
  * */
 GDate *bet_data_futur_get_next_date ( struct_futur_data *scheduled,
-				     const GDate *date )
+				        const GDate *date,
+                        const GDate *date_max )
 {
     GDate *return_date;
 
@@ -1291,12 +1299,22 @@
 	    break;
     }
 
-    if ( scheduled -> limit_date
-	 &&
-	 g_date_compare ( return_date, scheduled -> limit_date ) > 0 )
+    if ( scheduled -> limit_date )
     {
-        g_date_free (return_date);
-        return_date = NULL;
+	 
+	    if ( g_date_compare ( return_date, scheduled -> limit_date ) > 0 )
+        {
+            g_date_free (return_date);
+            return_date = NULL;
+        }
+    }
+    else
+    {
+        if ( g_date_compare ( return_date, date_max ) > 0 )
+        {
+            g_date_free (return_date);
+            return_date = NULL;
+        }
     }
     
     return ( return_date );
@@ -1311,42 +1329,50 @@
  * */
 struct_futur_data *bet_data_future_copy_struct ( struct_futur_data *scheduled )
 {
-    struct_futur_data *new_sch;
+    struct_futur_data *new_scheduled;
 
-    new_sch = struct_initialise_bet_future ( );
+    new_scheduled = struct_initialise_bet_future ( );
 
-    new_sch ->  number = scheduled -> number;
-    new_sch ->  account_number = scheduled -> account_number;
+    if ( !new_scheduled )
+    {
+        dialogue_error_memory ();
+        return NULL;
+    }
+
+    new_scheduled ->  number = scheduled -> number;
+    new_scheduled ->  account_number = scheduled -> account_number;
 
     if ( g_date_valid ( scheduled -> date ) )
-        new_sch -> date = gsb_date_copy ( scheduled -> date );
+        new_scheduled -> date = gsb_date_copy ( scheduled -> date );
     else
-        new_sch -> date = NULL;
+        new_scheduled -> date = NULL;
 
-    new_sch -> amount = gsb_real_new ( scheduled -> amount.mantissa,
+    new_scheduled -> amount = gsb_real_new ( scheduled -> amount.mantissa,
                         scheduled -> amount.exponent );
-    new_sch -> fyear_number = scheduled -> fyear_number;
-    new_sch -> payment_number = scheduled -> payment_number;
+    new_scheduled -> fyear_number = scheduled -> fyear_number;
+    new_scheduled -> payment_number = scheduled -> payment_number;
 
-    new_sch -> party_number = scheduled -> party_number;
-    new_sch -> category_number = scheduled -> category_number;
-    new_sch -> sub_category_number = scheduled -> sub_category_number;
-    new_sch -> budgetary_number = scheduled -> budgetary_number;
-    new_sch -> sub_budgetary_number = scheduled -> sub_budgetary_number;
-    new_sch -> notes = g_strdup ( scheduled -> notes );
+    new_scheduled -> party_number = scheduled -> party_number;
+    new_scheduled -> is_transfert = scheduled -> is_transfert;
+    new_scheduled -> account_transfert = scheduled -> account_transfert;
+    new_scheduled -> category_number = scheduled -> category_number;
+    new_scheduled -> sub_category_number = scheduled -> sub_category_number;
+    new_scheduled -> budgetary_number = scheduled -> budgetary_number;
+    new_scheduled -> sub_budgetary_number = scheduled -> sub_budgetary_number;
+    new_scheduled -> notes = g_strdup ( scheduled -> notes );
 
-    new_sch -> frequency = scheduled -> frequency;
-    new_sch -> user_interval = scheduled -> user_interval;
-    new_sch -> user_entry = scheduled -> user_entry;
+    new_scheduled -> frequency = scheduled -> frequency;
+    new_scheduled -> user_interval = scheduled -> user_interval;
+    new_scheduled -> user_entry = scheduled -> user_entry;
 
     if ( scheduled -> limit_date && g_date_valid ( scheduled -> limit_date ) )
-        new_sch -> limit_date = gsb_date_copy ( scheduled -> limit_date );
+        new_scheduled -> limit_date = gsb_date_copy ( scheduled -> limit_date );
     else
-        new_sch -> limit_date = NULL;
+        new_scheduled -> limit_date = NULL;
 
-    new_sch -> mother_row = scheduled -> mother_row;
+    new_scheduled -> mother_row = scheduled -> mother_row;
 
-    return new_sch;
+    return new_scheduled;
 }
 /**
  * supprime l'occurence sélectionnée.
@@ -1364,11 +1390,16 @@
     {
         struct_futur_data *scheduled = ( struct_futur_data *) value;
 
-        if ( account_number != scheduled -> account_number 
-         ||
-         number != scheduled -> number)
+        if ( number != scheduled -> number )
             continue;
 
+        if ( account_number != scheduled -> account_number )
+        {
+            if ( scheduled -> is_transfert == 0
+             || ( scheduled -> is_transfert && account_number != scheduled -> account_transfert ) )
+                continue;
+        }
+
         g_hash_table_iter_remove ( &iter );
 
         break;
@@ -1403,7 +1434,11 @@
         struct_futur_data *scheduled = ( struct_futur_data *) value;
 
         if ( account_number != scheduled -> account_number )
-            continue;
+        {
+            if ( scheduled -> is_transfert == 0
+             || ( scheduled -> is_transfert && account_number != scheduled -> account_transfert ) )
+                continue;
+        }
 
         if ( number == scheduled -> number )
             g_hash_table_iter_remove ( &iter );

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- balance_estimate_tab.c	18 May 2010 20:12:54 -0000	1.70
+++ balance_estimate_tab.c	23 May 2010 21:05:42 -0000	1.71
@@ -60,11 +60,9 @@
 #include "./gsb_transactions_list.h"
 #include "./traitement_variables.h"
 #include "./transaction_list_select.h"
-#include "./balance_estimate_data.h"
 #include "./structures.h"
 #include "./fenetre_principale.h"
 #include "./mouse.h"
-#include "./balance_estimate_hist.h"
 #include "./include.h"
 #include "./erreur.h"
 /*END_INCLUDE*/
@@ -109,7 +107,6 @@
 static gint bet_array_list_schedule_line ( gint origine, gint account_number, gint number );
 static void bet_array_list_schedule_selected_line ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
-static gboolean bet_array_list_select_path ( GtkWidget *tree_view, const gchar *str_path );
 static gboolean bet_array_list_set_background_color ( GtkWidget *tree_view );
 static void bet_array_list_traite_double_click ( GtkTreeView *tree_view );
 static void bet_array_list_update_balance ( GtkTreeModel *model );
@@ -355,6 +352,7 @@
     GtkWidget *tree_view;
     GtkTreeIter iter;
     GtkTreeModel *tree_model;
+    GtkTreePath *path = NULL;
     gchar *color_str = NULL;
     gchar *str_date_min;
     gchar *str_date_max;
@@ -370,11 +368,12 @@
     GValue date_value = {0, };
 
     devel_debug (NULL);
+
     tmp_range = struct_initialise_bet_range ( );
 
     /* calculate date_min and date_max with user choice */
     date_min = gsb_data_account_get_bet_start_date ( account_number );
-    
+
     date_max = bet_data_array_get_date_max ( account_number );
 
     widget = g_object_get_data ( G_OBJECT ( account_page ), "bet_initial_date");
@@ -416,9 +415,13 @@
     gtk_label_set_label ( GTK_LABEL ( widget ), title );
     g_free ( title );
 
-    /* clear the model */
     tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_estimate_treeview" );
-    tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
+    if ( gtk_tree_selection_get_selected (
+                        gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) ),
+                        &tree_model, &iter ) )
+        path = gtk_tree_model_get_path ( tree_model, &iter );
+
+    /* clear the model */
     gtk_tree_store_clear ( GTK_TREE_STORE ( tree_model ) );
 
     tmp_str = g_strdup ( _("balance beginning of period") );
@@ -475,7 +478,8 @@
                         bet_array_update_average_column, tmp_range );
 
     bet_array_list_set_background_color ( tree_view );
-    bet_array_list_select_path ( tree_view, "0" );
+    bet_array_list_select_path ( tree_view, path );
+    gtk_tree_path_free ( path );
 }
 
 
@@ -1122,9 +1126,14 @@
         gchar *str_description;
         gchar *str_amount;
         GDate *date_tomorrow;
+        gsb_real amount;
 
         if ( account_number != scheduled -> account_number )
-            continue;
+        {
+            if ( scheduled -> is_transfert == 0
+             || ( scheduled -> is_transfert && account_number != scheduled -> account_transfert ) )
+                continue;
+        }
 
         date_tomorrow = gsb_date_tomorrow ( );
         if ( g_date_compare ( scheduled -> date, date_tomorrow ) < 0 )
@@ -1148,14 +1157,18 @@
                         SPP_ORIGIN_FUTURE,
                         value );
 
-        str_amount = gsb_real_save_real_to_string ( scheduled -> amount, 2 );
+        if ( scheduled -> is_transfert )
+            amount = gsb_real_opposite ( scheduled -> amount );
+        else
+            amount = scheduled -> amount;
 
-        if ( scheduled -> amount.mantissa < 0 )
-            str_debit = gsb_real_get_string_with_currency ( gsb_real_opposite (
-                            scheduled -> amount ),
+        str_amount = gsb_real_save_real_to_string ( amount, 2 );
+
+        if ( amount.mantissa < 0 )
+            str_debit = gsb_real_get_string_with_currency ( gsb_real_opposite ( amount ),
                             bet_data_get_selected_currency ( ), TRUE );
         else
-            str_credit = gsb_real_get_string_with_currency ( scheduled -> amount,
+            str_credit = gsb_real_get_string_with_currency ( amount,
                             bet_data_get_selected_currency ( ), TRUE );
 
         str_date = gsb_format_gdate ( scheduled -> date );
@@ -1881,28 +1894,33 @@
 
 
 /**
- * select the paths of the list
+ * select path in the list
  *
- * \param tree_view, str_path
+ * \param tree_view, path
  *
  * \return FALSE
  * */
-gboolean bet_array_list_select_path ( GtkWidget *tree_view, const gchar *str_path )
+gboolean bet_array_list_select_path ( GtkWidget *tree_view, GtkTreePath *path )
 {
-    GtkTreePath *path;
     GtkTreeSelection *selection;
+    gboolean reset_pos = FALSE;
 
-    path = gtk_tree_path_new_from_string ( str_path );
     selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
 
+    if ( path == NULL )
+    {
+        path = gtk_tree_path_new_from_string ( "0" );
+        reset_pos = TRUE;
+    }
+
     gtk_widget_grab_focus ( tree_view );
     gtk_tree_selection_select_path ( selection, path );
-    gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW ( tree_view ),
+
+    if ( reset_pos )
+        gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW ( tree_view ),
 				   path, NULL,
 				   FALSE, 0.0, 0.0 );
 
-    gtk_tree_path_free ( path );
-
     return FALSE;
 }
 
@@ -2319,41 +2337,57 @@
     {
         struct_futur_data *scheduled = ( struct_futur_data * ) value;
 
-        switch ( type )
+        if ( scheduled -> is_transfert )
         {
-            case 0:
-                desc = g_strdup ( scheduled -> notes );
-                if ( desc && strlen ( desc ) )
+            if ( account_number == scheduled -> account_number )
+                desc = g_strdup_printf ( _("Transfer between account: %s\n"
+                        "and account: %s"),
+                        gsb_data_account_get_name ( account_number ),
+                        gsb_data_account_get_name ( scheduled -> account_transfert ) );
+            else
+                desc = g_strdup_printf ( _("Transfer between account: %s\n"
+                        "and account: %s"),
+                        gsb_data_account_get_name ( scheduled -> account_transfert ),
+                        gsb_data_account_get_name ( scheduled -> account_number ) );
+        }
+        else
+        {
+            switch ( type )
+            {
+                case 0:
+                    desc = g_strdup ( scheduled -> notes );
+                    if ( desc && strlen ( desc ) )
+                        break;
+                    
+                    desc = g_strdup ( gsb_data_payee_get_name (
+                                    scheduled -> party_number, TRUE ) );
+                    if ( desc && strlen ( desc ) )
+                        break;
+
+                    desc = g_strdup ( gsb_data_category_get_name (
+                                    scheduled -> category_number,
+                                    scheduled -> sub_category_number, NULL) );
+                    if ( desc && strlen ( desc ) )
+                        break;
+
+                    desc = g_strdup ( gsb_data_budget_get_name (
+                                    scheduled -> budgetary_number,
+                                    scheduled -> sub_budgetary_number,
+                                    _("No data by default") ) );
                     break;
-                
-                desc = g_strdup ( gsb_data_payee_get_name (
-                                scheduled -> party_number, TRUE ) );
-                if ( desc && strlen ( desc ) )
+                case 1:
+                    desc = g_strdup ( gsb_data_category_get_name (
+                                    scheduled -> category_number,
+                                    scheduled -> sub_category_number,
+                                    _("No category") ) );
                     break;
-
-                desc = g_strdup ( gsb_data_category_get_name (
-                                scheduled -> category_number,
-                                scheduled -> sub_category_number, NULL) );
-                if ( desc && strlen ( desc ) )
+                case 2:
+                    desc = g_strdup ( gsb_data_budget_get_name (
+                                    scheduled -> budgetary_number,
+                                    scheduled -> sub_budgetary_number,
+                                    _("No budgetary line") ) );
                     break;
-
-                desc = g_strdup ( gsb_data_budget_get_name (
-                                scheduled -> budgetary_number,
-                                scheduled -> sub_budgetary_number,
-                                _("No data by default") ) );
-                break;
-            case 1:
-                desc = g_strdup ( gsb_data_category_get_name (
-                                scheduled -> category_number,
-                                scheduled -> sub_category_number,
-                                _("No category") ) );
-                break;
-            case 2:
-                desc = g_strdup ( gsb_data_budget_get_name (
-                                scheduled -> budgetary_number,
-                                scheduled -> sub_budgetary_number,
-                                _("No budgetary line") ) );
-                break;
+            }
         }
     }
     else if ( origine == SPP_ORIGIN_ACCOUNT )

Index: balance_estimate_future.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_future.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- balance_estimate_future.c	18 May 2010 20:12:54 -0000	1.13
+++ balance_estimate_future.c	23 May 2010 21:05:42 -0000	1.14
@@ -53,7 +53,6 @@
 #include "./gtk_combofix.h"
 #include "./utils.h"
 #include "./utils_str.h"
-#include "./balance_estimate_data.h"
 #include "./structures.h"
 #include "./gsb_data_payment.h"
 #include "./gsb_data_account.h"
@@ -544,7 +543,7 @@
 
     element_number = TRANSACTION_FORM_CATEGORY;
     widget = gtk_combofix_new_complex (
-                         gsb_data_category_get_name_list ( TRUE, TRUE, FALSE, FALSE ) );
+                         gsb_data_category_get_name_list ( TRUE, TRUE, TRUE, FALSE ) );
     gtk_widget_set_size_request ( widget, width, -1 );
     gtk_combofix_set_force_text ( GTK_COMBOFIX (widget),
 					  etat.combofix_force_category );
@@ -1624,21 +1623,30 @@
 {
     const gchar *string;
     gchar **tab_char;
-    gint category_number;
+    gint category_number = 0;
     gint sub_category_number = 0;
+    struct_futur_data *sd = ( struct_futur_data *) value;
 
     string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
     if ( string && strlen ( string ) > 0 )
     {
         tab_char = g_strsplit ( string, " : ", 2 );
-        category_number = gsb_data_category_get_number_by_name (
-                        tab_char[0], FALSE, 0 );
-
-        if ( tab_char[1] && strlen ( tab_char[1] ) )
-            sub_category_number = gsb_data_category_get_sub_category_number_by_name (
-                        category_number, tab_char[1], FALSE );
+        if ( my_strcasecmp ( tab_char[0], _("Transfer") ) == 0 )
+        {
+            sd -> is_transfert = TRUE;
+            sd -> account_transfert =  gsb_data_account_get_no_account_by_name ( tab_char[1] );
+        }
         else
-            sub_category_number = 0;
+        {
+            category_number = gsb_data_category_get_number_by_name (
+                            tab_char[0], FALSE, 0 );
+
+            if ( tab_char[1] && strlen ( tab_char[1] ) )
+                sub_category_number = gsb_data_category_get_sub_category_number_by_name (
+                            category_number, tab_char[1], FALSE );
+            else
+                sub_category_number = 0;
+        }
     }
     else
     {
@@ -1648,15 +1656,11 @@
 
     if ( struct_type == 0 )
     {
-        struct_futur_data *sd = ( struct_futur_data *) value;
-
         sd -> category_number = category_number;
         sd -> sub_category_number = sub_category_number;
     }
     else if ( struct_type == 1 )
     {
-        struct_transfert_data *sd = ( struct_transfert_data *) value;
-
         sd -> category_number = category_number;
         sd -> sub_category_number = sub_category_number;
     }

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- balance_estimate_hist.c	18 May 2010 20:12:54 -0000	1.25
+++ balance_estimate_hist.c	23 May 2010 21:05:42 -0000	1.26
@@ -42,13 +42,11 @@
 #include "./navigation.h"
 #include "./traitement_variables.h"
 #include "./utils_str.h"
-#include "./balance_estimate_data.h"
 #include "./gsb_fyear.h"
 #include "./mouse.h"
 #include "./structures.h"
 #include "./include.h"
 #include "./erreur.h"
-#include "./gsb_real.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/



More information about the cvs mailing list