[grisbi-cvs] grisbi/src categories_onglet.c, 1.193, 1.194 gsb_data_bank.c, 1.13, 1.14 gsb_data_category.c, 1.68, 1.69 gsb_data_category.h, 1.22, 1.23 gsb_data_report.c, 1.32, 1.33 gsb_data_report_text_comparison.c, 1.16, 1.17 gsb_data_scheduled.c, 1.29, 1.30 gsb_file_load.c, 1.180, 1.181 gsb_file_others.c, 1.25, 1.26 gsb_transactions_list.c, 1.168, 1.169 metatree.c, 1.138, 1.139

Pierre Biava pbiava at users.sourceforge.net
Fri Jun 12 21:06:58 CEST 2009


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

Modified Files:
	categories_onglet.c gsb_data_bank.c gsb_data_category.c 
	gsb_data_category.h gsb_data_report.c 
	gsb_data_report_text_comparison.c gsb_data_scheduled.c 
	gsb_file_load.c gsb_file_others.c gsb_transactions_list.c 
	metatree.c 
Log Message:
Fixed bug 411

Index: categories_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/categories_onglet.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -d -r1.193 -r1.194
--- categories_onglet.c	27 Apr 2009 19:41:03 -0000	1.193
+++ categories_onglet.c	12 Jun 2009 19:06:56 -0000	1.194
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      */
-/*			2004-2008 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          2004-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      */

Index: gsb_data_bank.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_bank.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- gsb_data_bank.c	10 Jun 2009 20:14:55 -0000	1.13
+++ gsb_data_bank.c	12 Jun 2009 19:06:56 -0000	1.14
@@ -31,6 +31,7 @@
 /*START_INCLUDE*/
 #include "gsb_data_bank.h"
 #include "./gsb_data_account.h"
+#include "./utils_str.h"
 /*END_INCLUDE*/
 
 

Index: gsb_data_scheduled.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_scheduled.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- gsb_data_scheduled.c	10 Jun 2009 20:14:55 -0000	1.29
+++ gsb_data_scheduled.c	12 Jun 2009 19:06:56 -0000	1.30
@@ -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      */
@@ -33,6 +33,7 @@
 #include "gsb_data_scheduled.h"
 #include "./dialog.h"
 #include "./utils_dates.h"
+#include "./utils_str.h"
 #include "./include.h"
 #include "./gsb_real.h"
 /*END_INCLUDE*/

Index: metatree.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/metatree.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- metatree.c	11 Jun 2009 20:51:55 -0000	1.138
+++ metatree.c	12 Jun 2009 19:06:56 -0000	1.139
@@ -1,7 +1,7 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2004-2008 Benjamin Drieu (bdrieu at april.org)	          */
-/* 			http://www.grisbi.org				                              */
+/*     Copyright (C)    2004-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      */

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- gsb_transactions_list.c	10 Jun 2009 20:14:55 -0000	1.168
+++ gsb_transactions_list.c	12 Jun 2009 19:06:56 -0000	1.169
@@ -2421,7 +2421,6 @@
                         gpointer null )
 {
     gint target_account, source_account;
-    gchar *string;
 
     if (! assert_selected_transaction()) return FALSE;
 
@@ -2436,16 +2435,9 @@
 
 	update_transaction_in_trees (gsb_data_account_get_current_transaction_number (source_account));
 
-	if (gsb_data_account_get_current_balance (source_account).mantissa < 0)
-	    string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-				       gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (source_account),
-									   gsb_data_account_get_currency (source_account), TRUE ));
-	else
-	    string = gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (source_account),
-							 gsb_data_account_get_currency (source_account), TRUE );
-	gsb_gui_headings_update_suffix (string);
-	g_free (string);
-	mise_a_jour_accueil (FALSE);
+    gsb_data_account_colorize_current_balance ( source_account );
+
+    mise_a_jour_accueil (FALSE);
 
 	if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -2473,22 +2465,12 @@
     if ( gsb_transactions_list_move_transaction_to_account ( gsb_data_account_get_current_transaction_number (source_account),
 							     target_account ))
     {
-	gchar *string;
 	gtk_notebook_set_current_page ( GTK_NOTEBOOK ( notebook_general ), 1 );
 
 	update_transaction_in_trees ( gsb_data_account_get_current_transaction_number (
                         source_account ) ) ;
 
-	if ( gsb_data_account_get_current_balance (source_account).mantissa < 0 )
-	    string = g_strdup_printf ( "<span color=\"red\">%s</span>",
-                        gsb_real_get_string_with_currency (
-                        gsb_data_account_get_current_balance ( source_account ),
-                        gsb_data_account_get_currency ( source_account ), TRUE ) );
-	else
-	    string = gsb_real_get_string_with_currency ( gsb_data_account_get_current_balance (source_account),
-                        gsb_data_account_get_currency ( source_account ), TRUE );
-	gsb_gui_headings_update_suffix (string);
-	g_free (string);
+    gsb_data_account_colorize_current_balance ( source_account );
 
 	if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );

