[grisbi-cvs] grisbi/src accueil.c, 1.218, 1.219 classement_echeances.c, 1.12, 1.13 csv_parse.c, 1.21, 1.22 dialog.c, 1.76, 1.77 dialog.h, 1.35, 1.36 gsb_data_account.c, 1.92, 1.93 gsb_data_form.c, 1.13, 1.14 gsb_file_config.c, 1.88, 1.89 gsb_file_load.c, 1.198, 1.199 gsb_form.c, 1.140, 1.141 gsb_form_scheduler.c, 1.35, 1.36 gsb_form_scheduler.h, 1.4, 1.5 gsb_scheduler_list.c, 1.74, 1.75 gsb_transactions_list.c, 1.190, 1.191 import_csv.c, 1.58, 1.59 main.c, 1.157, 1.158 menu.c, 1.147, 1.148 parametres.c, 1.208, 1.209 parametres.h, 1.32, 1.33 utils.c, 1.57, 1.58 utils.h, 1.26, 1.27 utils_dates.c, 1.59, 1.60 utils_str.c, 1.73, 1.74

Pierre Biava pbiava at users.sourceforge.net
Sat Dec 26 17:57:16 CET 2009


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

Modified Files:
	accueil.c classement_echeances.c csv_parse.c dialog.c dialog.h 
	gsb_data_account.c gsb_data_form.c gsb_file_config.c 
	gsb_file_load.c gsb_form.c gsb_form_scheduler.c 
	gsb_form_scheduler.h gsb_scheduler_list.c 
	gsb_transactions_list.c import_csv.c main.c menu.c 
	parametres.c parametres.h utils.c utils.h utils_dates.c 
	utils_str.c 
Log Message:
Correction des bugs 798 799 801 803. Ajout de messages facultatifs pour la suppression des opérations. Minor corrections.

Index: gsb_scheduler_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler_list.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- gsb_scheduler_list.c	23 Sep 2009 20:28:20 -0000	1.74
+++ gsb_scheduler_list.c	26 Dec 2009 16:57:13 -0000	1.75
@@ -3,7 +3,7 @@
 /*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2004-2008 Benjamin Drieu (bdrieu at april.org)                       */
 /*      2009 Thomas Peel (thomas.peel at live.fr)                                */
-/*          2008-2009 Pierre Biava (grisbi at pierre.biava.name                  */
+/*          2008-2009 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -99,6 +99,7 @@
 extern gint affichage_echeances_perso_nb_libre;
 extern GdkColor couleur_fond[2];
 extern GdkColor couleur_grise;
+extern struct conditional_message delete_msg[];
 extern gint mise_a_jour_liste_echeances_manuelles_accueil;
 extern GtkWidget * navigation_tree_view;
 extern GtkWidget *scheduler_button_delete;
@@ -1621,7 +1622,9 @@
 gboolean gsb_scheduler_list_delete_scheduled_transaction ( gint scheduled_number,
                         gboolean show_warning )
 {
+    gchar *tmpstr;
     gint result;
+    gint msg_no = 0;
 
     devel_debug_int (scheduled_number);
 
@@ -1638,38 +1641,45 @@
     /* show a warning */
     if (show_warning)
     {
-	if ( gsb_data_scheduled_get_mother_scheduled_number (scheduled_number))
-	{
-	    /* ask all the time for a child */
-	    gchar* tmpstr = g_strdup_printf ( _("Do you really want to delete the child of the scheduled transaction with party '%s' ?"),
-							   gsb_data_payee_get_name ( gsb_data_scheduled_get_party_number (scheduled_number),
-										     FALSE ));
-	    if ( !question_yes_no_hint ( _("Delete a scheduled transaction"),
-					 tmpstr,
-					 GTK_RESPONSE_NO ))
-	    {
-	        g_free ( tmpstr );
-		return FALSE;
-	    }
-	    g_free ( tmpstr );
-	}
-	else
-	{
-	    /* for a normal scheduled, ask only if no frequency, else, it will have another dialog to delete the occurence or the transaction */
-	    gchar* str_to_free = NULL;
-	    if ( !gsb_data_scheduled_get_frequency (scheduled_number)
-		 &&
-		 !question_yes_no_hint ( _("Delete a transaction"),
-					 str_to_free = g_strdup_printf ( _("Do you really want to delete the scheduled transaction with party '%s' ?"),
-							   gsb_data_payee_get_name ( gsb_data_scheduled_get_party_number (scheduled_number),
-										     FALSE )),
-					 GTK_RESPONSE_NO ))
-	    {
-	        if (str_to_free) g_free (str_to_free);
-		return FALSE;
-	    }
-	    if (str_to_free) g_free (str_to_free);
-	}
+        if ( gsb_data_scheduled_get_mother_scheduled_number (scheduled_number))
+        {
+            /* ask all the time for a child */
+            msg_no = question_conditional_yes_no_get_no_struct ( &delete_msg[0],
+                        "delete-child-scheduled" );
+            tmpstr = g_strdup_printf ( _("Do you really want to delete the child of the "
+                        "scheduled transaction with party '%s' ?"),
+                        gsb_data_payee_get_name (
+                        gsb_data_scheduled_get_party_number (scheduled_number),
+                        FALSE ) );
+            delete_msg[msg_no].message = tmpstr;
+            if ( !question_conditional_yes_no_with_struct ( &delete_msg[msg_no] ) )
+            {
+                g_free ( tmpstr );
+                return FALSE;
+            }
+            g_free ( tmpstr );
+        }
+        else
+        {
+            /* for a normal scheduled, ask only if no frequency, else, it will 
+             * have another dialog to delete the occurence or the transaction */
+            msg_no = question_conditional_yes_no_get_no_struct ( &delete_msg[0],
+                        "delete-scheduled" );
+            tmpstr = g_strdup_printf ( _("Do you really want to delete the scheduled "
+                        "transaction with party '%s' ?"),
+                        gsb_data_payee_get_name (
+                        gsb_data_scheduled_get_party_number ( scheduled_number ),
+                                                 FALSE ) );
+            delete_msg[msg_no].message = tmpstr;
+            if ( !gsb_data_scheduled_get_frequency (scheduled_number)
+             &&
+             !question_conditional_yes_no_with_struct ( &delete_msg[msg_no] ) )
+            {
+                g_free ( tmpstr );
+                return FALSE;
+            }
+            g_free ( tmpstr );
+        }
     }
 
     /* split with child of split or normal scheduled,
@@ -1689,30 +1699,53 @@
 
 	if ( gsb_data_scheduled_get_frequency (scheduled_number))
 	{
-	    GtkWidget *dialog;
+	    GtkWidget * vbox, * checkbox, *dialog = NULL;
 	    gchar *occurences;
 
-	    gchar* tmpstr = gsb_real_get_string (gsb_data_scheduled_get_amount (scheduled_number));
-	    occurences = g_strdup_printf ( _("Do you want to delete just this occurrence or the whole scheduled transaction?\n\n%s : %s [%s %s]"),
-					   gsb_format_gdate ( gsb_data_scheduled_get_date (scheduled_number)),
-					   gsb_data_payee_get_name ( gsb_data_scheduled_get_party_number (scheduled_number), FALSE ),
-					   tmpstr,
-					   gsb_data_currency_get_name (gsb_data_scheduled_get_currency_number (scheduled_number)));
+        msg_no = question_conditional_yes_no_get_no_struct ( &delete_msg[0],
+                        "delete-scheduled-occurences" );
+        
+        if ( delete_msg[msg_no].hidden )
+            result = delete_msg[msg_no].default_answer;
+        else
+        {
+	    tmpstr = gsb_real_get_string (gsb_data_scheduled_get_amount (scheduled_number));
+	    occurences = g_strdup_printf ( _("Do you want to delete just this occurrence or "
+                        "the whole scheduled transaction?\n\n%s : %s [%s %s]"),
+                        gsb_format_gdate ( gsb_data_scheduled_get_date (scheduled_number)),
+                        gsb_data_payee_get_name (
+                        gsb_data_scheduled_get_party_number (scheduled_number), FALSE ),
+                        tmpstr,
+                        gsb_data_currency_get_name (
+                        gsb_data_scheduled_get_currency_number (scheduled_number)));
 	    g_free ( tmpstr );
 
 	    dialog = dialogue_special_no_run ( GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
-					       make_hint ( _("Delete this scheduled transaction?"),
-							   occurences ));
+                        make_hint ( _("Delete this scheduled transaction?"),
+                        occurences ));
 
 	    gtk_dialog_add_buttons ( GTK_DIALOG(dialog),
-				     GTK_STOCK_CANCEL, 2,
-				     _("All the occurences"), 1,
-				     _("Only this one"), 0,
-				     NULL );
+                         GTK_STOCK_CANCEL, 2,
+                         _("All the occurences"), 1,
+                         _("Only this one"), 0,
+                         NULL );
+
+        vbox = GTK_DIALOG(dialog) -> vbox;
+
+        checkbox = gtk_check_button_new_with_label ( _("Do not show this message again") );
+        g_signal_connect ( G_OBJECT ( checkbox ),
+                        "toggled", 
+                        G_CALLBACK ( dialogue_update_struct_message ),
+                        &delete_msg[msg_no] );
+        gtk_box_pack_start ( GTK_BOX ( vbox ), checkbox, TRUE, TRUE, 6 );
+        gtk_widget_show_all ( checkbox );
 
 	    result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
+
+        delete_msg[msg_no].default_answer = result;
 	    g_free (occurences);
 	    gtk_widget_destroy ( dialog );
+        }
 	}
 	else
 	    result = 1;

Index: gsb_data_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_form.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- gsb_data_form.c	7 Nov 2009 19:13:59 -0000	1.13
+++ gsb_data_form.c	26 Dec 2009 16:57:13 -0000	1.14
@@ -501,6 +501,8 @@
 	    continue;
 
 	tmp_form = gsb_data_account_get_form_organization (no_account);
+    if ( tmp_form == NULL )
+        continue;
 
 	for (col = 0 ; col<MAX_WIDTH ; col++)
 	{

Index: dialog.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/dialog.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- dialog.c	3 Nov 2009 17:32:07 -0000	1.76
+++ dialog.c	26 Dec 2009 16:57:13 -0000	1.77
@@ -2,6 +2,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2003-2008 Benjamin Drieu (bdrieu at april.org)                       */
+/*                      2008-2009 Pierre Biava (grisbi at pierre.biava.name)     */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -36,8 +37,6 @@
                         GtkMessageType type,
                         GtkButtonsType buttons );
 static void dialogue_conditional_special ( gchar *text, gchar *var, GtkMessageType type );
