[grisbi-cvs] grisbi/src accueil.c, 1.204, 1.205 gsb_assistant_archive.c, 1.33, 1.34 gsb_data_transaction.c, 1.69, 1.70 gsb_transactions_list.c, 1.178, 1.179 transaction_list.c, 1.46, 1.47 transaction_list.h, 1.9, 1.10 utils_dates.c, 1.55, 1.56

Pierre Biava pbiava at users.sourceforge.net
Thu Aug 13 21:24:51 CEST 2009


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

Modified Files:
	accueil.c gsb_assistant_archive.c gsb_data_transaction.c 
	gsb_transactions_list.c transaction_list.c transaction_list.h 
	utils_dates.c 
Log Message:
Fixed some bugs in the management of archives. Sorry, but there are still some bugs

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- gsb_data_transaction.c	22 Jul 2009 19:45:42 -0000	1.69
+++ gsb_data_transaction.c	13 Aug 2009 19:24:49 -0000	1.70
@@ -43,7 +43,6 @@
 #include "./utils_dates.h"
 #include "./gsb_real.h"
 #include "./utils_str.h"
-#include "./transaction_list.h"
 #include "./include.h"
 #include "./gsb_real.h"
 /*END_INCLUDE*/
@@ -1518,10 +1517,7 @@
         /* the transaction was not an archive, so it's into the 2 lists,
          * if we transform it as an archive, we remove it from the transactions_list */
         if (archive_number)
-        {
-        //~ transaction_list_remove_archive_transaction ( transaction_number );
-        transactions_list = g_slist_remove ( transactions_list, transaction );
-        }
+            transactions_list = g_slist_remove ( transactions_list, transaction );
     }
 
     transaction -> archive_number = archive_number;

Index: gsb_assistant_archive.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_archive.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- gsb_assistant_archive.c	21 May 2009 21:58:55 -0000	1.33
+++ gsb_assistant_archive.c	13 Aug 2009 19:24:49 -0000	1.34
@@ -41,6 +41,7 @@
 #include "./gsb_data_transaction.h"
 #include "./utils_dates.h"
 #include "./gsb_fyear.h"
+#include "./navigation.h"
 #include "./gsb_report.h"
 #include "./gsb_transactions_list.h"
 #include "./traitement_variables.h"
@@ -697,6 +698,7 @@
     gchar *string;
     GtkTextBuffer * buffer;
     GtkTextIter     iter;
+    gint account_nb;
 
     /* This would typically happen if user selected a time period
      * with no transactions related. */
@@ -756,6 +758,9 @@
 
     transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
     gsb_data_transaction_set_archive_number ( transaction_number, archive_number );
+    /* On supprime l'opération dans le tree_view */
+    if ( gsb_data_transaction_get_mother_transaction_number ( transaction_number ) == 0 )
+        gsb_transactions_list_delete_transaction_from_tree_view ( transaction_number );
     tmp_list = tmp_list -> next;
     }
 
@@ -797,6 +802,12 @@
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
+
+    /* On met à jour l'affichage de la liste si nécessaire */
+    if ( ( account_nb = gsb_gui_navigation_get_current_account ( ) ) != -1 )
+        gsb_transactions_list_update_tree_view ( account_nb, FALSE );
+
+        
     return FALSE;
 }
 
