[grisbi-cvs] grisbi/src gsb_account_property.c, 1.41, 1.42 gsb_data_account.c, 1.74, 1.75 gsb_data_account.h, 1.33, 1.34 gsb_file_load.c, 1.174, 1.175 gsb_form.c, 1.122, 1.123 gsb_real_cunit.c, 1.4, 1.5 gsb_transactions_list.c, 1.164, 1.165 import.c, 1.279, 1.280 navigation.c, 1.121, 1.122 transaction_list.c, 1.36, 1.37 utils_dates.c, 1.52, 1.53

Pierre Biava pbiava at users.sourceforge.net
Tue May 19 20:25:00 CEST 2009


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

Modified Files:
	gsb_account_property.c gsb_data_account.c gsb_data_account.h 
	gsb_file_load.c gsb_form.c gsb_real_cunit.c 
	gsb_transactions_list.c import.c navigation.c 
	transaction_list.c utils_dates.c 
Log Message:
Fixed bug in imports and mark transactions of an account and others updates

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- gsb_transactions_list.c	17 May 2009 15:53:25 -0000	1.164
+++ gsb_transactions_list.c	19 May 2009 18:24:58 -0000	1.165
@@ -620,7 +620,6 @@
 	&&
 	!gsb_data_transaction_get_mother_transaction_number (transaction_number))
     {
-	gchar *string;
 	gint selected_transaction;
 
 	/* we cannot use update_tree_view here because re-filter the model will close
@@ -631,17 +630,7 @@
 	transaction_list_set_balances ();
 	transaction_list_select (selected_transaction);
 
-	if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
-	    string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-                        gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance ( account_number ),
-                        gsb_data_account_get_currency ( account_number ), TRUE ) );
-	else
-	    string = gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance ( account_number ),
-                        gsb_data_account_get_currency ( account_number ), TRUE );
-	gsb_gui_headings_update_suffix (string);
-	g_free (string);
+    gsb_data_account_colorize_current_balance ( account_number );
 
 	/* if it's a mother, open the expander */
 	if (gsb_data_transaction_get_split_of_transaction (transaction_number))
@@ -840,8 +829,6 @@
 gboolean gsb_transactions_list_update_transaction ( gint transaction_number )
 {
     gint account_number;
-    gchar *string;
-    //~ gsb_real current_balance;
 
     devel_debug_int (transaction_number);
 
@@ -852,27 +839,7 @@
     transaction_list_set_balances ();
 
     account_number = gsb_data_transaction_get_account_number (transaction_number);
-
-    /* update the current balance */
-    /* mis en commentaire car cela modifie le solde du compte même si on ne modifie pas
-     * le montant de l'opération voir impacts sur une modification du solde. */
-    //~ current_balance = gsb_real_add ( gsb_data_account_get_current_balance (account_number),
-				     //~ gsb_data_transaction_get_adjusted_amount (transaction_number, -1));
-    //~ gsb_data_account_set_current_balance ( account_number,
-					   //~ current_balance);
-
-    if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
-        string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-                    gsb_real_get_string_with_currency (
-                    gsb_data_account_get_current_balance (account_number),
-                    gsb_data_account_get_currency (account_number), TRUE ));
-    else
-        string = gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance (account_number),
-                        gsb_data_account_get_currency (account_number), TRUE );
-
-    gsb_gui_headings_update_suffix (string);
-    g_free(string);
+    gsb_data_account_colorize_current_balance ( account_number );
 
     /* update first page */
     mise_a_jour_liste_comptes_accueil = 1;

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- gsb_form.c	10 May 2009 13:06:56 -0000	1.122
+++ gsb_form.c	19 May 2009 18:24:58 -0000	1.123
@@ -1733,6 +1733,8 @@
      * because if strlen < floating point we need to
      * malloc another string */
     string = my_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