-static gboolean dialogue_update_struct_message ( GtkWidget *checkbox,
-                        struct conditional_message *message );
 static gboolean dialogue_update_var ( GtkWidget *checkbox, gint message );
 /*END_STATIC*/
 
@@ -55,19 +54,26 @@
       FALSE, FALSE, },
 
     { "ofx-security-not-implemented", N_("Security feature not implemented"),
-      N_("This file contains security informations, which processing is not implemented at this moment."),
+      N_("This file contains security informations, which processing is not implemented at "
+      "this moment."),
       FALSE, FALSE, },
 
     { "encryption-is-irreversible", N_("Encryption is irreversible."),
-      N_("Grisbi encrypts files in a very secure way that does not allow recovery without original password.  It means that if you forget your password, you will loose all your data.  Use with caution.\n\nI repeat: if you ever forget your password, there is no coming back, we cannot help you."), 
+      N_("Grisbi encrypts files in a very secure way that does not allow recovery without "
+      "original password.  It means that if you forget your password, you will loose all "
+      "your data.  Use with caution.\n\nI repeat: if you ever forget your password, there "
+      "is no coming back, we cannot help you."), 
       FALSE, FALSE, },
 
     { "account-file-readable",  N_("Account file is world readable."),
-      N_("Your account file should not be readable by anybody else, but it is. You should change its permissions.\nShould this be fixed now?"),
+      N_("Your account file should not be readable by anybody else, but it is. You should "
+      "change its permissions.\nShould this be fixed now?"),
       FALSE, FALSE, },
 
     { "account-already-opened", N_("File \"%s\" is already opened"),
-      N_("Either this file is already opened by another user or it wasn't closed correctly (maybe Grisbi crashed?).\nGrisbi can't save the file unless you activate the \"Force saving locked files\" option in setup."),
+      N_("Either this file is already opened by another user or it wasn't closed correctly "
+      "(maybe Grisbi crashed?).\nGrisbi can't save the file unless you activate the "
+      "\"Force saving locked files\" option in setup."),
       FALSE, FALSE, },
      
     { "minimum-balance-alert", N_("Account under desired balance."),
@@ -75,11 +81,13 @@
       FALSE, FALSE, },
     
     { "no-budgetary-line", N_("No budgetary line was entered"),
-      N_("This transaction has no budgetary line entered.  You should use them to easily produce budgets and make reports on them."),
+      N_("This transaction has no budgetary line entered.  You should use them to "
+      "easily produce budgets and make reports on them."),
       FALSE, FALSE, },
 
     { "recover-split", N_("Recover split?"),
-      N_("This is a split of transaction, associated transactions can be recovered as in last transaction with this payee.  Do you want to recover them?"),
+      N_("This is a split of transaction, associated transactions can be recovered as "
+      "in last transaction with this payee.  Do you want to recover them?"),
       FALSE, FALSE, },
 
     { "no-inconsistency-found", N_("No inconsistency found."),
@@ -87,7 +95,10 @@
       FALSE, FALSE, },
 
     { "reconcile-start-end-dates", N_("Reconcile start and end dates."),
-      N_("In previous versions, Grisbi did not save start date, end date and balance for reconciliation.  This is now done, so Grisbi will try to guess values from your accounts.  Thought this can not harm data coherence, false values can be guessed.  Please check in the Preferences window for more information."), 
+      N_("In previous versions, Grisbi did not save start date, end date and balance for "
+      "reconciliation.  This is now done, so Grisbi will try to guess values from your "
+      "accounts.  Thought this can not harm data coherence, false values can be guessed. "
+      "Please check in the Preferences window for more information."), 
       FALSE, FALSE, },
 
     { "development-version", N_("You are running Grisbi version %s"), 
@@ -288,7 +299,7 @@
 {
     GtkWidget * vbox, * checkbox, *dialog = NULL;
     int i;
-printf ( "dialogue_conditional_new : %s\n", var);
+
     if ( !var || !strlen ( var ) )
         return NULL;
 
@@ -339,7 +350,6 @@
  */
 void dialogue_conditional_hint ( gchar *hint, gchar *text, gchar *var )
 {
-    printf ( "dialogue_conditional_hint : %s\n", var);
     dialogue_conditional ( make_hint(hint, text), var );
 }
 
@@ -356,7 +366,6 @@
  */
 void dialogue_conditional ( gchar *text, gchar *var )
 {
-    printf ( "dialogue_conditional : %s\n", var);
     dialogue_conditional_special ( text, var, GTK_MESSAGE_WARNING );
 }
 
@@ -485,6 +494,15 @@
 }
 
 
+/**
+ * Pop up a warning dialog window with a question and a checkbox that allow
+ * this message not to be displayed again thanks to preferences and wait
+ * for user to press 'YES' or 'NO'.
+ *
+ * \param struct conditional_message
+ *
+ * \return TRUE if user pressed 'YES'.  FALSE otherwise.
+ */
 gboolean question_conditional_yes_no_with_struct ( struct conditional_message *message )
 {
     GtkWidget *dialog, *vbox, *checkbox;
@@ -494,7 +512,7 @@
     if ( message -> hidden )
         return message -> default_answer;
 
-    text = make_hint ( message -> hint, message -> message );
+    text = make_hint ( _(message -> hint), message -> message );
     dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
                         GTK_DIALOG_DESTROY_WITH_PARENT,
                         GTK_MESSAGE_WARNING,
@@ -526,6 +544,28 @@
 
 
 /**
+ * return the number of message
+ *
+ * \param struct conditional_message
+ * \param name of message
+ *
+ * \return message number or -1 is not present.
+ */
+gint question_conditional_yes_no_get_no_struct ( struct conditional_message *msg,
+                        gchar *name )
+{
+    gint i;
+
+    for  ( i = 0; msg[i].name; i++ )
+    {
+        if ( strcmp ( msg[i].name, name ) == 0 )
+            return i;
+    }
+    return -1;
+}
+
+
+/**
  * Concatenate two strings and use pango layout to produce a string
  * that will contain an hint and a text.
  *

Index: dialog.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/dialog.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- dialog.h	3 Nov 2009 17:32:07 -0000	1.35
+++ dialog.h	26 Dec 2009 16:57:13 -0000	1.36
@@ -28,6 +28,8 @@
 GtkWidget *dialogue_special_no_run ( GtkMessageType param,
                         GtkButtonsType buttons,
                         gchar *text );
+gboolean dialogue_update_struct_message ( GtkWidget *checkbox,
+                        struct conditional_message *message );
 G_MODULE_EXPORT void dialogue_warning ( gchar *text );
 void dialogue_warning_hint ( gchar *text, gchar *hint );
 gchar *make_blue ( gchar *text );
@@ -35,6 +37,8 @@
 gchar *make_pango_attribut ( gchar *attribut, gchar *text );
 gchar *make_red ( gchar *text );
 gboolean question_conditional_yes_no ( gchar *var );
+gint question_conditional_yes_no_get_no_struct ( struct conditional_message *message,
+                        gchar *name );
 gboolean question_conditional_yes_no_with_struct ( struct conditional_message *message );
 gboolean question_yes_no ( gchar *text, gint default_answer );
 gboolean question_yes_no_hint ( gchar *hint,

Index: menu.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/menu.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- menu.c	8 May 2009 17:21:15 -0000	1.147
+++ menu.c	26 Dec 2009 16:57:13 -0000	1.148
@@ -609,7 +609,7 @@
     if ( block_menu_cb ) return FALSE;
 
     gsb_form_switch_expander ( );
-
+    printf ("etat.formulaire_toujours_affiche = %d\n", etat.formulaire_toujours_affiche);
     return FALSE;
 }
 

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- gsb_data_account.c	6 Dec 2009 17:18:31 -0000	1.92
+++ gsb_data_account.c	26 Dec 2009 16:57:13 -0000	1.93
@@ -651,7 +651,8 @@
 
         account = list_tmp -> data;
 
-        if ( account -> account_number >= 0
+        if ( account_id
+         && account -> account_number >= 0
          && !account -> closed_account
          && account -> account_id
          && strlen ( account -> account_id ) > 0 )

Index: gsb_form_scheduler.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gsb_form_scheduler.h	26 Apr 2009 17:39:34 -0000	1.4
+++ gsb_form_scheduler.h	26 Dec 2009 16:57:13 -0000	1.5
@@ -25,6 +25,8 @@
 
 
 /* START_DECLARATION */
+gboolean gsb_form_scheduler_change_account ( GtkWidget *button,
+                        gpointer null );
 gboolean gsb_form_scheduler_clean ( void );
 gboolean gsb_form_scheduler_create ( GtkWidget *table );
 gboolean gsb_form_scheduler_free_list ( void );

Index: csv_parse.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/csv_parse.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- csv_parse.c	23 Nov 2009 15:15:47 -0000	1.21
+++ csv_parse.c	26 Dec 2009 16:57:13 -0000	1.22
@@ -1,7 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2005-2006 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)    2005-2006 Benjamin Drieu (bdrieu at april.org)           */
+/*          2008-2009 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          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      */
@@ -20,7 +21,6 @@
 /* ************************************************************************** */
 
 
-
 #include "include.h"
 
 /*START_INCLUDE*/
@@ -41,7 +41,6 @@
 /*END_STATIC*/
 
 
-
 /**
  * TODO
  *
@@ -188,17 +187,17 @@
 {
     GDate * date;
     g_return_val_if_fail ( string, FALSE );
-    
+
     date = gsb_parse_date_string ( string );
     if ( date && g_date_valid ( date ) && 
 	 ! csv_import_validate_number ( string ) )
     {
-	g_date_free ( date );
-	return TRUE;
+        g_date_free ( date );
+        return TRUE;
     }
     
-    if ( date );
-	g_date_free ( date );
+    if ( date )
+        g_date_free ( date );
     return FALSE;
 }
 
@@ -419,17 +418,15 @@
 {
     g_return_val_if_fail ( string, FALSE );
 
-    /** FIXME: how to handle balance ?  */
+    if ( strlen ( string ) > 0 )
+    {
+        ope -> montant = gsb_real_get_from_string ( string );
+        return TRUE;
+    }
 
-/*     if ( strlen ( string ) > 0 ) */
-/*     { */
-/* 	ope -> montant = my_strtod ( string, NULL ); */
-/*     } */
-    return TRUE;
+    return FALSE;
 }
 