@@ -881,6 +892,7 @@
     while (tmp_list)
     {
         gint transaction_number;
+
         transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
 
         if ( g_date_compare ( init_gdate,

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- gsb_transactions_list.c	15 Jul 2009 19:01:03 -0000	1.178
+++ gsb_transactions_list.c	13 Aug 2009 19:24:49 -0000	1.179
@@ -1137,8 +1137,9 @@
 	    if (name)
 	    {
 	        gchar* tmpstr = g_strdup_printf (
-		         _("Do you want to load the transaction of the archive %s into the list ?"),
-                         name );
+                        _("Do you want to add the transactions of the archive %s "
+                        "into the list ?"),
+                        name );
 		if (question_yes_no ( tmpstr , GTK_RESPONSE_CANCEL ))
 		    gsb_transactions_list_restore_archive (archive_number, TRUE);
 		g_free(tmpstr);
@@ -1146,9 +1147,13 @@
 	    else
 	    {
 		if (archive_number)
-		    warning_debug (_("An archive was clicked but Grisbi is unable to get the name. It seems like a bug.\nPlease try to reproduce and contact the Grisbi team."));
+		    warning_debug ( _("An archive was clicked but Grisbi is unable to get the name. "
+                        "It seems like a bug.\nPlease try to reproduce and contact the "
+                        "Grisbi team.") );
 		else
-		    warning_debug (_("An archive was clicked but it seems to have the number 0, wich should not happen.\nPlease try to reproduce and contact the Grisbi team."));
+		    warning_debug ( _("An archive was clicked but it seems to have the number 0, "
+                        "wich should not happen.\nPlease try to reproduce and contact "
+                        "the Grisbi team.") );
 	    }
 	}
 	return FALSE;
@@ -1999,7 +2004,7 @@
 {
     gint contra_transaction_number;
 
-    devel_debug_int (transaction_number);
+    //~ devel_debug_int (transaction_number);
 
     if ( transaction_number == -1 )
 	return FALSE;
@@ -3286,84 +3291,96 @@
     GSList *tmp_list;
     gint account_number;
     gint transaction_number;
+    gboolean exist = FALSE;
+
+    devel_debug_int (archive_number);
 
     /* remove the lines of the archive in the model */
-    transaction_list_remove_archive (archive_number);
+    exist = transaction_list_remove_archive (archive_number);
     /* remove the structures of archive_model */
     gsb_data_archive_store_remove_by_archive (archive_number);
 
-    orphan_child_transactions = NULL;
-
-    /* second step, we add all the archived transactions of that archive into the
-     * transactions_list and into the store */
-    tmp_list = gsb_data_transaction_get_complete_transactions_list ();
-    while (tmp_list)
+    /* si l'archive existait bien on ajoute les transactions dans la liste et dans le 
+     * tree_view. Evite de charger deux fois les données si on supprime l'archive
+     * après avoir ajouté les lignes */
+    if (exist )
     {
-	transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+        orphan_child_transactions = NULL;
 
-	if ( gsb_data_transaction_get_archive_number (transaction_number) == archive_number)
-	{
-	    /* append the transaction to the list of non archived transactions */
-	    gsb_data_transaction_add_archived_to_list (transaction_number);
+        /* second step, we add all the archived transactions of that archive into the
+         * transactions_list and into the store */
+        tmp_list = gsb_data_transaction_get_complete_transactions_list ();
+        while (tmp_list)
+        {
+        transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
 
-	    /* the transaction belongs to the archive we want to show, so append it to the list store */
-	    transaction_list_append_transaction ( transaction_number);
-	}
-	tmp_list = tmp_list -> next;
-    }
+        if ( gsb_data_transaction_get_archive_number (transaction_number) == archive_number)
+        {
+            /* append the transaction to the list of non archived transactions */
+            gsb_data_transaction_add_archived_to_list (transaction_number);
 
-    /* if orphan_child_transactions if filled, there are some children wich didn't find their
-     * mother, we try again now that all the mothers are in the model */
-    if (orphan_child_transactions)
-    {
-	GSList *orphan_list_copy;
+            /* the transaction belongs to the archive we want to show, so append it to the list store */
+            transaction_list_append_transaction ( transaction_number);
+        }
+        tmp_list = tmp_list -> next;
+        }
 
-	orphan_list_copy = g_slist_copy (orphan_child_transactions);
-	g_slist_free (orphan_child_transactions);
-	orphan_child_transactions = NULL;
+        /* if orphan_child_transactions if filled, there are some children wich didn't find their
+         * mother, we try again now that all the mothers are in the model */
+        if (orphan_child_transactions)
+        {
+        GSList *orphan_list_copy;
 
-	tmp_list = orphan_list_copy;
-	while (tmp_list)
-	{
-	    transaction_number = GPOINTER_TO_INT (tmp_list -> data);
-	    transaction_list_append_transaction (transaction_number);
-	    tmp_list = tmp_list -> next;
-	}
-	g_slist_free (orphan_list_copy);
+        orphan_list_copy = g_slist_copy (orphan_child_transactions);
+        g_slist_free (orphan_child_transactions);
+        orphan_child_transactions = NULL;
 
-	/* if orphan_child_transactions is not null, there is still some children
-	 * wich didn't find their mother. show them now */
-	if (orphan_child_transactions)
-	{
-	    gchar *message = _("Some children didn't find their mother in the list, this shouldn't happen and there is probably a bug behind that. Please contact the Grisbi team.\n\nThe concerned children number are :\n");
-	    gchar *string_1;
-	    gchar *string_2;
+        tmp_list = orphan_list_copy;
+        while (tmp_list)
+        {
+            transaction_number = GPOINTER_TO_INT (tmp_list -> data);
+            transaction_list_append_transaction (transaction_number);
+            tmp_list = tmp_list -> next;
+        }
+        g_slist_free (orphan_list_copy);
 
-	    string_1 = g_strconcat (message, NULL);
-	    tmp_list = orphan_child_transactions;
-	    while (tmp_list)
-	    {
-		string_2 = g_strconcat ( string_1,
-					 utils_str_itoa (GPOINTER_TO_INT (tmp_list -> data)),
-					 " - ",
-					 NULL);
-		g_free (string_1);
-		string_1 = string_2;
-		tmp_list = tmp_list -> next;
-	    }
-	    dialogue_warning (string_1);
-	    g_free (string_1);
-	}
+        /* if orphan_child_transactions is not null, there is still some children
+         * wich didn't find their mother. show them now */
+        if (orphan_child_transactions)
+        {
+            gchar *message = _("Some children didn't find their mother in the list, this shouldn't happen and there is probably a bug behind that. Please contact the Grisbi team.\n\nThe concerned children number are :\n");
+            gchar *string_1;
+            gchar *string_2;
+
+            string_1 = g_strconcat (message, NULL);
+            tmp_list = orphan_child_transactions;
+            while (tmp_list)
+            {
+            string_2 = g_strconcat ( string_1,
+                         utils_str_itoa (GPOINTER_TO_INT (tmp_list -> data)),
+                         " - ",
+                         NULL);
+            g_free (string_1);
+            string_1 = string_2;
+            tmp_list = tmp_list -> next;
+            }
+            dialogue_warning (string_1);
+            g_free (string_1);
+        }
+        }
     }
 
     /* all the transactions of the archive have been added, we just need to clean the list,
      * but don't touch to the main page and to the current balances... we didn't change anything */
     account_number = gsb_gui_navigation_get_current_account ();
     if (account_number != -1)
-	gsb_transactions_list_update_tree_view (account_number, TRUE);
+        gsb_transactions_list_update_tree_view (account_number, TRUE);
 
     if (!gsb_data_account_get_r (account_number) && show_warning)
-	dialogue (_("You have just recovered an archive, if you don't see any new transaction, remember that the R transactions are not showed so the archived transactions are certainly hidden...\n\nSow the R transactions to make them visible."));
+        dialogue ( _("You have just recovered an archive, if you don't see any new "
+                        "transaction, remember that the R transactions are not showed "
+                        "so the archived transactions are certainly hidden...\n\n"
+                        "Show the R transactions to make them visible.") );
 
     return FALSE;
 }

Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- accueil.c	9 Aug 2009 18:31:42 -0000	1.204
+++ accueil.c	13 Aug 2009 19:24:48 -0000	1.205
@@ -32,8 +32,8 @@
 #include "./gsb_data_payee.h"
 #include "./gsb_data_scheduled.h"
 #include "./gsb_data_transaction.h"
-#include "./gsb_form.h"
 #include "./utils_dates.h"
+#include "./gsb_form.h"
 #include "./navigation.h"
 #include "./gsb_real.h"
 #include "./gsb_scheduler.h"
@@ -79,6 +79,7 @@
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern gboolean balances_with_scheduled;
 extern GdkColor couleur_bleue;
 extern GdkColor couleur_jaune;
 extern GdkColor couleur_nom_compte_normal;
@@ -449,6 +450,9 @@
         /* Création du tableau dans lequel seront stockés les comptes avec leur solde. */
         tmpstr = g_strdup_printf ( _("Account balances in %s"),
                         gsb_data_currency_get_name ( currency_number ) );
+        if ( balances_with_scheduled == FALSE )
+            tmpstr = g_strconcat ( tmpstr, _(" at "), gsb_date_today (), NULL );
+
         paddingbox = new_paddingbox_with_title ( vbox, FALSE, tmpstr );
         g_free ( tmpstr );
 
@@ -523,6 +527,9 @@
         /* solde.                                                                   */
         gchar* tmpstr = g_strdup_printf (_("Liabilities accounts balances in %s"),
                          gsb_data_currency_get_name (currency_number) );
+        if ( balances_with_scheduled == FALSE )
+            tmpstr = g_strconcat ( tmpstr, _(" at "), gsb_date_today (), NULL );
+
         paddingbox = new_paddingbox_with_title ( vbox, FALSE, tmpstr );
         g_free ( tmpstr );
 
@@ -586,6 +593,9 @@
         /* solde.                                                                   */
         gchar* tmpstr = g_strdup_printf (_("Assets accounts balances in %s"),
                          gsb_data_currency_get_name (currency_number));
+        if ( balances_with_scheduled == FALSE )
+            tmpstr = g_strconcat ( tmpstr, _(" at "), gsb_date_today (), NULL );
+
         paddingbox = new_paddingbox_with_title ( vbox, FALSE, tmpstr );
         g_free ( tmpstr );
 

Index: transaction_list.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- transaction_list.h	17 Jun 2009 19:39:51 -0000	1.9
+++ transaction_list.h	13 Aug 2009 19:24:49 -0000	1.10
@@ -14,7 +14,6 @@
 gint transaction_list_get_n_children ( gint transaction_number );
 gboolean transaction_list_redraw ( void );
 gboolean transaction_list_remove_archive ( gint archive_number );
-gboolean transaction_list_remove_archive_transaction ( gint transaction_number );
 gboolean transaction_list_remove_transaction ( gint transaction_number );
 void transaction_list_set ( GtkTreeIter *iter, ... );
 void transaction_list_set_balances ( void );

Index: utils_dates.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- utils_dates.c	6 Jun 2009 19:28:07 -0000	1.55
+++ utils_dates.c	13 Aug 2009 19:24:49 -0000	1.56
@@ -117,8 +117,7 @@
     GDate *date;
 
     date = g_date_new ();
-    g_date_set_time (  date,
-                        time (NULL));
+    g_date_set_time_t (  date, time (NULL));
     return ( date );
 }
 

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- transaction_list.c	29 Jul 2009 12:06:06 -0000	1.46
+++ transaction_list.c	13 Aug 2009 19:24:49 -0000	1.47
@@ -38,12 +38,12 @@
 #include "./dialog.h"
 #include "./affichage_liste.h"
 #include "./gsb_transactions_list.h"
+#include "./utils_dates.h"
 #include "./gsb_data_account.h"
 #include "./gsb_data_archive.h"
 #include "./gsb_data_archive_store.h"
 #include "./gsb_data_currency.h"
 #include "./gsb_data_transaction.h"
-#include "./utils_dates.h"
 #include "./navigation.h"
 #include "./gsb_real.h"
 #include "./transaction_list_select.h"
@@ -387,7 +387,9 @@
 
     /* if there are some children, remove them first */
     while (record -> number_of_children)
-	transaction_list_remove_transaction ( gsb_data_transaction_get_transaction_number (record -> children_rows[0] -> transaction_pointer));
+        transaction_list_remove_transaction (
+                        gsb_data_transaction_get_transaction_number (
+                        record -> children_rows[0] -> transaction_pointer ) );
 
     /* now we can delete the rows */
     for (i=0 ; i<CUSTOM_MODEL_N_VISIBLES_COLUMN ; i++)
@@ -501,7 +503,9 @@
 {
     gint i;
     CustomList *custom_list;
+    gboolean return_val = FALSE;
 
+    devel_debug_int (archive_number);
     custom_list = transaction_model_get_model ();
 
     g_return_val_if_fail ( custom_list != NULL, FALSE);
@@ -509,61 +513,64 @@
     /* there is several archive store records which correspond to the archive */
     for (i=0 ; i < custom_list -> num_rows ; i++)
     {
-	CustomRecord *record;
-	gulong newsize;
-	GtkTreePath *path;
-	gint j;
+        CustomRecord *record;
+        gulong newsize;
+        GtkTreePath *path;
+        gint j;
 
-	record = custom_list -> rows[i];
-	if ( record -> what_is_line != IS_ARCHIVE
-	     ||
-	     gsb_data_archive_store_get_archive_number (gsb_data_archive_store_get_number (
-											   record -> transaction_pointer )) != archive_number )
-	    continue;
+        record = custom_list -> rows[i];
+        if ( record -> what_is_line != IS_ARCHIVE
+             ||
+             gsb_data_archive_store_get_archive_number (gsb_data_archive_store_get_number (
+                        record -> transaction_pointer )) != archive_number )
+        {
+            continue;
+        }
 
-	/* we are on a good archive store, delete it */
+        /* we are on a good archive store, delete it */
 
-	/* delete the rows */
-	for (j=0 ; j<CUSTOM_MODEL_N_VISIBLES_COLUMN ; j++)
-	    if (record -> visible_col[j])
-		g_free (record -> visible_col[j]);
+        /* delete the rows */
+        for (j=0 ; j<CUSTOM_MODEL_N_VISIBLES_COLUMN ; j++)
+            if (record -> visible_col[j])
+            g_free (record -> visible_col[j]);
 
-	/* remove the row */
-	custom_list -> num_rows--;
+        /* remove the row */
+        custom_list -> num_rows--;
 
-	for (j=record -> pos ; j < custom_list -> num_rows ; j++)
-	{
-	    custom_list -> rows[j] = custom_list -> rows[j+1];
-	    custom_list -> rows[j] -> pos = j;
-	}
+        for (j=record -> pos ; j < custom_list -> num_rows ; j++)
+        {
+            custom_list -> rows[j] = custom_list -> rows[j+1];
+            custom_list -> rows[j] -> pos = j;
+        }
 
-	/* if the archive was showed, modify the visible transactions */
-	if ( record -> filtered_pos != -1  && custom_list -> num_visibles_rows > 0 )
-	{
-	    custom_list -> num_visibles_rows--;
+        /* if the archive was showed, modify the visible transactions */
+        if ( record -> filtered_pos != -1  && custom_list -> num_visibles_rows > 0 )
+        {
+            custom_list -> num_visibles_rows--;
 
-	    for (j=record -> filtered_pos ; j < custom_list -> num_visibles_rows ; j++)
-	    {
-		custom_list -> visibles_rows[j] = custom_list -> visibles_rows[j + 1];
-		custom_list -> visibles_rows[j] -> filtered_pos = j;
-	    }
+            for (j=record -> filtered_pos ; j < custom_list -> num_visibles_rows ; j++)
+            {
+            custom_list -> visibles_rows[j] = custom_list -> visibles_rows[j + 1];
+            custom_list -> visibles_rows[j] -> filtered_pos = j;
+            }
 
-	    path = gtk_tree_path_new ();
-	    gtk_tree_path_append_index(path, record -> filtered_pos);
-	    gtk_tree_model_row_deleted (GTK_TREE_MODEL(custom_list), path);
-	    gtk_tree_path_free(path);
-	}
+            path = gtk_tree_path_new ();
+            gtk_tree_path_append_index(path, record -> filtered_pos);
+            gtk_tree_model_row_deleted (GTK_TREE_MODEL(custom_list), path);
+            gtk_tree_path_free(path);
+        }
 
-	/* resize the array */
-	newsize = custom_list->num_rows * sizeof(CustomRecord*);
-	custom_list->rows = g_realloc(custom_list->rows, newsize);
-	custom_list->visibles_rows = g_realloc(custom_list->visibles_rows, newsize);
+        /* resize the array */
+        newsize = custom_list->num_rows * sizeof(CustomRecord*);
+        custom_list->rows = g_realloc(custom_list->rows, newsize);
+        custom_list->visibles_rows = g_realloc(custom_list->visibles_rows, newsize);
 
-	/* free the record */
-	g_free (record);
+        /* free the record */
+        g_free (record);
+        return_val = TRUE;
     }
 
-    return TRUE;
+    return return_val;
 }
 
 
@@ -1649,7 +1656,7 @@
 
     /* find 1 of the mother row (the others are into the structure of the mother)
      * usually, it's the last record appended */
-    mother_record =last_mother_appended;
+    mother_record = last_mother_appended;
 
     if ( !mother_record
 	 ||
@@ -1657,29 +1664,33 @@
 	  !=
 	  gsb_data_transaction_get_mother_transaction_number (transaction_number)))
     {
-	/* the last record appended was not the mother, need to search into the entire list */
-	if (transaction_model_get_transaction_iter ( &mother_iter,
-						     gsb_data_transaction_get_mother_transaction_number (transaction_number),
-						     0 ))
-	    mother_record = (CustomRecord *) mother_iter.user_data;
-	else
-	{
-	    /* we didn't find the mother of the child, we append the child number to
-	     * orphan_child_transactions and the function wich called here has to play
-	     * with it
-	     * (it happens in the versions before 0.6 when the children could have a number
-	     * before the mother */
-
-	    orphan_child_transactions = g_slist_append ( orphan_child_transactions,
-							 GINT_TO_POINTER (transaction_number));
-	    return;
-	}
+        /* the last record appended was not the mother, need to search into the entire list */
+        if ( transaction_model_get_transaction_iter ( &mother_iter,
+                        gsb_data_transaction_get_mother_transaction_number (
+                        transaction_number),
+                        0 ) )
+            mother_record = (CustomRecord *) mother_iter.user_data;
+        else
+        {
+            /* we didn't find the mother of the child, we append the child number to
+             * orphan_child_transactions and the function wich called here has to play
+             * with it
+             * (it happens in the versions before 0.6 when the children could have a number
+             * before the mother */
+            orphan_child_transactions = g_slist_append ( orphan_child_transactions,
+                                 GINT_TO_POINTER (transaction_number));
+            return;
+        }
     }
 
     /* ok, at this level, mother_record is ok and is one of the row of the mother transaction
      * we go on the first mother */
     mother_record = mother_record -> transaction_records[0];
 
