[grisbi-cvs] grisbi/src balance_estimate_hist.c, 1.10, 1.11 balance_estimate_tab.c, 1.46, 1.47 gsb_data_account.c, 1.96, 1.97

Pierre Biava pbiava at users.sourceforge.net
Mon Mar 1 23:22:55 CET 2010


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

Modified Files:
	balance_estimate_hist.c balance_estimate_tab.c 
	gsb_data_account.c 
Log Message:
Minor changes for the budget management module

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- balance_estimate_tab.c	28 Feb 2010 22:10:26 -0000	1.46
+++ balance_estimate_tab.c	1 Mar 2010 22:22:53 -0000	1.47
@@ -159,7 +159,8 @@
  */
 GtkWidget *bet_array_create_estimate_page ( void )
 {
-    GtkWidget* notebook;
+    GtkWidget   *notebook;
+    GtkWidget *tree_view = NULL;
 
     devel_debug (NULL);
     /* initialise structures */
@@ -171,6 +172,9 @@
 
     /****** Parameter page ******/
     bet_parameter_create_page ( notebook );
+    tree_view = g_object_get_data ( G_OBJECT ( notebook ), "bet_account_treeview");
+    if ( tree_view == NULL )
+        return NULL;
 
     /****** Estimation array page ******/
     bet_array_create_page ( notebook );
@@ -963,9 +967,11 @@
     gtk_widget_show_all ( scrolled_window );
 
     /* fill the account list */
-    bet_parameter_update_list_accounts ( tree_view, GTK_TREE_MODEL ( tree_model ) );
+    if ( bet_parameter_update_list_accounts ( tree_view, GTK_TREE_MODEL ( tree_model ) ) )
 
-    return tree_view;
+        return tree_view;
+    else
+        return NULL;
 }
 
 
@@ -989,6 +995,9 @@
         last_account = etat.bet_last_account;
 
     tree_selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( tree_view ) );
+    if ( !tree_selection )
+        return FALSE;
+
     gtk_tree_store_clear ( GTK_TREE_STORE ( tree_model ) );
 
     tmp_list = gsb_data_account_get_list_accounts ();
@@ -1018,7 +1027,7 @@
         tmp_list = tmp_list -> next;
     }
 
-    return FALSE;
+    return TRUE;
 }
 
 
@@ -1413,6 +1422,7 @@
 
     //~ devel_debug (NULL);
     date_jour = gdate_today ( );
+
     /* search transactions of the account which are in the period */
     tmp_list = gsb_data_transaction_get_transactions_list ( );
 
@@ -1550,7 +1560,7 @@
     gint sub_div_nb;
     gsb_real amount;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     date = gsb_date_get_last_day_of_month ( date_min );
 
     /* initialise les données de la ligne insérée */
@@ -1778,6 +1788,8 @@
         gchar* str_credit = NULL;
         gchar *str_amount;
         gchar *div_name;
+        GDate *date;
+        GDate *date_today;
         gsb_real number;
 
         do
@@ -1790,77 +1802,58 @@
                         -1 );
 
             div_name = bet_data_get_div_name ( div_number, sub_div_nb, FALSE );
-            if ( g_utf8_collate ( str_desc, div_name ) == 0 )
-                break;
+            if ( g_strstr_len ( str_desc, -1, div_name ) )
+            {
+                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 );
+                    number = gsb_real_sub ( number, amount );
+                    if ( number.mantissa == 0 )
+                        gtk_tree_store_remove ( GTK_TREE_STORE ( model ), &iter );
+                    else
+                    {
+                        if ( str_amount )
+                            g_free ( str_amount );
+                        str_amount = gsb_real_save_real_to_string ( number, 2 );
+                        if ( number.mantissa < 0 )
+                            str_debit = gsb_real_get_string_with_currency (
+                                        gsb_real_abs ( number ),
+                                        bet_data_get_selected_currency ( ),
+                                        TRUE );
+                        else
+                            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);
+                        
+                        gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
+                                        SPP_ESTIMATE_TREE_DESC_COLUMN, str_desc,
+                                        SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
+                                        SPP_ESTIMATE_TREE_CREDIT_COLUMN, str_credit,
+                                        SPP_ESTIMATE_TREE_AMOUNT_COLUMN, str_amount,
+                                        -1 );
 