-
-
 /**
  *
  *
@@ -508,14 +505,14 @@
 
     if ( ! strcmp ( string, "V" ) )
     {
-	ope -> operation_ventilee = 1;
+        ope -> ope_de_ventilation = 1;
+        return TRUE;
     }
 
-    return TRUE;
+    return FALSE;
 }
 
 
-
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- accueil.c	7 Nov 2009 19:13:59 -0000	1.218
+++ accueil.c	26 Dec 2009 16:57:13 -0000	1.219
@@ -34,6 +34,7 @@
 #include "./gsb_data_transaction.h"
 #include "./utils_dates.h"
 #include "./gsb_form.h"
+#include "./gsb_form_scheduler.h"
 #include "./navigation.h"
 #include "./gsb_real.h"
 #include "./gsb_scheduler.h"
@@ -309,6 +310,7 @@
                         gint scheduled_number )
 {
     GtkWidget *parent_save, *dialog, *hbox;
+    GtkWidget *button;
     gint result;
 
     parent_save = form_transaction_part -> parent;
@@ -334,15 +336,22 @@
 
     /* next we fill the form,
      * don't use gsb_form_show because we are neither on transactions list, neither scheduled list */
-    gsb_form_fill_from_account (gsb_data_scheduled_get_account_number (scheduled_number));
+    button = gsb_form_scheduler_get_element_widget( SCHEDULED_FORM_ACCOUNT );
+    g_signal_handlers_block_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK (gsb_form_scheduler_change_account),
+                        NULL );
 
+    gsb_form_fill_from_account (gsb_data_scheduled_get_account_number (scheduled_number));
     /* fill the form with the scheduled transaction */
     gsb_scheduler_list_execute_transaction(scheduled_number);
 
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( button ),
+                        G_CALLBACK (gsb_form_scheduler_change_account),
+                        NULL );
+
 	gtk_widget_show_all ( hbox );
 	result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
 
-
     if ( result == GTK_RESPONSE_OK )
 	 gsb_form_finish_edition ();
 

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- gsb_file_load.c	19 Dec 2009 16:07:46 -0000	1.198
+++ gsb_file_load.c	26 Dec 2009 16:57:13 -0000	1.199
@@ -169,6 +169,7 @@
 extern gint display_one_line;
 extern gint display_three_lines;
 extern gint display_two_lines;