+    if ( !string || strlen (string) == 0 )
+        return;
 
     account_number = gsb_form_get_account_number ();
     floating_point = gsb_data_currency_get_floating_point (gsb_data_account_get_currency (account_number));

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- navigation.c	17 May 2009 15:53:25 -0000	1.121
+++ navigation.c	19 May 2009 18:24:58 -0000	1.122
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
-/*			2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
-/* 			http://www.grisbi.org				                              */
+/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -1065,8 +1065,6 @@
 void gsb_navigation_update_account_label ( gint account_number )
 {
     gchar * title = NULL; 
-    gchar * suffix = NULL; 
-    gint currency_number;
 
     /* set the title */
     title = g_strconcat ( _("Account transactions"), " : ",
@@ -1079,20 +1077,7 @@
 	g_free ( old_title );
     }
 
-    currency_number = gsb_data_account_get_currency (account_number);
-    if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
-	suffix = g_strdup_printf ( "<span color=\"red\">%s</span>",
-                        gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance ( account_number ),
-                        currency_number, TRUE ) );
-    else
-	suffix = gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance ( account_number ),
-                        currency_number, TRUE );
-    if (!suffix)
-    	suffix = g_strdup("");
-    gsb_gui_headings_update ( title, suffix );
-    g_free ( suffix );
+    gsb_data_account_colorize_current_balance ( account_number );
     g_free ( title );
 }
 

Index: gsb_real_cunit.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real_cunit.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gsb_real_cunit.c	17 May 2009 15:53:25 -0000	1.4
+++ gsb_real_cunit.c	19 May 2009 18:24:58 -0000	1.5
@@ -49,7 +49,7 @@
 /* The suite initialization function.
  * Returns zero on success, non-zero otherwise.
  */
-int gsb_real_cunit_init_suite(void)
+int gsb_real_cunit_init_suite ( void )
 {
     return 0;
 }
@@ -57,7 +57,7 @@
 /* The suite cleanup function.
  * Returns zero on success, non-zero otherwise.
  */
-int gsb_real_cunit_clean_suite(void)
+int gsb_real_cunit_clean_suite ( void )
 {
     return 0;
 }

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- import.c	17 May 2009 15:53:25 -0000	1.279
+++ import.c	19 May 2009 18:24:58 -0000	1.280
@@ -52,7 +52,6 @@
 #include "./gsb_form_scheduler.h"
 #include "./gsb_form_transaction.h"
 #include "./utils_dates.h"
-#include "./fenetre_principale.h"
 #include "./navigation.h"
 #include "./menu.h"
 #include "./tiers_onglet.h"
@@ -83,49 +82,49 @@
 /*START_STATIC*/
 static gboolean affichage_recapitulatif_importation ( GtkWidget * assistant );
 static const gchar * autodetect_file_type ( gchar * filename,
[...2533 lines suppressed...]
     gchar * contenu_fichier;
     GError * error = NULL;
@@ -4213,12 +4228,12 @@
     contenu_fichier = my_strdelimit (pointeur_char, "°", "&");
 
     /* create tmp file */
-	if ( ! g_file_set_contents ( filename, contenu_fichier, -1, &error ) )
-	{
+    if ( ! g_file_set_contents ( filename, contenu_fichier, -1, &error ) )
+    {
         g_free (contenu_fichier);
-	    g_print ( _("Unable to create tmp file: %s\n"), error -> message);
-	    return FALSE;
-	}
+        g_print ( _("Unable to create tmp file: %s\n"), error -> message);
+        return FALSE;
+    }
 
     g_free (contenu_fichier);
     return TRUE;

Index: gsb_account_property.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account_property.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- gsb_account_property.c	17 May 2009 16:58:32 -0000	1.41
+++ gsb_account_property.c	19 May 2009 18:24:58 -0000	1.42
@@ -892,7 +892,6 @@
     gint account_currency_number;
     gint result;
     GSList *list_tmp;
-    gchar *string;
 
     account_number = gsb_gui_navigation_get_current_account ();
 
@@ -947,15 +946,8 @@
     transaction_list_set_balances ();
 
     /* update the headings balance */
-    if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
-	string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-				   gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (account_number),
-								       gsb_data_account_get_currency (account_number), TRUE ));
-    else
-	string = gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (account_number),
-						     gsb_data_account_get_currency (account_number), TRUE );
-    gsb_gui_headings_update_suffix ( string );
-    g_free (string);
+    gsb_data_account_colorize_current_balance ( account_number );
+
     return FALSE;
 }
 

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- gsb_data_account.c	17 May 2009 15:53:25 -0000	1.74
+++ gsb_data_account.c	19 May 2009 18:24:58 -0000	1.75
@@ -35,6 +35,7 @@
 #include "./gsb_data_currency.h"
 #include "./gsb_data_form.h"
 #include "./gsb_data_transaction.h"
+#include "./fenetre_principale.h"
 #include "./navigation.h"
 #include "./gsb_real.h"
 #include "./gsb_select_icon.h"