+                        g_free ( str_desc );
+                        g_free ( str_credit );
+                        g_free ( str_debit );
+                        g_free ( str_amount );
+                    }
+                    g_free ( str_date );
+                    g_free ( div_name );
+                    break;
+                }
+            }
             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 ) );
-        
-        number = gsb_real_import_from_string ( str_amount );
-        number = gsb_real_sub ( number, amount );
-        printf ("str_desc = %s str_amount = %s number = %s\n", str_desc, str_amount, gsb_real_save_real_to_string ( number, 2 ));
-
-        gtk_tree_store_remove ( GTK_TREE_STORE ( model ), &iter );
-        if ( number.mantissa != 0 )
-        {
-            GDate *date;
-            GValue date_value = {0, };
-
-            date = gsb_parse_date_string ( str_date );
-            if ( g_date_valid ( date ) )
-            {
-                g_value_init ( &date_value, G_TYPE_DATE );
-                g_value_set_boxed ( &date_value, date );
-            }
-
-            if ( str_amount )
-                g_free ( str_amount );
-            str_amount = gsb_real_save_real_to_string ( number, 2 );
-            if ( number.mantissa < 0 )
-                str_debit = gsb_real_get_string_with_currency (
-                            gsb_real_abs ( number ),
-                            bet_data_get_selected_currency ( ),
-                            TRUE );
-            else
-                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);
-            
-            /* add a line in the estimate array */
-            gtk_tree_store_append ( GTK_TREE_STORE ( model ), &iter, NULL );
-            gtk_tree_store_set_value ( GTK_TREE_STORE ( model ), &iter,
-                            SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
-                            &date_value );
-            gtk_tree_store_set ( GTK_TREE_STORE ( model ), &iter,
-                            SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
-                            SPP_ESTIMATE_TREE_DESC_COLUMN, str_desc,
-                            SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
-                            SPP_ESTIMATE_TREE_CREDIT_COLUMN, str_credit,
-                            SPP_ESTIMATE_TREE_AMOUNT_COLUMN, str_amount,
-                            -1 );
-
-            g_value_unset ( &date_value );
-            g_free ( str_credit );
-            g_free ( str_debit );
-
-            gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
-                        &iter,
-                        SPP_ESTIMATE_TREE_DESC_COLUMN, &str_desc,
-                        SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &str_amount,
-                        -1 );
-            printf ("str_desc = %s str_amount = %s\n", str_desc, str_amount);
-        }
-        g_free ( str_desc );
-        g_free ( str_amount );
-        g_free ( div_name );
     }
 }
 

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- gsb_data_account.c	18 Jan 2010 19:13:40 -0000	1.96
+++ gsb_data_account.c	1 Mar 2010 22:22:53 -0000	1.97
@@ -2734,7 +2734,7 @@
         if ( gsb_data_transaction_get_account_number (transaction_number) == account_number
              &&
              !gsb_data_transaction_get_mother_transaction_number (transaction_number)
-             && res >= 0 )
+             && res > 0 )
         {
             adjusted_amout = gsb_data_transaction_get_adjusted_amount (
                         transaction_number, floating_point );

Index: balance_estimate_hist.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_hist.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- balance_estimate_hist.c	28 Feb 2010 22:10:26 -0000	1.10
+++ balance_estimate_hist.c	1 Mar 2010 22:22:53 -0000	1.11
@@ -825,7 +825,7 @@
 {
     GtkTreeModel *model;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
 
     g_hash_table_foreach ( list_div, bet_historical_populate_div_model, tree_view );
@@ -1107,7 +1107,7 @@
     GtkTreeIter iter;
     GtkTreeIter fils_iter;
 
-    devel_debug (NULL);
+    //~ devel_debug (NULL);
     tree_view = g_object_get_data ( G_OBJECT ( bet_container ), "bet_historical_treeview" );
     model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
 



More information about the cvs mailing list