+extern gsb_real error_real;
 extern struct iso_4217_currency iso_4217_currencies[];
 extern GtkWidget *logo_accueil;
 extern gint no_devise_totaux_categ;
@@ -6112,10 +6113,14 @@
     /* to go to the 0.6.0 we need to change the amount string
      * from 12.340000 to 12.34 before doing the conversion */
     gchar *tmp_string;
-
+    gsb_real number;
+    
     tmp_string = utils_str_reduce_exponant_from_string ( text, 2 );
-    gsb_data_account_set_init_balance ( account_number,
-                        gsb_real_get_from_string ( tmp_string ));
+    number = gsb_real_get_from_string ( tmp_string );
+    if ( number.mantissa == error_real.mantissa )
+        gsb_data_account_set_init_balance ( account_number, null_real );
+    else
+        gsb_data_account_set_init_balance ( account_number, number );
 
     if (tmp_string) 
         g_free (tmp_string);
@@ -6128,10 +6133,15 @@
     /* to go to the 0.6.0 we need to change the amount string
      * from 12.340000 to 12.34 before doing the conversion */
     gchar *tmp_string;
-
+    gsb_real number;
+    
     tmp_string = utils_str_reduce_exponant_from_string ( text, 2 );
-    gsb_data_account_set_mini_balance_wanted ( account_number,
-                               gsb_real_get_from_string (tmp_string));
+    number = gsb_real_get_from_string ( tmp_string );
+    if ( number.mantissa == error_real.mantissa )
+        gsb_data_account_set_init_balance ( account_number, null_real );
+    else
+        gsb_data_account_set_init_balance ( account_number, number );
+
     if (tmp_string) 
         g_free (tmp_string);
     return;
@@ -6143,11 +6153,16 @@
     /* to go to the 0.6.0 we need to change the amount string
      * from 12.340000 to 12.34 before doing the conversion */
     gchar *tmp_string;
-
+    gsb_real number;
+    
     tmp_string = utils_str_reduce_exponant_from_string ( text, 2 );
-    gsb_data_account_set_mini_balance_authorized ( account_number,
-                                   gsb_real_get_from_string (tmp_string));
-    if (tmp_string) g_free (tmp_string);
+    number = gsb_real_get_from_string ( tmp_string );
+    if ( number.mantissa == error_real.mantissa )
+        gsb_data_account_set_init_balance ( account_number, null_real );
+    else
+        gsb_data_account_set_init_balance ( account_number, number );
+
+        if (tmp_string) g_free (tmp_string);
     return;
     }
 

Index: import_csv.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import_csv.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- import_csv.c	23 Nov 2009 17:04:08 -0000	1.58
+++ import_csv.c	26 Dec 2009 16:57:13 -0000	1.59
@@ -1,8 +1,9 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2003 Cédric Auger	(cedric at grisbi.org)	      */
-/*			2004-2006 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)    2000-2003 Cédric Auger  (cedric at grisbi.org)           */
+/*          2004-2006 Benjamin Drieu (bdrieu at april.org)                       */
+/*                      2008-2009 Pierre Biava (grisbi at pierre.biava.name)     */
+/*          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      */
@@ -77,8 +78,7 @@
     { N_("Currency"),	    0.0, csv_import_validate_string, csv_import_parse_currency, "" },
     { N_("Date"),	    0.0, csv_import_validate_date,   csv_import_parse_date, "" },
     { N_("Value date"),	    0.0, csv_import_validate_date,   csv_import_parse_value_date, "" },
-    { N_("Payee"),	    0.0, csv_import_validate_string, csv_import_parse_payee,
-      N_("Wording") },
+    { N_("Payee"),	    0.0, csv_import_validate_string, csv_import_parse_payee, N_("Wording") },
     { N_("Notes"),	    0.0, csv_import_validate_string, csv_import_parse_notes, "" },
     { N_("Voucher number"), 0.0, csv_import_validate_number, csv_import_parse_voucher, "" },
     { N_("Category"),	    0.0, csv_import_validate_string, csv_import_parse_category, "" },
@@ -87,8 +87,7 @@
 	{ N_("Sub-budget"),	    0.0, csv_import_validate_string, csv_import_parse_sub_budget, "" },
     { N_("Balance"),	    0.0, csv_import_validate_amount, csv_import_parse_balance, "" },
     { N_("Credit (amount)"),0.0, csv_import_validate_amount, csv_import_parse_credit, "" },
-    { N_("Debit (absolute)"),0.0, csv_import_validate_amount, csv_import_parse_debit,
-      N_("Debit") },
+    { N_("Debit (absolute)"),0.0, csv_import_validate_amount, csv_import_parse_debit, N_("Debit") },
     { N_("Debit (negative)"),0.0, csv_import_validate_amount, csv_import_parse_credit, "" },
     { N_("C/R"),	    0.0, csv_import_validate_string, csv_import_parse_p_r, "" },
     { N_("Split"),	    0.0, csv_import_validate_string, csv_import_parse_split, "" },
@@ -96,9 +95,6 @@
 };
 
 
-
-
-
 /** Contain pre-defined CSV separators */
 struct csv_separators {
     gchar * name;		/** Visible name of CSV separator */
@@ -211,7 +207,7 @@
     GSList * list;
 
     size = csv_import_count_columns ( contents, separator );
-    g_print (">> SIZE is %d\n", size );
+    //~ g_print (">> SIZE is %d\n", size );
     if ( ! size || ! contents)
     {
 	return NULL;
@@ -282,7 +278,6 @@
 }
 
 
-
 /**
  * Callback triggered when the "skip" attribute of a line in the tree
  * preview is changed (that is, the checkbox associated is changed).
@@ -500,7 +495,7 @@
     GSList * list;
     int i;
 
-    g_print ("Skipping %d lines\n", num_lines );
+    //~ g_print ("Skipping %d lines\n", num_lines );
 
     for ( i = 0; i < num_lines; i ++ )
     {
@@ -576,9 +571,10 @@
     g_return_val_if_fail ( original, FALSE );
     g_return_val_if_fail ( substring, FALSE );
 
-    return GPOINTER_TO_INT( g_strstr_len ( g_ascii_strdown ( original, -1 ),
-				     strlen ( original ),
-				     g_ascii_strdown ( substring, -1 ) ) );
+    return GPOINTER_TO_INT( g_strstr_len (
+                        g_utf8_strdown ( original, -1 ),
+                        strlen ( original ),
+                        g_utf8_strdown ( substring, -1 ) ) );
 }
 
 
@@ -617,15 +613,32 @@
 	for ( field = 0 ; csv_fields [ field ] . name != NULL ; field ++ )
 	{
 	    if ( strlen ( value ) > 1 &&
-		 strlen ( csv_fields [ field ] . name ) > 1 &&
-		 ( safe_contains ( csv_fields [ field ] . name, value ) ||
-		   safe_contains ( _( csv_fields [ field ] . name ), value ) ||
-		   safe_contains ( csv_fields [ field ] . alias, value ) ||
-		   safe_contains ( _( csv_fields [ field ] . alias ), value ) ) )
-	    {
-		default_config [ i ] = field;
-		etat.csv_skipped_lines [ 0 ] = 1;
-	    }
+		 strlen ( csv_fields [ field ] . name ) > 1 )
+        {
+            if ( strlen ( csv_fields [ field ] . alias ) > 1 
+             &&
+             ( safe_contains ( csv_fields [ field ] . name, value ) ||
+               safe_contains ( _( csv_fields [ field ] . name ), value ) ||
+               safe_contains ( csv_fields [ field ] . alias, value ) ||
+               safe_contains ( _( csv_fields [ field ] . alias ), value ) ) )
+            {
+                if ( !default_config [ i ] )
+                {
+                    default_config [ i ] = field;
+                    etat.csv_skipped_lines [ 0 ] = 1;
+                }
+
+            }
+            else if ( safe_contains ( csv_fields [ field ] . name, value ) ||
+             safe_contains ( _( csv_fields [ field ] . name ), value ) )
+            {
+                if ( !default_config [ i ] )
+                {
+                    default_config [ i ] = field;
+                    etat.csv_skipped_lines [ 0 ] = 1;
+               }
+            }
+        }
 	}
 
 	list = list -> next;
@@ -665,25 +678,25 @@
 		{
 		    if ( g_strrstr ( string, "-" ) ) /* This is negative */
 		    {
-			if ( ! default_config [ i ] )
-			{
-			    default_config [ i ] = 12; /* Negative debit */
-			}
-			else if ( default_config [ i ] == 10 )
-			{
-			    default_config [ i ] = 9; /* Neutral amount */
-			}
+                if ( ! default_config [ i ] )
+                {
+                    default_config [ i ] = 14; /* Negative debit */
+                }
+                else if ( default_config [ i ] == 12 )
+                {
+                    default_config [ i ] = 11; /* Neutral amount */
+                }
 		    }
 		    else
 		    {
-			if ( ! default_config [ i ] )
-			{
-			    default_config [ i ] = 10; /* Negative debit */
-			}
-			else if ( default_config [ i ] == 12 )
-			{
-			    default_config [ i ] = 9; /* Neutral amount */
-			}
+                if ( ! default_config [ i ] )
+                {
+                    default_config [ i ] = 12; /* Negative debit */
+                }
+                else if ( default_config [ i ] == 14 )
+                {
+                    default_config [ i ] = 11; /* Neutral amount */
+                }
 		    }
 		}
 	    }