+    /* set by default the mother row of the child. avoids a crash when creating 
+     * an archive directly on the home page */
+    newrecord -> mother_row = mother_record;
+
     /* get the new number of the row into the mother */
     pos = mother_record -> number_of_children;
 
@@ -1688,8 +1699,12 @@
     if (!pos)
     {
 	gchar *tmpstr;
-	tmpstr = g_strdup_printf (_("Trying to append the child number %d to the mother %d in the model, but no white line was created before... Better to stop here, please contact the Grisbi team to fix that issue."),
-				  transaction_number, gsb_data_transaction_get_mother_transaction_number (transaction_number));
+	tmpstr = g_strdup_printf (
+                        _("Trying to append the child number %d to the mother %d "
+                        "in the model, but no white line was created before... "
+                        "Better to stop here, please contact the Grisbi team to "
+                        "fix that issue."),
+                        transaction_number, gsb_data_transaction_get_mother_transaction_number (transaction_number));
 	dialogue_error (tmpstr);
 	g_free (tmpstr);
 	g_free (newrecord);
@@ -1952,89 +1967,6 @@
 
 
 /**
- * remove a transaction from the tree model but not its children
- *
- * \param transaction_number    the transaction to remove
- *
- * \return TRUE : transaction removed, FALSE : problem, nothing done
- * */
-gboolean transaction_list_remove_archive_transaction ( gint transaction_number )
-{
-    CustomRecord *record;
-    gint i;
-    GtkTreeIter iter;
-    gint record_filtered_pos;
-    gulong newsize;
-    GtkTreePath *path;
-    CustomList *custom_list;
-
-    custom_list = transaction_model_get_model ();
-
-    g_return_val_if_fail ( custom_list != NULL, FALSE);
-
-    /* get the record */
-    if (!transaction_model_get_transaction_iter (&iter, transaction_number, 0))
-	return FALSE;
-
-    record = iter.user_data;
-    if (!record)
-	return FALSE;
-
-    /* if selected transaction, remove it */
-    if (record == custom_list -> selected_row)
-	custom_list -> selected_row = NULL;
-
-    /* on ne s'occupe pas des sous opérations car elles seront aussi supprimées */
-    for (i=0 ; i<CUSTOM_MODEL_N_VISIBLES_COLUMN ; i++)
-	if (record -> visible_col[i])
-	    g_free (record -> visible_col[i]);
-
-    record_filtered_pos = record -> filtered_pos;
-
-    /* we are on a mother transaction, remove the row */
-    custom_list -> num_rows = custom_list -> num_rows - TRANSACTION_LIST_ROWS_NB;
-
-    for (i=record -> pos ; i < custom_list -> num_rows ; i++)
-    {
-	custom_list -> rows[i] = custom_list -> rows[i+TRANSACTION_LIST_ROWS_NB];
-	custom_list -> rows[i] -> pos = i;
-    }
-
-    /* if the transaction was showed, modify the visible transactions */
-    if (record -> filtered_pos != -1)
-    {
-	custom_list -> num_visibles_rows = custom_list -> num_visibles_rows - custom_list -> nb_rows_by_transaction;
-
-	for (i=record -> filtered_pos ; i < custom_list -> num_visibles_rows ; i++)
-	{
-	    custom_list -> visibles_rows[i] = custom_list -> visibles_rows[i + custom_list -> nb_rows_by_transaction];
-	    custom_list -> visibles_rows[i] -> filtered_pos = i;
-	}
-    }
-
-    /* resize the array */
-    newsize = custom_list->num_rows * sizeof(CustomRecord*);
-    custom_list->rows = g_realloc(custom_list->rows, newsize);
-    custom_list->visibles_rows = g_realloc(custom_list->visibles_rows, newsize);
-
-    /* free the records */
-    for (i=TRANSACTION_LIST_ROWS_NB ; i ; i--)
-    {
-	if (record -> transaction_records[i-1] -> filtered_pos != -1)
-	{
-	    path = gtk_tree_path_new ();
-	    gtk_tree_path_append_index(path, record -> transaction_records[i-1] -> filtered_pos);
-	    gtk_tree_model_row_deleted (GTK_TREE_MODEL(custom_list), path);
-	    gtk_tree_path_free(path);
-	}
-	g_free (record -> transaction_records[i-1]);
-    }
-
-    return TRUE;
-}
-
-
-/**
  * colorise avec un fond gris la ligne qui correspond à la date du jour
  *
  * \param 
@@ -2043,7 +1975,7 @@
  * */
 void transaction_list_set_color_jour ( gint account_number )
 {
-    GDate *date_jour = g_date_new ( );
+    GDate *date_jour;
     gint i, j;
     gint res;
     gint transaction_number;
@@ -2054,7 +1986,7 @@
     custom_list = transaction_model_get_model ();
     g_return_if_fail ( custom_list != NULL );
 
-    g_date_set_time_t (date_jour, time (NULL));
+    date_jour = gdate_today ( );
 
     for (i= custom_list -> num_visibles_rows -1; i >= 0  ; i--)
     {



More information about the cvs mailing list