Index: gsb_data_report_text_comparison.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_report_text_comparison.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- gsb_data_report_text_comparison.c	10 Jun 2009 20:14:55 -0000	1.16
+++ gsb_data_report_text_comparison.c	12 Jun 2009 19:06:56 -0000	1.17
@@ -33,6 +33,7 @@
 
 /*START_INCLUDE*/
 #include "gsb_data_report_text_comparison.h"
+#include "./utils_str.h"
 /*END_INCLUDE*/
 
 /** \struct

Index: gsb_data_category.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_category.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- gsb_data_category.c	27 Apr 2009 19:41:03 -0000	1.68
+++ gsb_data_category.c	12 Jun 2009 19:06:56 -0000	1.69
@@ -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      */
@@ -206,7 +206,7 @@
  * \return the adr of the struct of the category (NULL if doesn't exit)
  * */
 gpointer gsb_data_category_get_structure_in_list ( gint no_category,
-						   GSList *list )
+                        GSList *list )
 {
     GSList *tmp;
 
@@ -242,7 +242,7 @@
  * \return the adr of the struct of the sub-category (NULL if doesn't exit)
  * */
 gpointer gsb_data_category_get_sub_category_structure ( gint no_category,
-							gint no_sub_category )
+                        gint no_sub_category )
 {
     GSList *tmp;
     struct_category *category;
@@ -549,7 +549,7 @@
  * \return TRUE ok
  * */
 gboolean gsb_data_category_sub_category_remove ( gint no_category,
-						 gint no_sub_category )
+                        gint no_sub_category )
 {
     struct_category *category;
     struct_sub_category *sub_category;
@@ -582,7 +582,7 @@
  * \return the number of the new sub-category or 0 if problem
  * */
 gint gsb_data_category_new_sub_category ( gint category_number,
-					  const gchar *name )
+                        const gchar *name )
 {
     gint sub_category_number;
 
@@ -609,7 +609,7 @@
  * \return the number of the new sub-category or 0 if problem
  * */
 gint gsb_data_category_new_sub_category_with_number ( gint number,
-						      gint category_number)
+                        gint category_number)
 {
     struct_category *category;
     struct_sub_category *sub_category;
@@ -644,8 +644,8 @@
  * \return TRUE ok, FALSE if fail
  * */
 gboolean gsb_data_category_fill_transaction_by_string ( gint transaction_number,
-							const gchar *string,
-							gboolean is_transaction )
+                        const gchar *string,
+                        gboolean is_transaction )
 {
     gchar **tab_char;
     gint category_number = 0;
@@ -700,7 +700,7 @@
  * \return the number of the category or 0 if problem
  * */
 gint gsb_data_category_get_number_by_name ( const gchar *name,
-					    gboolean create,
+                        gboolean create,
 					    gint category_type )
 {
     GSList *list_tmp;
@@ -1598,7 +1598,88 @@
 }
 
 
+/**
+ * 
+ * 
+ *
+ * \param 
+ *
+ * \return
+ * */
 
+gint gsb_data_category_test_create_category ( gint no_category,
+                        const gchar *name,
+                        gint category_type )
+{
+    GSList *list_tmp;
+    gint category_number = 0;
+    struct_category *category;
+
+    list_tmp = g_slist_find_custom ( category_list,
+                        name,
+                        (GCompareFunc) gsb_data_category_get_pointer_from_name_in_glist );
+
+    if ( list_tmp )
+    {
+        category = list_tmp -> data;
+        return category -> category_number;
+    }
+    else
+    {
+        category = gsb_data_category_get_structure ( no_category );
+
+        if ( !category )
+        {
+            category_number = gsb_data_category_new_with_number ( no_category );
+            gsb_data_category_set_name ( category_number, name );
+            gsb_data_category_set_type ( category_number, category_type );
+        }
+        else
+        {
+            category_number = gsb_data_category_new (name);
+            gsb_data_category_set_type ( category_number, category_type );
+            gsb_category_update_combofix ();
+        }
+        return category_number;
+    }
+}
+
+
+gboolean gsb_data_category_test_create_sub_category ( gint no_category,
+                        gint no_sub_category,
+                        const gchar *name )
+{
+    GSList *list_tmp;
+    gint sub_category_number = 0;
+    struct_category *category;
+    struct_sub_category *sub_category;
+
+    category = gsb_data_category_get_structure ( no_category );
+    list_tmp = g_slist_find_custom ( category -> sub_category_list,
+                        name,
+                        (GCompareFunc) gsb_data_category_get_pointer_from_sub_name_in_glist );
+
+    if ( list_tmp )
+        return TRUE;
+    else
+    {
+        sub_category = gsb_data_category_get_sub_category_structure ( no_category,
+                        no_sub_category );
+        if ( !sub_category )
+        {
+            sub_category_number = gsb_data_category_new_sub_category_with_number (
+                        no_sub_category, no_category );
+            gsb_data_category_set_sub_category_name ( no_category, no_sub_category, name );
+        }
+        else
+        {
+            sub_category_number = gsb_data_category_new_sub_category ( no_category, name );
+            gsb_category_update_combofix ();
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- gsb_file_load.c	7 Jun 2009 21:55:11 -0000	1.180
+++ gsb_file_load.c	12 Jun 2009 19:06:56 -0000	1.181
@@ -250,6 +250,19 @@
  * d'une version antérieure de grisbi */
 gchar *copy_old_filename = NULL;
 
+/* structure temporaire pour le chargement d'un tiers/catégorie/imputation et sous-catégorie
+ * sous-imputation */
+struct new_div_sous_div_struct
+{
+    gint no_div;
+    gint new_no_div;
+    gint no_sub_div;
+    gchar *name;
+    gint type;
+
+};
+static struct new_div_sous_div_struct *buffer_new_div_sous_div;
+
 /**
  * called to open the grisbi file given in param
  *
@@ -2400,7 +2413,10 @@
                         const gchar **attribute_values )
 {
     gint i=0;
-    gint category_number = 0;
+
+    if ( buffer_new_div_sous_div )
+        g_free ( buffer_new_div_sous_div );
+    buffer_new_div_sous_div = g_malloc0 ( sizeof ( struct new_div_sous_div_struct ) );
 
     if ( !attribute_names[i] )
     return;
@@ -2420,8 +2436,7 @@
     if ( !strcmp ( attribute_names[i],
                "Nb" ))
     {
-        category_number = gsb_data_category_new_with_number ( utils_str_atoi (attribute_values[i]));
-
+        buffer_new_div_sous_div -> no_div = utils_str_atoi ( attribute_values[i] );
         i++;
         continue;
     }
@@ -2429,8 +2444,7 @@
     if ( !strcmp ( attribute_names[i],
                "Na" ))
     {
-        gsb_data_category_set_name ( category_number,
-                              attribute_values[i]);
+        buffer_new_div_sous_div -> name = g_strdup ( attribute_values[i] );
         i++;
         continue;
     }
@@ -2438,8 +2452,7 @@
     if ( !strcmp ( attribute_names[i],
                "Kd" ))
     {
-        gsb_data_category_set_type ( category_number,
-                              utils_str_atoi (attribute_values[i]));
+        buffer_new_div_sous_div -> type = utils_str_atoi ( attribute_values[i] );
         i++;
         continue;
     }
@@ -2448,6 +2461,11 @@
     i++;
     }
     while ( attribute_names[i] );
+
+    buffer_new_div_sous_div -> new_no_div = gsb_data_category_test_create_category (
+                        buffer_new_div_sous_div -> no_div,
+                        buffer_new_div_sous_div -> name,
+                        buffer_new_div_sous_div -> type );
 }
 
 
@@ -2463,7 +2481,6 @@
 {
     gint i=0;
     gint category_number = 0;
-    gint sub_category_number = 0;
 
     if ( !attribute_names[i] )
     return;
@@ -2491,8 +2508,8 @@
     if ( !strcmp ( attribute_names[i],
                "Nb" ))
     {
-        sub_category_number = gsb_data_category_new_sub_category_with_number ( utils_str_atoi (attribute_values[i]),
-                                                                   category_number );
+        if ( category_number == buffer_new_div_sous_div -> no_div )
+            buffer_new_div_sous_div -> no_sub_div = utils_str_atoi ( attribute_values[i] );
         i++;
         continue;
     }
@@ -2500,9 +2517,8 @@
     if ( !strcmp ( attribute_names[i],
                "Na" ))
     {
-        gsb_data_category_set_sub_category_name ( category_number,
-                                  sub_category_number,
-                                          attribute_values[i] );
+        if ( category_number == buffer_new_div_sous_div -> no_div )
+            buffer_new_div_sous_div -> name = g_strdup ( attribute_values[i] );
         i++;
         continue;
     }
@@ -2511,6 +2527,19 @@
     i++;
     }
     while ( attribute_names[i] );
+
+    if ( !gsb_data_category_test_create_sub_category (
+                            buffer_new_div_sous_div -> new_no_div,
+                            buffer_new_div_sous_div -> no_sub_div,
+							buffer_new_div_sous_div -> name ) )
+    {
+        gchar *tmpstr = g_strdup_printf ( "no_category = %d no_sub_category = %d nom = %s\n",
+                            buffer_new_div_sous_div -> new_no_div,
+                            buffer_new_div_sous_div -> no_sub_div,
+							buffer_new_div_sous_div -> name );
+        devel_debug ( tmpstr );
+    }
+
 }
 
 
@@ -5968,7 +5997,7 @@
         /* as the date comes before the last number of reconcile, the fastest way is to use
          * a buffer for ther reconcile structure, and when we have the last number of reconcile,
          * we append the buffer to the list */
-        buffer_reconcile_conversion = g_malloc0 (sizeof (GMarkupParser));
+        buffer_reconcile_conversion = g_malloc0 (sizeof (struct reconcile_conversion_struct));
         if (buffer_reconcile_conversion)
         {
             gchar **pointeur_char;

Index: gsb_file_others.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_others.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- gsb_file_others.c	8 May 2009 17:21:15 -0000	1.25
+++ gsb_file_others.c	12 Jun 2009 19:06:56 -0000	1.26
@@ -1,21 +1,23 @@
-/* file gsb_file_others.c
- * used to save and load differents files under grisbi */
-/*     Copyright (C)	2000-2005 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 */
-/*     the Free Software Foundation; either version 2 of the License, or */
-/*     (at your option) any later version. */
-
-/*     This program is distributed in the hope that it will be useful, */
-/*     but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
-/*     GNU General Public License for more details. */
-
-/*     You should have received a copy of the GNU General Public License */
-/*     along with this program; if not, write to the Free Software */
-/*     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+/* ************************************************************************** */
+/*                                                                            */
+/*     Copyright (C)    2000-2005 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      */
+/*  the Free Software Foundation; either version 2 of the License, or         */
+/*  (at your option) any later version.                                       */
+/*                                                                            */
+/*  This program is distributed in the hope that it will be useful,           */
+/*  but WITHOUT ANY WARRANTY; without even the implied warranty of            */
+/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
+/*  GNU General Public License for more details.                              */
+/*                                                                            */
+/*  You should have received a copy of the GNU General Public License         */
+/*  along with this program; if not, write to the Free Software               */
+/*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+/*                                                                            */
+/* ************************************************************************** */
 
 /**
  * \file gsb_file_others.c
@@ -426,7 +428,8 @@
     if ( !g_file_test ( filename,
 			G_FILE_TEST_IS_REGULAR ))
     {
-        gchar* tmpstr = g_strdup_printf ( _("%s doesn't seem to be a regular file,\nplease check it and try again."),
+        gchar* tmpstr = g_strdup_printf ( 
+                        _("%s doesn't seem to be a regular file,\nplease check it and try again."),
 					   filename );
 	dialogue_error ( tmpstr );
 	g_free ( tmpstr );

Index: gsb_data_category.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_category.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gsb_data_category.h	25 Oct 2008 15:27:29 -0000	1.22
+++ gsb_data_category.h	12 Jun 2009 19:06:56 -0000	1.23
@@ -72,5 +72,11 @@
 void gsb_data_category_update_counters ( void );
 gchar * gsb_debug_duplicate_categ_check ();
 gboolean gsb_debug_duplicate_categ_fix ();
+gint gsb_data_category_test_create_category ( gint no_category,
+                        const gchar *name,
+                        gint category_type );
+gboolean gsb_data_category_test_create_sub_category ( gint no_category,
+                        gint no_sub_category,
+                        const gchar *name );
 /* END_DECLARATION */
 #endif

Index: gsb_data_report.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_report.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- gsb_data_report.c	10 Jun 2009 20:14:55 -0000	1.32
+++ gsb_data_report.c	12 Jun 2009 19:06:56 -0000	1.33
@@ -35,6 +35,7 @@
 #include "./gsb_data_report_amout_comparison.h"
 #include "./gsb_data_report_text_comparison.h"
 #include "./utils_dates.h"
+#include "./utils_str.h"
 /*END_INCLUDE*/
 
 /** \struct



More information about the cvs mailing list