@@ -893,17 +906,17 @@
 
     /** After checking all required fields, check the conformity of
      * transaction amount, which is somewhat complicated. */
-    if ( ! csv_find_field_config ( 10 ) ||
-	 ( csv_find_field_config ( 11 ) && csv_find_field_config ( 12 ) ) )
+    if ( ! csv_find_field_config ( 11 ) ||
+	 ( csv_find_field_config ( 12 ) && !csv_find_field_config ( 13 ) ) )
     {
-	if ( label )
-	{
-	    label = g_strconcat ( label, ", ", _("transaction amount"), NULL );
-	}
-	else
-	{
-	    label = my_strdup ( _("transaction amount") );
-	}
+        if ( label )
+        {
+            label = g_strconcat ( label, ", ", _("transaction amount"), NULL );
+        }
+        else
+        {
+            label = my_strdup ( _("transaction amount") );
+        }
     }
 
     /** Then, fill in a GtkLabel containing diagnostic message and
@@ -1074,7 +1087,6 @@
 }
 
 
-
 /**
  * Actually do the grunt work, that is, parse the CSV file and create
  * importation structures in memory.
@@ -1112,86 +1124,101 @@
 			   NULL );
     if ( ! contents )
     {
-	g_print ("> convert failed\n");
-	return FALSE;
+        //~ g_print ("> convert failed\n");
+        return FALSE;
     }
 
     list = csv_get_next_line ( &contents, separator );
 
     do
     {
-	struct struct_ope_importation * ope;
-	int i;
+        struct struct_ope_importation * ope;
+        gint i;
 
-	/* Check if this line was specified as to be skipped
-	 * earlier. */
-	if ( index < CSV_MAX_TOP_LINES && etat.csv_skipped_lines [ index ] )
-	{
-	    g_print ("Skipping line %d\n", index );
-	    list = csv_get_next_line ( &contents, separator );
-	    index++;
-	    continue;
-	}
-	index++;
+        /* Check if this line was specified as to be skipped
+         * earlier. */
+        if ( index < CSV_MAX_TOP_LINES && etat.csv_skipped_lines [ index ] )
+        {
+            //~ g_print ("Skipping line %d\n", index );
+            list = csv_get_next_line ( &contents, separator );
+            index++;
+            continue;
+        }
+        index++;
 
-	ope = g_malloc0 ( sizeof ( struct struct_ope_importation ) );
-	ope -> date = gdate_today ();
-	ope -> date_tmp = my_strdup ( "" );
-	ope -> tiers = my_strdup ( "" );
-	ope -> notes = my_strdup ( "" );
-	ope -> categ = my_strdup ( "" );
-	ope -> guid = my_strdup ( "" );
+        ope = g_malloc0 ( sizeof ( struct struct_ope_importation ) );
+        ope -> date = gdate_today ();
+        ope -> date_tmp = my_strdup ( "" );
+        ope -> tiers = my_strdup ( "" );
+        ope -> notes = my_strdup ( "" );
+        ope -> categ = my_strdup ( "" );
+        ope -> guid = my_strdup ( "" );
 
-	for ( i = 0; csv_fields_config[i] != -1 && list ; i++)
-	{
-	    struct csv_field * field = & csv_fields [ csv_fields_config[i] ];
-	    if ( field -> parse )
-	    {
-		g_print ("> Parsing %s as %s ... ",  (gchar *) list -> data, field -> name );
-		if ( field -> validate )
-		{
-		    if ( field -> validate ( list -> data ) )
-		    {
-			if ( ! field -> parse ( ope, list -> data ) )
-			{
-			    g_print ("%s", "(failed)");
-			}
-		    }
-		    else
-		    {
-			g_print ("%s", "(invalid)");
-		    }
-		}
-		g_print ("%s", "\n");
-	    }
-	    list = list -> next;
-	}
+        for ( i = 0; csv_fields_config[i] != -1 && list ; i++)
+        {
+            struct csv_field * field = & csv_fields [ csv_fields_config[i] ];
 
-	g_print (">> Appending new transaction %p\n", ope );
-	compte -> operations_importees = g_slist_append ( compte -> operations_importees,
-							  ope );
+            if ( field -> parse )
+            {
+            if ( field -> validate )
+            {
+                if ( field -> validate ( list -> data ) )
+                {
+                    if ( csv_fields_config[i] == 16 )
+                    {
+                        if ( field -> parse ( ope, list -> data ) )
+                        {
+                            gint nbre_element = g_slist_length (
+                                compte -> operations_importees );
+                            struct struct_ope_importation *ope_tmp;
 
-	list = csv_get_next_line ( &contents, separator );
+                            ope_tmp = (struct struct_ope_importation *)
+                                g_slist_nth_data  ( compte -> operations_importees,
+                                                         nbre_element -1 );
+                            if ( ope_tmp -> operation_ventilee == 0 &&
+                             ope_tmp -> ope_de_ventilation == 0 )
+                                ope_tmp -> operation_ventilee = 1;
+                            ope -> ope_de_ventilation = 1;
+                        }
+                    }
+                    else if ( ! field -> parse ( ope, list -> data ) )
+                    {
+                        //~ g_print ("%s", "(failed)");
+                    }
+                }
+                else
+                    {
+                    //~ g_print ("%s", "(invalid)");
+                    }
+            }
+            }
+            list = list -> next;
+        }
+
+        //~ g_print (">> Appending new transaction %p\n", ope );
+        compte -> operations_importees = g_slist_append ( compte -> operations_importees,
+                                  ope );
+
+        list = csv_get_next_line ( &contents, separator );
     }
     while ( list );
 
     if ( compte -> operations_importees )
     {
-	/* Finally, we register it. */
-	liste_comptes_importes = g_slist_append ( liste_comptes_importes, compte );
+        /* Finally, we register it. */
+        liste_comptes_importes = g_slist_append ( liste_comptes_importes, compte );
     }
     else
     {
-	/* ... or not, if no transaction was imported (implement sanitizing). */
-	liste_comptes_importes_error = g_slist_append ( liste_comptes_importes_error,
-							compte );
+        /* ... or not, if no transaction was imported (implement sanitizing). */
+        liste_comptes_importes_error = g_slist_append ( liste_comptes_importes_error,
+                                compte );
     }
 
     return FALSE;
 }
 
 