@@ -2655,3 +2656,30 @@
 
     return TRUE;
 }
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void gsb_data_account_colorize_current_balance ( gint account_number )
+{
+    gchar *string;
+
+	if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
+	    string = g_strdup_printf ( "<span color=\"red\">%s</span>",
+                        gsb_real_get_string_with_currency (
+                        gsb_data_account_get_current_balance (account_number),
+                        gsb_data_account_get_currency (account_number), TRUE ));
+	else
+	    string = gsb_real_get_string_with_currency (
+                        gsb_data_account_get_current_balance (account_number),
+                        gsb_data_account_get_currency (account_number), TRUE );
+    if ( !string )
+    	string = g_strdup ( "" );
+
+	gsb_gui_headings_update_suffix ( string );
+	g_free ( string );
+}

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- gsb_file_load.c	17 May 2009 15:53:25 -0000	1.174
+++ gsb_file_load.c	19 May 2009 18:24:58 -0000	1.175
@@ -7684,19 +7684,6 @@
                         reconcile_number),
                         gsb_data_reconcile_get_init_balance (
                         reconcile_number)));
-                if (reconcile_number > 0)
-                    printf ("1 - N° %3d - date : initiale %s "
-                        "finale %s - solde : initial %9s final %9s\n" , 
-                        reconcile_number,
-                        gsb_format_gdate (gsb_data_reconcile_get_init_date (
-                        reconcile_number)),
-                        gsb_format_gdate (gsb_data_reconcile_get_final_date (
-                        reconcile_number)),
-                        gsb_real_get_string (gsb_data_reconcile_get_init_balance (
-                        reconcile_number)),
-                        gsb_real_get_string (gsb_data_reconcile_get_final_balance (
-                        reconcile_number)));
-
                 if ( rec_list -> prev )
                 {
                     previous_reconcile_number = GPOINTER_TO_INT ( (rec_list -> prev) -> data );

Index: utils_dates.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- utils_dates.c	17 May 2009 15:53:25 -0000	1.52
+++ utils_dates.c	19 May 2009 18:24:58 -0000	1.53
@@ -1,7 +1,7 @@
 /* ************************************************************************** */
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cedric Auger (cedric at grisbi.org)            */
-/*          2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/*          2003-2008 Benjamin Drieu (bdrieu at april.org)                       */
 /*                      2009 Pierre Biava (pierre at pierre.biava.name)          */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- transaction_list.c	10 May 2009 13:06:56 -0000	1.36
+++ transaction_list.c	19 May 2009 18:24:58 -0000	1.37
@@ -1,7 +1,7 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
-/* 			http://www.grisbi.org				                              */
+/*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -134,8 +134,8 @@
     /* if this is a child, go to append_child_record */
     if (gsb_data_transaction_get_mother_transaction_number (transaction_number))
     {
-	transaction_list_append_child (transaction_number);
-	return;
+    transaction_list_append_child (transaction_number);
+    return;
     }
 
     /* the transaction is a mother */
@@ -812,7 +812,6 @@
     GtkTreeIter iter;
     GtkTreePath *path;
     gpointer last_transaction_pointer = NULL;
-    gchar *string;
     CustomList *custom_list;
 
     custom_list = transaction_model_get_model ();
@@ -894,15 +893,7 @@
     }
 
     /* update the headings balance */
-    if (gsb_data_account_get_current_balance (account_number).mantissa < 0)
-	string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-				   gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (account_number),
-								       gsb_data_account_get_currency (account_number), TRUE ));
-    else
-	string = gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (account_number),
-						     gsb_data_account_get_currency (account_number), TRUE );
-    gsb_gui_headings_update_suffix (string);
-    g_free (string);
+    gsb_data_account_colorize_current_balance ( account_number );
 }
 
 

Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- gsb_data_account.h	8 May 2009 09:35:10 -0000	1.33
+++ gsb_data_account.h	19 May 2009 18:24:58 -0000	1.34
@@ -24,6 +24,7 @@
 /* START_DECLARATION */
 gsb_real gsb_data_account_calculate_waiting_marked_balance ( gint account_number );
 void gsb_data_account_change_account_icon ( GtkWidget *button, gpointer data );
+void gsb_data_account_colorize_current_balance ( gint account_number );
 gint gsb_data_account_compare_position ( gint account_number_1,
 					 gint account_number_2 );
 gboolean gsb_data_account_delete ( gint account_number );



More information about the cvs mailing list