-
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: utils_dates.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- utils_dates.c	13 Nov 2009 20:40:48 -0000	1.59
+++ utils_dates.c	26 Dec 2009 16:57:13 -0000	1.60
@@ -357,7 +357,9 @@
 
     num_fields = g_strv_length ( tab_date );
 
-    if ( num_fields == 1 )
+    if ( num_fields == 0 )
+        return NULL;
+    else if ( num_fields == 1 )
     {
         /* there is only 1 field in the date, try to split the number (ie 01042000 gives 01/04/2000) */
         gchar ** new_tab_date = split_unique_datefield ( tab_date [ 0 ], date_tokens );

Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- main.c	7 Nov 2009 22:04:28 -0000	1.157
+++ main.c	26 Dec 2009 16:57:13 -0000	1.158
@@ -167,20 +167,6 @@
         }
     }
 
-    /* test version of GTK */
-    if ( gtk_check_version ( VERSION_GTK_MAJOR, VERSION_GTK_MINOR, VERSION_GTK_MICRO ) )
-    {
-        string = g_strdup_printf (  _("You are running Grisbi with GTK version %s"),
-                        get_gtk_run_version ( ) );
-        dialogue_conditional_hint ( string,
-                        _("The version of GTK you are using do not benefit from its "
-                        "latest features.\n"
-                        "\n"
-                        "You should upgrade GTK."),
-                        "gtk_obsolete" );
-        g_free ( string );
-    }
-
 #ifdef HAVE_PLUGINS
     gsb_plugins_scan_dir ( PLUGINS_DIR );
 #endif
@@ -199,6 +185,20 @@
     if ( ! gsb_file_config_load_config () )
         first_use = TRUE;
 
+    /* test version of GTK */
+    if ( gtk_check_version ( VERSION_GTK_MAJOR, VERSION_GTK_MINOR, VERSION_GTK_MICRO ) )
+    {
+        string = g_strdup_printf (  _("You are running Grisbi with GTK version %s"),
+                        get_gtk_run_version ( ) );
+        dialogue_conditional_hint ( string,
+                        _("The version of GTK you are using do not benefit from its "
+                        "latest features.\n"
+                        "\n"
+                        "You should upgrade GTK."),
+                        "gtk_obsolete" );
+        g_free ( string );
+    }
+
     /* create the toplevel window */
     window = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
     g_signal_connect ( G_OBJECT (window),

Index: utils.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- utils.h	14 Oct 2009 20:09:14 -0000	1.26
+++ utils.h	26 Dec 2009 16:57:13 -0000	1.27
@@ -18,6 +18,7 @@
 GtkWidget *new_paddingbox_with_title (GtkWidget * parent, gboolean fill, gchar * title);
 GtkWidget *new_vbox_with_title_and_icon ( gchar * title,
                         gchar * image_filename);
+GtkWidget *new_vbox_with_title_and_image ( gchar * title, GtkWidget *image );
 gboolean radio_set_active_linked_widgets ( GtkWidget * widget );
 void register_button_as_linked ( GtkWidget * widget, GtkWidget * linked );
 gboolean sens_desensitive_pointeur ( GtkWidget *bouton,

Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- parametres.c	11 Oct 2009 16:24:34 -0000	1.208
+++ parametres.c	26 Dec 2009 16:57:13 -0000	1.209
@@ -65,8 +65,11 @@
 static GtkWidget * create_preferences_tree ( );
 static  GtkWidget *gsb_config_scheduler_page ( void );
 static gboolean gsb_config_scheduler_switch_balances_with_scheduled ( void );
+static gboolean gsb_gui_delete_msg_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
+                        GtkTreeModel * model );
 static gboolean gsb_gui_messages_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
                         GtkTreeModel * model );
+static GtkWidget *onglet_delete_messages ( void );
 static GtkWidget *onglet_fichier ( void );
 static GtkWidget *onglet_messages_and_warnings ( void );
 static GtkWidget *onglet_metatree ( void );
@@ -81,7 +84,6 @@
 /*END_STATIC*/
 
 
-
 GtkWidget *fenetre_preferences = NULL;
 
 static GtkTreeStore *preference_tree_model = NULL;
@@ -92,6 +94,7 @@
 
 /*START_EXTERN*/
 extern gboolean balances_with_scheduled;
+extern struct conditional_message delete_msg[];
 extern gboolean execute_scheduled_of_month;
 extern struct conditional_message messages[];
 extern gint nb_days_before_scheduled;
@@ -101,7 +104,6 @@
 /*END_EXTERN*/
 
 
-
 /**
  * Creates a simple TreeView and a TreeModel to handle preference
  * tabs.  Sets preference_tree_model to the newly created TreeModel.
@@ -405,6 +407,15 @@
     gtk_tree_store_append (GTK_TREE_STORE (preference_tree_model), &iter2, &iter);
     gtk_tree_store_set (GTK_TREE_STORE (preference_tree_model),
                         &iter2,
+                        0, _("Messages before deleting"),
+                        1, DELETE_MESSAGES_PAGE,
+                        2, 400,
+                        -1);
+    gtk_notebook_append_page (preference_frame, onglet_delete_messages(), NULL);
+
+    gtk_tree_store_append (GTK_TREE_STORE (preference_tree_model), &iter2, &iter);
+    gtk_tree_store_set (GTK_TREE_STORE (preference_tree_model),
+                        &iter2,
                         0, _("Reconciliation"),
                         1, RECONCILIATION_PAGE,
                         2, 400,
@@ -557,7 +568,6 @@
 }
 
 
-
 /**
  * Creates the "Warning & Messages" tab.
  *
@@ -644,6 +654,78 @@
 }
 
 
+/**
+ * Creates the "Delete messages" tab.
+ *
+ * \returns A newly allocated vbox
+ */
+GtkWidget *onglet_delete_messages ( void )
+{
+    GtkWidget *vbox_pref, *paddingbox, *tree_view, *sw;
+    GtkTreeModel * model;
+    GtkCellRenderer * cell;
+    GtkTreeViewColumn * column;
+    gchar *tmpstr;
+    int i;
+
+    vbox_pref = new_vbox_with_title_and_icon ( _("Messages before deleting"), "delete.png" );
+
+    /* Delete messages */
+    paddingbox = new_paddingbox_with_title ( vbox_pref, TRUE, 
+                        _("Display following messages") );
+
+    model = GTK_TREE_MODEL(gtk_tree_store_new ( 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT ) );
+
+    sw = gtk_scrolled_window_new ( NULL, NULL );
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+    tree_view = gtk_tree_view_new();
+    gtk_tree_view_set_model ( GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model) );
+    g_object_unref (G_OBJECT(model));
+    gtk_container_add (GTK_CONTAINER (sw), tree_view);
+    gtk_box_pack_start ( GTK_BOX(paddingbox), sw, TRUE, TRUE, 0 );
+
+    cell = gtk_cell_renderer_toggle_new ();
+    column = gtk_tree_view_column_new_with_attributes ("", cell, "active", 0, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), GTK_TREE_VIEW_COLUMN (column));
+    g_signal_connect (cell,
+                        "toggled",
+                        G_CALLBACK (gsb_gui_delete_msg_toggled),
+                        model);
+
+    cell = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes (_("Message"), cell, "text", 1, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), GTK_TREE_VIEW_COLUMN (column));
+
+    for  ( i = 0; delete_msg[i].name; i++ )
+    {
+        GtkTreeIter iter;
+
+        tmpstr = g_strdup ( _(delete_msg[i] . hint) );
+
+        gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
+        gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+                        0, !delete_msg[i] . hidden,
+                        1, tmpstr,
+                        2, i,
+                        -1);
+
+        g_free ( tmpstr );
+    }
+
+    /* Show everything */
+    gtk_widget_show_all ( vbox_pref );
+
+    if ( !gsb_data_account_get_accounts_amount () )
+    {
+        gtk_widget_set_sensitive ( vbox_pref, FALSE );
+    }
+
+    return ( vbox_pref );
+}
+
 
 /**
  *
@@ -669,6 +751,30 @@
 }
 
 
+/**
+ *
+ *
+ */
+gboolean gsb_gui_delete_msg_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
+                        GtkTreeModel * model )
+{
+    GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+    GtkTreeIter iter;
+    gint position;
+
+    /* Get toggled iter */
+    gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path);
+    gtk_tree_model_get (GTK_TREE_MODEL(model), &iter, 2, &position, -1);
+
+    delete_msg[position].hidden = !delete_msg[position].hidden;
+    if ( delete_msg[position].hidden == 1 )
+        delete_msg[position].default_answer = 1;
+
+    /* Set new value */
+    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, !delete_msg[position].hidden, -1);
+
+    return TRUE;
+}
 
 
 /**

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- gsb_transactions_list.c	12 Dec 2009 18:14:39 -0000	1.190
+++ gsb_transactions_list.c	26 Dec 2009 16:57:13 -0000	1.191
@@ -2,6 +2,7 @@
 /*                                                                            */
 /*     copyright (c)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2004-2009 Benjamin Drieu (bdrieu at april.org)                       */
+/*                      2008-2009 Pierre Biava (grisbi at pierre.biava.name)     */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -175,6 +176,37 @@
 /*END_EXTERN*/
 
 
+/** All delete messages */
+struct conditional_message delete_msg[] =
+{
+    { "delete-child-transaction", N_("Delete a child transaction."),
+      N_(""), 
+      FALSE, FALSE, },
+
+    { "delete-transaction",  N_("Delete a transaction."),
+      N_(""),
+      FALSE, FALSE, },
+
+    { "delete-child-scheduled", N_("Delete a child of scheduled transaction."),
+      N_(""),
+      FALSE, FALSE, },
+
+    { "delete-scheduled", N_("Delete a scheduled transaction."),
+      N_(""),
+      FALSE, FALSE, },
+
+    { "delete-scheduled-occurences", N_("Delete one or all occurences of scheduled "
+      "transaction."),
+      N_(""),
+      FALSE, FALSE, },
+
+/*
+    { "", N_(),
+      N_(), 
+      FALSE, FALSE, },
+*/
+    { NULL },
+};
 
 
 /**
@@ -1814,7 +1846,9 @@
 gboolean gsb_transactions_list_delete_transaction ( gint transaction_number,
                         gint show_warning )
 {
+    gchar *tmpstr;
     gint account_number;
+    gint msg_no = 0;
 
     devel_debug_int (transaction_number);
 
@@ -1844,43 +1878,45 @@
     /* check if the transaction is not reconciled */
     if ( gsb_transactions_list_check_mark (transaction_number))
     {
-	dialogue_error ( _("Impossible to delete a reconciled transaction.\nThe transaction, the contra-transaction or the children if it is a split are reconciled. You can remove the reconciliation with Ctrl R if it is really necessary.") );
+	dialogue_error ( _("Impossible to delete a reconciled transaction.\nThe transaction, "
+                        "the contra-transaction or the children if it is a split are "
+                        "reconciled. You can remove the reconciliation with Ctrl R if "
+                        "it is really necessary.") );
 	return FALSE;
     }
 
     /* show a warning */
     if (show_warning)
     {
-	if (gsb_data_transaction_get_mother_transaction_number (transaction_number))
-	{
-	    gchar* tmpstr = g_strdup_printf (
-	              _("Do you really want to delete the child of the transaction with party '%s' ?"),
- 	              gsb_data_payee_get_name ( gsb_data_transaction_get_party_number ( transaction_number),
-										     FALSE ));
-	    if ( !question_yes_no_hint ( _("Delete a transaction"),
-					 tmpstr,
-					 GTK_RESPONSE_NO ))
-            {
-	        g_free(tmpstr);
-		return FALSE;
-            }
-	    g_free(tmpstr);
-	}
-	else
-	{
-	    gchar *tmpstr = g_strdup_printf (
+        if (gsb_data_transaction_get_mother_transaction_number (transaction_number))
+        {
+            msg_no = question_conditional_yes_no_get_no_struct ( &delete_msg[0],
+                        "delete-child-transaction" );
+            tmpstr = g_strdup_printf (
+                        _("Do you really want to delete the child of the transaction "
+                        "with party '%s' ?"),
+                        gsb_data_payee_get_name (
+                        gsb_data_transaction_get_party_number ( transaction_number ),
+                        FALSE ) );
+            delete_msg[msg_no].message = tmpstr;
+        }
+        else
+        {
+            msg_no = question_conditional_yes_no_get_no_struct ( &delete_msg[0],
+                        "delete-transaction" );
+            tmpstr = g_strdup_printf (
                          _("Do you really want to delete transaction with party '%s' ?"),
-                         gsb_data_payee_get_name ( gsb_data_transaction_get_party_number ( transaction_number),
-										     FALSE ));
-	    if ( !question_yes_no_hint ( _("Delete a transaction"),
-					 tmpstr ,
-					 GTK_RESPONSE_NO ))
-	    {
-	        g_free(tmpstr);
-		return FALSE;
-	    }
-	    g_free(tmpstr);
-	}
+                         gsb_data_payee_get_name (
+                         gsb_data_transaction_get_party_number ( transaction_number),
+                                             FALSE ) );
+            delete_msg[msg_no].message = tmpstr;
+        }
+        if ( !question_conditional_yes_no_with_struct ( &delete_msg[msg_no] ) )
+        {
+            g_free(tmpstr);
+            return FALSE;
+        }
+        g_free(tmpstr);
     }
 
     /* move the selection */

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- gsb_form.c	15 Dec 2009 21:08:23 -0000	1.140
+++ gsb_form.c	26 Dec 2009 16:57:13 -0000	1.141
@@ -609,7 +609,6 @@
 		case TRANSACTION_FORM_TYPE:
 		case TRANSACTION_FORM_CHEQUE:
 		case TRANSACTION_FORM_BANK:
-        case TRANSACTION_FORM_EXERCICE:
 		    gtk_widget_set_sensitive ( element -> element_widget,
 					       FALSE );
 		    break;
@@ -2529,8 +2528,8 @@
     /* as we modify or create a transaction, we invalidate the current report */
     gsb_report_set_current (0);
 
-    /* give the focus to the navigation_tree_view pbiava 02/08/2009 */
-    gtk_widget_grab_focus (navigation_tree_view);
+    /* give the focus to the date widget */
+        gsb_form_widget_set_focus ( TRANSACTION_FORM_DATE );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );

Index: parametres.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- parametres.h	30 Aug 2009 17:59:48 -0000	1.32
+++ parametres.h	26 Dec 2009 16:57:13 -0000	1.33
@@ -17,6 +17,7 @@
     TOTALS_PAGE,
     TOOLBARS_PAGE,
     TRANSACTIONS_PAGE,
+    DELETE_MESSAGES_PAGE,
     RECONCILIATION_PAGE,
     RECONCILIATION_SORT_PAGE,
     TRANSACTION_FORM_PAGE,

Index: utils.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- utils.c	11 Oct 2009 16:24:34 -0000	1.57
+++ utils.c	26 Dec 2009 16:57:13 -0000	1.58
@@ -327,6 +327,62 @@
 }
 
 
+/**
+ * Function that makes a nice title with an optional icon.  It is
+ * mainly used to automate preference tabs with titles.
+ * 
+ * \param title Title that will be displayed in window
+ * \param image.  Use NULL if you don't want an image to be displayed
+ * 
+ * 
+ * \returns A pointer to a vbox widget that will contain all created
+ * widgets and user defined widgets
+ */
+GtkWidget *new_vbox_with_title_and_image ( gchar * title, GtkWidget *image )
+{
+    GtkWidget *vbox_pref, *hbox, *label, *eb;
+    GtkStyle * style;
+	gchar* tmpstr1;
+	gchar* tmpstr2;
+
+    vbox_pref = gtk_vbox_new ( FALSE, 6 );
+    gtk_widget_show ( vbox_pref );
+
+    eb = gtk_event_box_new ();
+    style = gtk_widget_get_style ( eb );
+    gtk_widget_modify_bg ( eb, 0, &(style -> bg[GTK_STATE_ACTIVE]) );
+    gtk_box_pack_start ( GTK_BOX ( vbox_pref ), eb, FALSE, FALSE, 0);
+
+
+    /* Title hbox */
+    hbox = gtk_hbox_new ( FALSE, 6 );
+    gtk_widget_show ( hbox );
+    gtk_container_add ( GTK_CONTAINER ( eb ), hbox );
+    gtk_container_set_border_width ( GTK_CONTAINER ( hbox ), 3 );
+
+    /* Icon */
+    if ( image )
+    {
+        gtk_image_set_pixel_size ( GTK_IMAGE ( image ), 128 );
+        gtk_box_pack_start ( GTK_BOX ( hbox ), image, FALSE, FALSE, 0);
+        gtk_widget_show ( image );
+    }
+
+    /* Nice huge title */
+    label = gtk_label_new ( title );
+    tmpstr1 = g_markup_escape_text (title, strlen(title));
+    tmpstr2 = g_strconcat ("<span size=\"x-large\" weight=\"bold\">",
+					tmpstr1,
+					"</span>",
+					NULL );
+    gtk_label_set_markup ( GTK_LABEL(label), tmpstr2);
+    g_free(tmpstr1);
+    g_free(tmpstr2);
+    gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 0);
+    gtk_widget_show ( label );
+
+    return vbox_pref;
+}
 
 
 /**
@@ -357,8 +413,6 @@
 /******************************************************************************/
 
 
-
-
 void register_button_as_linked ( GtkWidget * widget, GtkWidget * linked )
 {
     GSList * links;

Index: gsb_form_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- gsb_form_scheduler.c	13 Dec 2009 07:39:52 -0000	1.35
+++ gsb_form_scheduler.c	26 Dec 2009 16:57:13 -0000	1.36
@@ -58,8 +58,6 @@
 static gboolean gsb_form_scheduler_button_press_event ( GtkWidget *entry,
                         GdkEventButton *ev,
                         gint *ptr_origin );
-static gboolean gsb_form_scheduler_change_account ( GtkWidget *button,
-                        gpointer null );
 static gboolean gsb_form_scheduler_entry_lose_focus ( GtkWidget *entry,
                         GdkEventFocus *ev,
                         gint *ptr_origin );

Index: classement_echeances.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/classement_echeances.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- classement_echeances.c	22 Jul 2009 19:45:42 -0000	1.12
+++ classement_echeances.c	26 Dec 2009 16:57:13 -0000	1.13
@@ -48,8 +48,14 @@
 gint classement_sliste_echeance_par_date ( gint scheduled_number_1, 
                         gint scheduled_number_2 )
 {
-    return ( g_date_compare ( gsb_data_scheduled_get_date (scheduled_number_1),
-                        gsb_data_scheduled_get_date (scheduled_number_2) ));
+    const GDate *date;
+
+    date = gsb_data_transaction_get_date ( scheduled_number_1 );
+    if ( date )
+        return ( g_date_compare ( date,
+                        gsb_data_transaction_get_date (scheduled_number_2) ));
+    else
+        return -1;
 }
 
 

Index: utils_str.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_str.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- utils_str.c	3 Nov 2009 17:32:07 -0000	1.73
+++ utils_str.c	26 Dec 2009 16:57:13 -0000	1.74
@@ -869,15 +869,18 @@
     gchar *tmpstr;
     gunichar ch;
     gint i = 0;
+    gint long_nbre = 64;
 
-    tmpstr = g_malloc0 ( 11*sizeof (gchar) );
+    tmpstr = g_malloc0 ( long_nbre * sizeof (gchar) );
     ptr = g_strdup ( chaine );
     while ( g_utf8_strlen (ptr, -1) > 0 )
     {
         ptr = g_utf8_next_char (ptr);
-        ch = g_utf8_get_char (ptr);
-        if ( g_ascii_isdigit ( ch ) )
+        ch = g_utf8_get_char_validated (ptr, -1);
+        if ( ch != (gunichar )-2 && g_ascii_isdigit ( ch ) )
         {
+            if ( i == long_nbre )
+                break;
             tmpstr[i] = ptr[0];
             i++;
         }

Index: gsb_file_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_config.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- gsb_file_config.c	17 Nov 2009 12:17:41 -0000	1.88
+++ gsb_file_config.c	26 Dec 2009 16:57:13 -0000	1.89
@@ -2,6 +2,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2005-2008 Benjamin Drieu (bdrieu at april.org)                       */
+/*                      2008-2009 Pierre Biava (grisbi at pierre.biava.name)     */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -60,6 +61,7 @@
 
 /*START_EXTERN*/
 extern gboolean balances_with_scheduled;
+extern struct conditional_message delete_msg[];
 extern gboolean execute_scheduled_of_month;
 extern GtkWidget *main_hpaned;
 extern gint max;
@@ -93,6 +95,7 @@
     GKeyFile *config;
     gboolean result;
     gchar *filename;
+    gchar *name;
     gint i;
     gint int_ret;
     GError* err = NULL;
@@ -357,7 +360,6 @@
         etat.automatic_completion_payee = int_ret;
     else
         err = NULL;
-        
 
     etat.limit_completion_to_current_account = g_key_file_get_integer ( config,
                         "Display",
@@ -392,7 +394,7 @@
     /* get messages */
     for ( i = 0; messages[i].name; i ++ )
     {
-        gchar * name = g_strconcat ( messages[i].name , "-answer", NULL );
+        name = g_strconcat ( messages[i].name , "-answer", NULL );
         messages[i].hidden = g_key_file_get_integer ( config, "Messages",
                         messages[i].name, NULL );
         messages[i].default_answer = g_key_file_get_integer ( config, "Messages",
@@ -400,6 +402,16 @@
         g_free ( name );
     }
 
+    for ( i = 0; delete_msg[i].name; i ++ )
+    {
+        name = g_strconcat ( delete_msg[i].name , "-answer", NULL );
+        delete_msg[i].hidden = g_key_file_get_integer ( config, "Messages",
+                        delete_msg[i].name, NULL );
+        if ( delete_msg[i].hidden == 1 )
+            delete_msg[i].default_answer = 1;
+        g_free ( name );
+    }
+
     etat.last_tip = g_key_file_get_integer ( config,
                         "Messages",
                         "Last tip",
@@ -474,6 +486,7 @@
     GKeyFile *config;
     gchar *filename;
     gchar *file_content;
+    gchar *name;
     gsize length;
     FILE *conf_file;
     gint i;
@@ -726,16 +739,22 @@
                         etat.display_grisbi_title );
 
     /* save messages */
-
     for ( i = 0; messages[i].name; i ++ )
     {
-        gchar * name = g_strconcat ( messages[i].name , "-answer", NULL );
+        name = g_strconcat ( messages[i].name , "-answer", NULL );
 
         g_key_file_set_integer ( config, "Messages", messages[i].name, messages[i].hidden );
         g_key_file_set_integer ( config, "Messages", name, messages[i].default_answer );
         g_free ( name );
     }
 
+    for ( i = 0; delete_msg[i].name; i ++ )
+    {
+        g_key_file_set_integer ( config, "Messages", delete_msg[i].name,
+                        delete_msg[i].hidden );
+    }
+
+
     g_key_file_set_integer ( config,
                         "Messages",
                         "Last tip",



More information about the cvs mailing list