[grisbi-cvs] grisbi/src accueil.c, 1.211, 1.212 gsb_currency_config.c, 1.57, 1.58 gsb_currency_config.h, 1.16, 1.17 gsb_data_partial_balance.c, 1.6, 1.7 import.c, 1.292, 1.293 utils_str.c, 1.68, 1.69

Pierre Biava pbiava at users.sourceforge.net
Sun Sep 27 17:30:51 CEST 2009


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

Modified Files:
	accueil.c gsb_currency_config.c gsb_currency_config.h 
	gsb_data_partial_balance.c import.c utils_str.c 
Log Message:
fixed a bug in the management of partial multi-currency balances

Index: gsb_data_partial_balance.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_partial_balance.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- gsb_data_partial_balance.c	8 Sep 2009 12:47:16 -0000	1.6
+++ gsb_data_partial_balance.c	27 Sep 2009 15:30:49 -0000	1.7
@@ -30,8 +30,11 @@
 /*START_INCLUDE*/
 #include "gsb_data_partial_balance.h"
 #include "./dialog.h"
+#include "./gsb_currency_config.h"
+#include "./gsb_currency.h"
 #include "./gsb_data_account.h"
 #include "./gsb_data_currency.h"
+#include "./gsb_data_currency_link.h"
 #include "./navigation.h"
 #include "./gsb_real.h"
 #include "./utils_str.h"
@@ -60,12 +63,14 @@
 /*START_STATIC*/
 static  void _gsb_data_partial_balance_free ( struct_partial_balance *partial_balance);
 static gpointer gsb_data_partial_balance_get_structure ( gint partial_balance_number );
-static gboolean gsb_data_partial_balance_init_from_liste_cptes ( gint partial_balance_number );
+static gboolean gsb_data_partial_balance_init_from_liste_cptes ( gint partial_balance_number,
+                        GtkWidget *parent );
 static gboolean gsb_data_partial_balance_move ( gint orig_partial_number, gint dest_pos );
-static GtkWidget *gsb_partial_balance_create_dialog ( gint spin_value);
+static GtkWidget *gsb_partial_balance_create_dialog ( gint action, gint spin_value );
 static GtkWidget *gsb_partial_balance_create_list_accounts ( GtkWidget *entry );
 static gint gsb_partial_balance_new ( const gchar *name );
 static void gsb_partial_balance_renumerote ( void );
+static gint gsb_partial_balance_request_currency ( GtkWidget *parent );
 static gboolean gsb_partial_balance_select_account ( GtkTreeSelection *selection,
                         GtkTreeModel *model,
                         GtkTreePath *path,
@@ -81,13 +86,16 @@
 extern GtkWidget *window;
 /*END_EXTERN*/
 
+/* devise de base des soldes partiels de comptes ayant des devises différentes */
+gint no_devise_solde_partiels;
+
 /** contains the g_slist of struct_partial_balance */
-GSList *partial_balance_list = NULL;
+static GSList *partial_balance_list = NULL;
 
 /** a pointer to the last partial_balance used (to increase the speed) */
 static struct_partial_balance *partial_balance_buffer;
 
-GtkListStore *model_accueil;
+static GtkListStore *model_accueil;
 
 /*********************************************************************************************/
 /*              Fonctions générales                                                          */
@@ -245,11 +253,12 @@
     GtkWidget *entry_list;
     GtkWidget *spin_bouton;
     GtkWidget *colorise_bouton;
+    gint action = 1; /* 1 create 2 modify */
     gint result;
 
     devel_debug ( NULL);
 
-    dialog = gsb_partial_balance_create_dialog (
+    dialog = gsb_partial_balance_create_dialog ( action,
                         g_slist_length ( partial_balance_list ) + 1 );
 
     entry_name = g_object_get_data ( G_OBJECT ( dialog ), "entry_name" );
@@ -260,7 +269,7 @@
     gtk_widget_show_all ( GTK_WIDGET ( dialog ) );
 
 dialog_return:
-    result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
+    result = gtk_dialog_run ( GTK_DIALOG ( dialog ) );
 
     if ( result == 1)
     {
@@ -286,7 +295,8 @@
 
             gsb_data_partial_balance_set_liste_cptes ( partial_balance_number,
                         liste_cptes );
-            gsb_data_partial_balance_init_from_liste_cptes ( partial_balance_number );
+            gsb_data_partial_balance_init_from_liste_cptes ( partial_balance_number,
+                        dialog );
             gsb_data_partial_balance_set_colorise ( partial_balance_number,
                         gtk_toggle_button_get_active (
                         GTK_TOGGLE_BUTTON ( colorise_bouton ) ) );
@@ -313,7 +323,7 @@
             goto dialog_return;
         }
     }
-    gtk_widget_destroy ( GTK_WIDGET ( dialog ));
+    gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
 }
 
 
@@ -337,11 +347,12 @@
     gchar *balance_name;
     gchar *liste_cptes;
     gint partial_balance_number;
+    gint action = 2; /* 1 create 2 modify */
     gint result;
 
     devel_debug ( NULL);
 
-    dialog = gsb_partial_balance_create_dialog (
+    dialog = gsb_partial_balance_create_dialog ( action,
                         g_slist_length ( partial_balance_list ) + 1 );
 
     entry_name = g_object_get_data ( G_OBJECT ( dialog ), "entry_name" );
@@ -391,7 +402,8 @@
         {
             gsb_data_partial_balance_set_name ( partial_balance_number, name );
             gsb_data_partial_balance_set_liste_cptes ( partial_balance_number, liste_cptes );
-            gsb_data_partial_balance_init_from_liste_cptes ( partial_balance_number );
+            gsb_data_partial_balance_init_from_liste_cptes ( partial_balance_number,
+                        dialog );
             gsb_data_partial_balance_set_colorise ( partial_balance_number,
                         gtk_toggle_button_get_active (
                         GTK_TOGGLE_BUTTON ( colorise_bouton ) ) );
@@ -456,7 +468,7 @@
 
             if ( partial_balance -> partial_balance_number == partial_balance_number )
             {
-                GtkWidget *del_button;
+                GtkWidget *edit_button;
 
                 partial_balance_list = g_slist_remove (
                         partial_balance_list, partial_balance );
@@ -466,7 +478,8 @@
                 /* MAJ HOME_PAGE */
                 gsb_gui_navigation_update_home_page ( );
 
-                del_button = g_object_get_data ( G_OBJECT (main_widget), "remove_button" );
+                edit_button = g_object_get_data ( G_OBJECT (main_widget), "edit_button" );
+                gtk_widget_set_sensitive ( edit_button, FALSE );
                 gtk_widget_set_sensitive ( button, FALSE );
                 break;
             }
@@ -510,6 +523,8 @@
 {
     GtkWidget *button;
 
+    button = g_object_get_data ( G_OBJECT (main_widget), "edit_button" );
+    gtk_widget_set_sensitive ( button, TRUE );
     button = g_object_get_data ( G_OBJECT (main_widget), "remove_button" );
     gtk_widget_set_sensitive ( button, TRUE );
 
@@ -608,10 +623,14 @@
         return TRUE;
     }
 
-	return FALSE;
+    return FALSE;
 }
 
 
+/**
+ * 
+ *
+**/
 void gsb_partial_balance_colorise_toggled ( GtkCellRendererToggle *cell,
                         gchar *path_str,
                         GtkWidget *tree_view )
@@ -628,8 +647,7 @@
 
     /* invert the toggle */
     treepath = gtk_tree_path_new_from_string ( path_str );
-    gtk_tree_model_get_iter ( GTK_TREE_MODEL (model),
-			      &iter, treepath );
+    gtk_tree_model_get_iter ( GTK_TREE_MODEL (model), &iter, treepath );
 
     gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter, 
                         4, &partial_number,
@@ -644,6 +662,8 @@
     /* MAJ HOME_PAGE */
     gsb_gui_navigation_update_home_page ( );
 }
+
+
 /*********************************************************************************************/
 /*              Données                                                                      */
 /*********************************************************************************************/
@@ -720,6 +740,7 @@
 /**
  * give the g_slist of partial_balance structure
  * usefull when want to check all partial_balance
+ * carrefull : it's not a copy, so we must not free or change it
  *
  * \param none
  *
@@ -982,8 +1003,6 @@
 
 
 /** 
- * 
- *
  * \param partial_balance_number no of the partial_balance
  * \param colorise
  *
@@ -1005,6 +1024,10 @@
 }
 
 
+/**
+ * 
+ *
+ * */
 gchar *gsb_data_partial_balance_get_marked_balance ( gint partial_balance_number )
 {
     struct_partial_balance *partial_balance;
@@ -1024,14 +1047,40 @@
     tab = g_strsplit ( partial_balance -> liste_cptes, ";", 0 );
     for ( i = 0; tab[i]; i++ )
     {
-        solde = gsb_real_add ( solde,
-                        gsb_data_account_get_marked_balance (
-                        utils_str_atoi ( tab[i] ) ) );
+        gsb_real tmp_real;
+        gint account_nb;
+        gint account_currency;
+        gint link_number;
+
+        account_nb = utils_str_atoi ( tab[i] );
+        account_currency = gsb_data_account_get_currency ( account_nb );
+        tmp_real = gsb_data_account_get_marked_balance ( account_nb );
+        if ( partial_balance -> currency == account_currency )
+            solde = gsb_real_add ( solde, tmp_real );
+        else
+        {
+            if ( ( link_number = gsb_data_currency_link_search ( account_currency,
+                        partial_balance -> currency ) ) )
+            {
+                if ( gsb_data_currency_link_get_first_currency (
+                        link_number) == account_currency )
+                    tmp_real = gsb_real_mul ( tmp_real,
+                                gsb_data_currency_link_get_change_rate ( link_number ) );
+                else
+                    tmp_real = gsb_real_div ( tmp_real,
+                                gsb_data_currency_link_get_change_rate ( link_number ) );
+            }
+            solde = gsb_real_add ( solde, tmp_real );
+        }
     }
     return gsb_real_get_string_with_currency (solde, partial_balance -> currency, TRUE);
 }
 
 
+/**
+ * 
+ *
+ * */
 gchar *gsb_data_partial_balance_get_current_balance ( gint partial_balance_number )
 {
     struct_partial_balance *partial_balance;
@@ -1052,9 +1101,31 @@
     tab = g_strsplit ( partial_balance -> liste_cptes, ";", 0 );
     for ( i = 0; tab[i]; i++ )
     {
-        solde = gsb_real_add ( solde,
-                        gsb_data_account_get_current_balance (
-                        utils_str_atoi ( tab[i] ) ) );
+        gsb_real tmp_real;
+        gint account_nb;
+        gint account_currency;
+        gint link_number;
+
+        account_nb = utils_str_atoi ( tab[i] );
+        account_currency = gsb_data_account_get_currency ( account_nb );
+        tmp_real = gsb_data_account_get_current_balance ( account_nb );
+        if ( partial_balance -> currency == account_currency )
+            solde = gsb_real_add ( solde, tmp_real );
+        else
+        {
+            if ( ( link_number = gsb_data_currency_link_search ( account_currency,
+                        partial_balance -> currency ) ) )
+            {
+                if ( gsb_data_currency_link_get_first_currency (
+                        link_number) == account_currency )
+                    tmp_real = gsb_real_mul ( tmp_real,
+                                gsb_data_currency_link_get_change_rate ( link_number ) );
+                else
+                    tmp_real = gsb_real_div ( tmp_real,
+                                gsb_data_currency_link_get_change_rate ( link_number ) );
+            }
+            solde = gsb_real_add ( solde, tmp_real );
+        }
     }
 
     if ( partial_balance -> colorise && solde.mantissa < 0 )
@@ -1146,7 +1217,8 @@
  *
  * \return FALSE si tous les comptes n'ont pas les mêmes données sinon TRUE
  * */
-gboolean gsb_data_partial_balance_init_from_liste_cptes ( gint partial_balance_number )
+gboolean gsb_data_partial_balance_init_from_liste_cptes ( gint partial_balance_number,
+                        GtkWidget *parent )
 {
     struct_partial_balance *partial_balance;
     gchar **tab;
@@ -1155,7 +1227,9 @@
     gint currency_nb = 0;
     kind_account kind = -1;
     kind_account kind_nb = -1;
+    gchar *tmp_str;
     gboolean return_val = TRUE;
+    gboolean currency_mixte = FALSE;
 
     partial_balance = gsb_data_partial_balance_get_structure ( partial_balance_number );
 
@@ -1169,12 +1243,30 @@
     tab = g_strsplit ( partial_balance -> liste_cptes, ";", 0 );
     for ( i = 0; tab[i]; i++ )
     {
+        gint account_currency;
+
         account_nb = utils_str_atoi ( tab[i] );
+        account_currency = gsb_data_account_get_currency ( account_nb );
         if ( currency_nb == 0 )
-            currency_nb = gsb_data_account_get_currency ( account_nb );
-        else if ( currency_nb != gsb_data_account_get_currency ( account_nb ) )
+            currency_nb = account_currency;
+        else if ( currency_nb != account_currency )
+        {
+            if ( currency_mixte == FALSE )
+            {
+                no_devise_solde_partiels = gsb_partial_balance_request_currency ( parent );
+                if ( gsb_data_currency_link_search ( currency_nb, account_currency ) == 0 )
+                {
+                    tmp_str = g_strdup_printf (
+                            _("You need to create a link between currency %s and %s."),
+                            gsb_data_currency_get_name ( currency_nb ),
+                            gsb_data_currency_get_name ( account_currency ) );
+                    dialogue_warning_hint ( tmp_str,
+                            _("Attention missing link between currencies") );
+                }
+            }
+            currency_mixte = TRUE;
             return_val = FALSE;
-
+        }
         if ( kind == -1 )
             kind = gsb_data_account_get_kind ( account_nb );
         else if ( ( kind_nb = gsb_data_account_get_kind ( account_nb ) ) != kind )
@@ -1197,7 +1289,11 @@
             }
         }
     }
-    gsb_data_partial_balance_set_currency ( partial_balance_number, currency_nb );
+    if ( currency_mixte )
+        gsb_data_partial_balance_set_currency ( partial_balance_number,
+                        no_devise_solde_partiels );
+    else
+        gsb_data_partial_balance_set_currency ( partial_balance_number, currency_nb );
     if ( return_val == FALSE )
         gsb_data_partial_balance_set_kind ( partial_balance_number, -1 );
     else
@@ -1325,7 +1421,7 @@
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                         GTK_POLICY_NEVER,
                         GTK_POLICY_ALWAYS);
-	gtk_widget_set_size_request( sw, 600, 200 );
+    gtk_widget_set_size_request( sw, 600, 200 );
 
     /* create the model */
     list_store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT );
@@ -1369,10 +1465,10 @@
      /* account name */
     cell = gtk_cell_renderer_text_new ( );
     column = gtk_tree_view_column_new_with_attributes ( _("Account name"),
-						     cell,
-						     "text",
-						     0,
-						     NULL );
+                        cell,
+                        "text",
+                        0,
+                        NULL );
     gtk_tree_view_column_set_expand ( column, TRUE );
     gtk_tree_view_column_set_sort_column_id ( column, 0 );
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( treeview ), column );
@@ -1385,19 +1481,27 @@
  * 
  *
  * */
-GtkWidget *gsb_partial_balance_create_dialog ( gint spin_value)
+GtkWidget *gsb_partial_balance_create_dialog ( gint action, gint spin_value )
 {
     GtkWidget *dialog, *label, *table, *paddingbox, * main_vbox, * vbox;
     GtkWidget *entry_name, *entry_list, *account_list, *bouton;
 
     devel_debug ( NULL);
 
-    dialog = gtk_dialog_new_with_buttons ( _("Partial balance"),
-                        GTK_WINDOW ( window ),
-                        GTK_DIALOG_MODAL,
-                        GTK_STOCK_CANCEL, 0,
-                        GTK_STOCK_OK, 1,
-                        NULL );
+    if ( action == 1 )
+        dialog = gtk_dialog_new_with_buttons ( _("Add a partial balance"),
+                            GTK_WINDOW ( window ),
+                            GTK_DIALOG_MODAL,
+                            GTK_STOCK_CANCEL, 0,
+                            GTK_STOCK_OK, 1,
+                            NULL );
+    else
+        dialog = gtk_dialog_new_with_buttons ( _("Modify a partial balance"),
+                            GTK_WINDOW ( window ),
+                            GTK_DIALOG_MODAL,
+                            GTK_STOCK_CANCEL, 0,
+                            GTK_STOCK_OK, 1,
+                            NULL );
     gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
 
     main_vbox = new_vbox_with_title_and_icon ( _("Partial balance details"), "payment.png" );
@@ -1420,44 +1524,44 @@
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1 );
     gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_RIGHT );
     gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1,
-		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+                        GTK_SHRINK | GTK_FILL, 0, 0, 0 );
     entry_name = gtk_entry_new ( );
     gtk_entry_set_activates_default ( GTK_ENTRY ( entry_name ), TRUE );
     gtk_table_attach ( GTK_TABLE ( table ), entry_name, 1, 2, 0, 1,
-		       GTK_EXPAND|GTK_FILL, 0, 0, 0 );
+                        GTK_EXPAND|GTK_FILL, 0, 0, 0 );
 
     /* List of the accounts */
     label = gtk_label_new ( COLON ( _("Accounts list") ) );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1);
     gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
     gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2,
-		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+                        GTK_SHRINK | GTK_FILL, 0, 0, 0 );
     entry_list = gtk_entry_new ( );
     gtk_editable_set_editable ( GTK_EDITABLE ( entry_list ), FALSE );
     gtk_widget_set_sensitive ( entry_list, FALSE );
     gtk_table_attach ( GTK_TABLE ( table ), entry_list, 1, 2, 1, 2,
-		       GTK_EXPAND|GTK_FILL, 0, 0, 0 );
+                        GTK_EXPAND|GTK_FILL, 0, 0, 0 );
     account_list = gsb_partial_balance_create_list_accounts ( entry_list );
     gtk_table_attach ( GTK_TABLE ( table ), account_list, 0, 2, 2, 4,
-		       GTK_EXPAND | GTK_FILL, 0, 0, 0 );
+                        GTK_EXPAND | GTK_FILL, 0, 0, 0 );
 
     /* create the position */
     label = gtk_label_new ( COLON ( _("Position in the list of accounts") ) );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1);
     gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
     gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 4, 5,
-		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+                        GTK_SHRINK | GTK_FILL, 0, 0, 0 );
     bouton = gtk_spin_button_new_with_range ( 1.0, spin_value, 1.0);
     gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( bouton ),
                         g_slist_length ( partial_balance_list ) + 1 );
     gtk_table_attach ( GTK_TABLE ( table ), bouton, 1, 2, 4, 5,
-		       GTK_EXPAND | GTK_FILL, 0, 0, 0 );
+                        GTK_EXPAND | GTK_FILL, 0, 0, 0 );
     g_object_set_data ( G_OBJECT ( dialog ), "spin_bouton", bouton );
 
     /* create the colorized button */
     bouton = gtk_check_button_new_with_label ( _("Colorized in red if the balance is negative") );
     gtk_table_attach ( GTK_TABLE ( table ), bouton, 0, 2, 5, 6,
-		       GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+                        GTK_SHRINK | GTK_FILL, 0, 0, 0 );
     g_object_set_data ( G_OBJECT ( dialog ), "colorise_bouton", bouton );
     
     g_object_set_data ( G_OBJECT ( dialog ), "entry_name", entry_name );
@@ -1466,6 +1570,48 @@
 
     return dialog;
 }
+
+
+/**
+ * 
+ *
+ * */
+gint gsb_partial_balance_request_currency ( GtkWidget *parent )
+{
+    GtkWidget *dialog, *hbox, *label, *combo_devise;
+    gint currency_nb;
+    gint result;
+
+    dialog = gtk_dialog_new_with_buttons ( _("Enter the currency of the balance part"),
+                            GTK_WINDOW ( parent ),
+                            GTK_DIALOG_MODAL,
+                            GTK_STOCK_CANCEL, 0,
+                            GTK_STOCK_OK, 1,
+                            NULL );
+    gtk_widget_set_size_request ( dialog, -1, 150 );
+    gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
+
+    hbox = gtk_hbox_new ( FALSE, 5 );
+    gtk_box_pack_start ( GTK_BOX ( GTK_DIALOG ( dialog ) -> vbox ), hbox, TRUE, FALSE, 0 );
+
+    label = gtk_label_new ( COLON ( _("Select the currency of the partial balance") ) );
+    gtk_misc_set_alignment ( GTK_MISC  ( label ), 0, 1 );
+    gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), label, TRUE, TRUE, 0 );
+
+    combo_devise = gsb_currency_config_new_combobox ( &currency_nb, NULL );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), combo_devise, FALSE, FALSE, 10 );
+
+    gtk_widget_show_all ( GTK_WIDGET ( dialog ) );
+
+    gsb_currency_set_combobox_history ( combo_devise, 2 );
+    gsb_currency_set_combobox_history ( combo_devise, 1 );
+    result = gtk_dialog_run ( GTK_DIALOG ( dialog ) );
+
+    gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
+
+    return currency_nb;
+}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- accueil.c	29 Aug 2009 08:36:40 -0000	1.211
+++ accueil.c	27 Sep 2009 15:30:49 -0000	1.212
@@ -96,7 +96,6 @@
 extern GdkColor couleur_solde_alarme_verte_prelight;
 extern GtkWidget *form_transaction_part;
 extern gsb_real null_real;
-extern GSList *partial_balance_list;
 extern GSList *scheduled_transactions_taken;
 extern GSList *scheduled_transactions_to_take;
 extern gchar *titre_fichier;
@@ -969,36 +968,8 @@
     GtkWidget *label;
     gchar *tmpstr;
     gint nbre_lignes = 0;
+    gboolean concerne = FALSE;
 
-    /* on commence par une ligne vide */
-    label = gtk_label_new ( chaine_espace );
-    gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group_accueil ), label );
-    gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
-	gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
-	gtk_widget_show ( label );
-    i ++;
-    nbre_lignes ++;
-
-    /* On met les titres du sous ensemble solde(s) partiel(s) */
-    if ( nb_comptes == 1 )
-        label = gtk_label_new ( COLON(_("Partial balance")));
-    else
-        label = gtk_label_new ( COLON(_("Partial balances")));
-	gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_LEFT, MISC_VERT_CENTER );
-    gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group_accueil ), label );
-	gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
-	gtk_widget_show ( label );
-    	label = gtk_label_new (_("Reconciled balance"));
-	gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
-	gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 1, 2, i, i+1 );
-	gtk_widget_show ( label );
-	label = gtk_label_new (_("Current balance"));
-	gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
-	gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 2, 4, i, i+1 );
-	gtk_widget_show ( label );
-    i ++;
-    nbre_lignes ++;
-    
     while ( liste )
     {
         gint partial_number;
@@ -1012,7 +983,38 @@
          &&
          gsb_data_partial_balance_get_currency ( partial_number ) == currency_number )
         {
+            if ( concerne == FALSE )
+            {
+                    /* on commence par une ligne vide */
+                label = gtk_label_new ( chaine_espace );
+                gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group_accueil ), label );
+                gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
+                gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
+                gtk_widget_show ( label );
+                i ++;
+                nbre_lignes ++;
 
+                /* On met les titres du sous ensemble solde(s) partiel(s) */
+                if ( nb_comptes == 1 )
+                    label = gtk_label_new ( COLON(_("Partial balance")));
+                else
+                    label = gtk_label_new ( COLON(_("Partial balances")));
+                gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_LEFT, MISC_VERT_CENTER );
+                gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group_accueil ), label );
+                gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
+                gtk_widget_show ( label );
+                    label = gtk_label_new (_("Reconciled balance"));
+                gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
+                gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 1, 2, i, i+1 );
+                gtk_widget_show ( label );
+                label = gtk_label_new (_("Current balance"));
+                gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
+                gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 2, 4, i, i+1 );
+                gtk_widget_show ( label );
+                i ++;
+                nbre_lignes ++;
+                concerne = TRUE;
+            }
             /* Première colonne : elle contient le nom du solde partiel */
             tmpstr = g_strconcat ( gsb_data_partial_balance_get_name ( partial_number ),
                             " : ", NULL );
@@ -1115,8 +1117,8 @@
     label = gtk_label_new ( chaine_espace );
     gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group_accueil ), label );
     gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
-	gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
-	gtk_widget_show ( label );
+    gtk_table_attach_defaults ( GTK_TABLE ( table ), label, 0, 1, i, i+1 );
+    gtk_widget_show ( label );
     i ++;
     nbre_lignes ++;
 
@@ -1914,7 +1916,7 @@
 GtkWidget *onglet_accueil (void)
 {
     GtkWidget *vbox_pref, *vbox, *paddingbox, *button;
-    GtkWidget *hbox, *vbox2, *sw, *treeview ;
+    GtkWidget *hbox, *vbox2, *sw, *treeview;
     GtkListStore *list_store;
     GtkTreeViewColumn *column;
     GtkCellRenderer *cell;
@@ -1922,10 +1924,9 @@
     GtkTreeDragDestIface * dst_iface;
     GtkTreeDragSourceIface * src_iface;
     static GtkTargetEntry row_targets[] = {
-	{ "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
+    { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
     };
 
-
     vbox_pref = new_vbox_with_title_and_icon ( _("Configuration of the main page"),
                         "title.png" );
 
@@ -1933,12 +1934,12 @@
     gtk_box_pack_start ( GTK_BOX ( vbox_pref ), vbox, TRUE, TRUE, 0 );
     gtk_container_set_border_width ( GTK_CONTAINER ( vbox ), 12 );
 
-    /* Data import settings */
+    /* Data partial balance settings */
     paddingbox = new_paddingbox_with_title (vbox, FALSE, 
                         _("Balances partials of the list of accounts") );
 
     hbox = gtk_hbox_new ( FALSE, 5 );
-    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, TRUE, TRUE, 0);
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, TRUE, TRUE, 5);
 
     sw = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
@@ -1968,6 +1969,7 @@
                         G_CALLBACK  ( gsb_partial_balance_edit ),
                         vbox_pref );
     gtk_box_pack_start ( GTK_BOX ( vbox2 ), button, FALSE, FALSE, 5 );
+    gtk_widget_set_sensitive ( button, FALSE );
     g_object_set_data ( G_OBJECT (vbox_pref), "edit_button", button );
 
     /* Button "Remove" */
@@ -1984,7 +1986,7 @@
     list_store = gsb_partial_balance_create_model ( );
 
     /* remplit le modèle si nécessaire */
-    if ( g_slist_length ( partial_balance_list ) > 0 )
+    if ( g_slist_length ( gsb_data_partial_balance_get_list ( ) ) > 0 )
         gsb_partial_balance_fill_model ( list_store );
 
     /* create the treeview */
@@ -1997,22 +1999,22 @@
 
     /* check the keys on the list */
     g_signal_connect ( G_OBJECT ( treeview ),
-		       "key_press_event",
-		       G_CALLBACK ( gsb_partial_balance_key_press ),
-		       NULL );
+                        "key_press_event",
+                        G_CALLBACK ( gsb_partial_balance_key_press ),
+                        NULL );
 
     /* check the buttons on the list */
     g_signal_connect ( G_OBJECT ( treeview ),
-		       "button_press_event",
-		       G_CALLBACK ( gsb_partial_balance_button_press ),
-		       NULL );
+                        "button_press_event",
+                        G_CALLBACK ( gsb_partial_balance_button_press ),
+                        NULL );
 
     /* Enable drag & drop */
     gtk_tree_view_enable_model_drag_source ( GTK_TREE_VIEW (treeview),
-					     GDK_BUTTON1_MASK, row_targets, 1,
-					     GDK_ACTION_MOVE );
+                        GDK_BUTTON1_MASK, row_targets, 1,
+                        GDK_ACTION_MOVE );
     gtk_tree_view_enable_model_drag_dest ( GTK_TREE_VIEW (treeview), row_targets,
-					   1, GDK_ACTION_MOVE );
+                        1, GDK_ACTION_MOVE );
     gtk_tree_view_set_reorderable ( GTK_TREE_VIEW (treeview), TRUE );
 
     selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (treeview) );
@@ -2051,9 +2053,9 @@
     g_object_set (cell, "xalign", 0.5, NULL);
 
     column = gtk_tree_view_column_new_with_attributes ( _("Colorize"),
-						     cell,
-						     "active", 5,
-						     NULL);
+                        cell,
+                        "active", 5,
+                        NULL);
     gtk_tree_view_append_column ( GTK_TREE_VIEW(treeview), column);
 
     /* Type de compte */

Index: gsb_currency_config.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_config.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- gsb_currency_config.h	30 Aug 2009 17:59:47 -0000	1.16
+++ gsb_currency_config.h	27 Sep 2009 15:30:49 -0000	1.17
@@ -64,6 +64,7 @@
 gint gsb_currency_config_create_currency_from_iso4217list ( gchar *currency_name );
 GtkWidget *gsb_currency_config_create_page ( void );
 GtkWidget *gsb_currency_config_create_totals_page ( void );
+GtkWidget * gsb_currency_config_new_combobox ( gint * value, GCallback hook );
 gboolean gsb_currency_config_select_default ( GtkTreeModel * tree_model, GtkTreePath * path,
                         GtkTreeIter * iter, GtkTreeView * tree_view );
 /* END_DECLARATION */

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -d -r1.292 -r1.293
--- import.c	16 Sep 2009 18:30:42 -0000	1.292
+++ import.c	27 Sep 2009 15:30:49 -0000	1.293
@@ -2313,42 +2313,41 @@
     gint fyear = 0;
     gint last_transaction_number;
     gint div_number;
-	gchar* tmpstr;
+    gchar* tmpstr;
 
     /* we create the new transaction */
     transaction_number = gsb_data_transaction_new_transaction ( account_number );
 
     /* get the id if exists */
     if ( imported_transaction -> id_operation )
-	gsb_data_transaction_set_transaction_id ( transaction_number,
-						  imported_transaction -> id_operation );
+    gsb_data_transaction_set_transaction_id ( transaction_number,
+                        imported_transaction -> id_operation );
 
     /* get the date */
     gsb_data_transaction_set_date ( transaction_number,
-				    imported_transaction -> date );
+                        imported_transaction -> date );
 
     /* récupération de la date de valeur */
     gsb_data_transaction_set_value_date ( transaction_number,
-					  imported_transaction -> date_de_valeur );
+                        imported_transaction -> date_de_valeur );
 
     /* set the financial year according to the date or value date */
     if (etat.get_fyear_by_value_date && imported_transaction -> date_de_valeur)
-	fyear = gsb_data_fyear_get_from_date (imported_transaction -> date_de_valeur );
+    fyear = gsb_data_fyear_get_from_date (imported_transaction -> date_de_valeur );
 
     /* if no fyear found, get from the date */
     if (fyear <= 0)
-	fyear = gsb_data_fyear_get_from_date (imported_transaction -> date );
+    fyear = gsb_data_fyear_get_from_date (imported_transaction -> date );
     if (fyear > 0)
-	gsb_data_transaction_set_financial_year_number ( transaction_number,
-							 fyear );
+    gsb_data_transaction_set_financial_year_number ( transaction_number, fyear );
 
     /* récupération du montant */
     gsb_data_transaction_set_amount ( transaction_number,
-				      imported_transaction -> montant );
+                        imported_transaction -> montant );
 
     /* récupération de la devise */
     gsb_data_transaction_set_currency_number ( transaction_number,
-					       imported_transaction -> devise );
+                        imported_transaction -> devise );
 
     /* récupération du tiers */
     /* pbiava on 03/22/2009 utilisation des remplacements de tiers.
@@ -2372,61 +2371,69 @@
                 gsb_data_transaction_set_notes ( transaction_number,
                         imported_transaction -> tiers );
         }
+        if ( etat.get_extract_number_for_check )
+        {
+            tmpstr = gsb_string_extract_int ( imported_transaction -> tiers );
+            if ( tmpstr && strlen ( tmpstr ) > 0 )
+            {
+                gsb_data_transaction_set_method_of_payment_content (
+                        transaction_number, tmpstr );
+                g_free ( tmpstr );
+            }
+        }
         gsb_data_transaction_set_party_number ( transaction_number, payee_number );
     }
 
     /* vérification si c'est ventilé, sinon récupération des catégories */
     if ( imported_transaction -> operation_ventilee )
     {
-	/* l'opération est ventilée */
-	gsb_data_transaction_set_split_of_transaction ( transaction_number,
-							1 );
+    /* l'opération est ventilée */
+    gsb_data_transaction_set_split_of_transaction ( transaction_number, 1 );
     }
     else
     {
-	if ( imported_transaction -> categ
-	     &&
-	     strlen (imported_transaction -> categ))
-	{
-	    if ( imported_transaction -> categ[0] == '[' )
-	    {
-		/* it's a transfer,
-		 * we will try to make the link later, for now, we keep the name of the contra account into
-		 * the bank references (never used for import)
-		 * and set contra_transaction_number to -1 to search the link later */
+    if ( imported_transaction -> categ
+        &&
+        strlen (imported_transaction -> categ))
+    {
+        if ( imported_transaction -> categ[0] == '[' )
+        {
+        /* it's a transfer,
+         * we will try to make the link later, for now, we keep the name of the contra account into
+         * the bank references (never used for import)
+         * and set contra_transaction_number to -1 to search the link later */
 
-		gsb_data_transaction_set_bank_references ( transaction_number,
-							   imported_transaction -> categ);
-		gsb_data_transaction_set_contra_transaction_number ( transaction_number,
-								     -1);
-		virements_a_chercher = 1;
-	    }
-	    else
-	    {
-		/* it's a normal category */
+        gsb_data_transaction_set_bank_references ( transaction_number,
+                        imported_transaction -> categ);
+        gsb_data_transaction_set_contra_transaction_number ( transaction_number, -1);
+        virements_a_chercher = 1;
+        }
+        else
+        {
+        /* it's a normal category */
 
-		gint category_number;
+        gint category_number;
 
-		tab_str = g_strsplit ( imported_transaction -> categ,
-				       ":",
-				       2 );
+        tab_str = g_strsplit ( imported_transaction -> categ,
+                        ":",
+                        2 );
 
-		/* get the category and create it if doesn't exist */
-		if (tab_str[0])
-		    tab_str[0] = g_strstrip (tab_str[0]);
-		category_number = gsb_data_category_get_number_by_name ( tab_str[0],
-									 TRUE,
-									 imported_transaction -> montant.mantissa < 0 );
-		gsb_data_transaction_set_category_number ( transaction_number,
-							   category_number );
-		if (tab_str[1])
-		    tab_str[1] = g_strstrip (tab_str[1]);
-		gsb_data_transaction_set_sub_category_number ( transaction_number,
-							       gsb_data_category_get_sub_category_number_by_name ( category_number,
-														   tab_str[1],
-														   TRUE ));
-	    }
-	}
+        /* get the category and create it if doesn't exist */
+        if (tab_str[0])
+            tab_str[0] = g_strstrip (tab_str[0]);
+        category_number = gsb_data_category_get_number_by_name ( tab_str[0],
+                        TRUE,
+                        imported_transaction -> montant.mantissa < 0 );
+        gsb_data_transaction_set_category_number ( transaction_number,
+                        category_number );
+        if (tab_str[1])
+            tab_str[1] = g_strstrip (tab_str[1]);
+        gsb_data_transaction_set_sub_category_number ( transaction_number,
+                        gsb_data_category_get_sub_category_number_by_name ( category_number,
+                        tab_str[1],
+                        TRUE ));
+        }
+    }
     else if ( etat.get_categorie_for_payee && 
      ( !imported_transaction -> cheque 
      ||
@@ -2457,27 +2464,27 @@
         if ( div_number != -1 )
             gsb_data_transaction_set_sub_budgetary_number ( transaction_number, div_number );
     }
-	else
-	{
-	    gsb_data_transaction_set_category_number ( transaction_number, 0 );
-	    gsb_data_transaction_set_sub_category_number ( transaction_number, 0 );
-	}
+    else
+    {
+        gsb_data_transaction_set_category_number ( transaction_number, 0 );
+        gsb_data_transaction_set_sub_category_number ( transaction_number, 0 );
+    }
     }
 
     /* récupération des notes */
     if ( imported_transaction -> notes &&
                         strlen (imported_transaction -> notes) )
         gsb_data_transaction_set_notes ( transaction_number,
-				     imported_transaction -> notes );
+                        imported_transaction -> notes );
 
     if (origine && g_ascii_strcasecmp (origine, "OFX") == 0 )
     {
-	gchar *buffer;
+    gchar *buffer;
     gint payment_number = 0;
 
     switch ( imported_transaction -> type_de_transaction )
-	{
-	    case OFX_CHECK:
+    {
+        case OFX_CHECK:
         /* Check = Chèque */
         payment_number = gsb_data_payment_get_number_by_name ( _("Check"),
                         account_number );
@@ -2490,172 +2497,172 @@
                 transaction_number, buffer );
         g_free ( buffer );
 
-		break;
-	    //~ case OFX_INT:
-		//~ break;
-	    //~ case OFX_DIV:
-		//~ break;
-	    //~ case OFX_SRVCHG:
-		//~ break;
-	    //~ case OFX_FEE:
-		//~ break;
-	    case OFX_DEP:
+        break;
+        //~ case OFX_INT:
+        //~ break;
+        //~ case OFX_DIV:
+        //~ break;
+        //~ case OFX_SRVCHG:
+        //~ break;
+        //~ case OFX_FEE:
+        //~ break;
+        case OFX_DEP:
         /* Deposit = Dépôt */
         payment_number = gsb_data_payment_get_number_by_name ( _("Deposit"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_ATM:
+        break;
+        case OFX_ATM:
         /* pas trouvé de définition remplacé par carte de crédit */
         payment_number = gsb_data_payment_get_number_by_name ( _("Credit card"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_POS:
+        break;
+        case OFX_POS:
         /* Point of sale = Point de vente remplacé par carte de crédit */
         payment_number = gsb_data_payment_get_number_by_name ( _("Credit card"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_XFER:
+        break;
+        case OFX_XFER:
         /* Transfer = Virement */
-		payment_number = gsb_data_payment_get_number_by_name ( _("Transfert"),
-						    account_number );
+        payment_number = gsb_data_payment_get_number_by_name ( _("Transfert"),
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_PAYMENT:
+        break;
+        case OFX_PAYMENT:
         /* Electronic payment remplacé par Direct debit = Prélèvement */
         payment_number = gsb_data_payment_get_number_by_name ( _("Direct debit"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_CASH:
+        break;
+        case OFX_CASH:
         /* Cash withdrawal = retrait en liquide */
         payment_number = gsb_data_payment_get_number_by_name ( _("Cash withdrawal"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_DIRECTDEP:
+        break;
+        case OFX_DIRECTDEP:
         /* Direct deposit remplacé par Transfert = Virement */
-		payment_number = gsb_data_payment_get_number_by_name ( _("Transfert"),
-						    account_number );
+        payment_number = gsb_data_payment_get_number_by_name ( _("Transfert"),
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
-		break;
-	    case OFX_DIRECTDEBIT:
+        break;
+        case OFX_DIRECTDEBIT:
         /* Merchant initiated debit remplacé par Direct debit = Prélèvement */
         payment_number = gsb_data_payment_get_number_by_name ( _("Direct debit"),
-						    account_number );
+                        account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
 
-		break;
-	    //~ case OFX_REPEATPMT:
-		//~ break;
+        break;
+        //~ case OFX_REPEATPMT:
+        //~ break;
 
-	    case OFX_DEBIT:
-	    case OFX_CREDIT:
-	    case OFX_OTHER:
-		break;
-	}
+        case OFX_DEBIT:
+        case OFX_CREDIT:
+        case OFX_OTHER:
+        break;
+    }
     }
     else
     {
     /* récupération du chèque et mise en forme du type d'opération */
     if ( imported_transaction -> cheque )
     {
-	/* it's a cheque, try to find a method of payment with automatic increment, if don't find
-	 * set in default method of payment */
-	gint payment_number;
-	gint sign;
+    /* it's a cheque, try to find a method of payment with automatic increment, if don't find
+     * set in default method of payment */
+    gint payment_number;
+    gint sign;
 
-	if ( gsb_data_transaction_get_amount (transaction_number).mantissa < 0 )
-	{
-	    sign = GSB_PAYMENT_DEBIT;
-	    payment_number = gsb_data_account_get_default_debit (account_number);
-	   }
-	else
-	{
-	    sign = GSB_PAYMENT_CREDIT;
-	    payment_number = gsb_data_account_get_default_credit (account_number);
-	}
+    if ( gsb_data_transaction_get_amount (transaction_number).mantissa < 0 )
+    {
+        sign = GSB_PAYMENT_DEBIT;
+        payment_number = gsb_data_account_get_default_debit (account_number);
+    }
+    else
+    {
+        sign = GSB_PAYMENT_CREDIT;
+        payment_number = gsb_data_account_get_default_credit (account_number);
+    }
 
-	if ( !gsb_data_payment_get_automatic_numbering (payment_number))
-	{
-	    /* the default method is not an automatic numbering, try to find one in the method of payment of this account */
-	    GSList *list_tmp;
+    if ( !gsb_data_payment_get_automatic_numbering (payment_number))
+    {
+        /* the default method is not an automatic numbering, try to find one in the method of payment of this account */
+        GSList *list_tmp;
 
-	    list_tmp = gsb_data_payment_get_payments_list ();
-	    while (list_tmp)
-	    {
-		gint payment_number_tmp;
+        list_tmp = gsb_data_payment_get_payments_list ();
+        while (list_tmp)
+        {
+        gint payment_number_tmp;
 
-		payment_number_tmp = gsb_data_payment_get_number (list_tmp -> data);
+        payment_number_tmp = gsb_data_payment_get_number (list_tmp -> data);
 
-		if ( gsb_data_payment_get_account_number (payment_number_tmp) == account_number
-		     &&
-		     gsb_data_payment_get_automatic_numbering (payment_number_tmp)
-		     &&
-		     ( gsb_data_payment_get_sign (payment_number_tmp) == sign
-		       ||
-		       gsb_data_payment_get_sign (payment_number_tmp) == GSB_PAYMENT_NEUTRAL ))
-		{
-		    payment_number = payment_number_tmp;
-		    break;
-		}
-		list_tmp = list_tmp -> next;
-	    }
-	}
-	/* now, either payment_number is an automatic numbering method of payment,
-	 * either it's the default method of payment,
-	 * first save it */
-	gsb_data_transaction_set_method_of_payment_number ( transaction_number,
-							    payment_number );
+        if ( gsb_data_payment_get_account_number (payment_number_tmp) == account_number
+             &&
+             gsb_data_payment_get_automatic_numbering (payment_number_tmp)
+             &&
+             ( gsb_data_payment_get_sign (payment_number_tmp) == sign
+               ||
+               gsb_data_payment_get_sign (payment_number_tmp) == GSB_PAYMENT_NEUTRAL ))
+        {
+            payment_number = payment_number_tmp;
+            break;
+        }
+        list_tmp = list_tmp -> next;
+        }
+    }
+    /* now, either payment_number is an automatic numbering method of payment,
+     * either it's the default method of payment,
+     * first save it */
+    gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+                        payment_number );
 
-	tmpstr = utils_str_itoa ( imported_transaction -> cheque );
-	if ( gsb_data_payment_get_automatic_numbering (payment_number))
-	    /* we are on the default payment_number, save just the cheque number */
-	    gsb_data_transaction_set_method_of_payment_content ( transaction_number,
-								 tmpstr );
-	else
-	{
-	    /* we are on a automatic numbering payment, we will save the cheque only
-	     * if it's not used before, else we show an warning message */
-	    if (gsb_data_transaction_check_content_payment (payment_number, imported_transaction -> cheque))
-	    {
-		gchar* tmpstr = g_strdup_printf ( _("Warning : the cheque number %ld is already used.\nWe skip it"),
-						     imported_transaction -> cheque );
-		dialogue_warning ( tmpstr );
-		g_free ( tmpstr );
-	    }
-	    else
-		gsb_data_transaction_set_method_of_payment_content ( transaction_number,
-								     utils_str_itoa ( imported_transaction -> cheque ) );
-	}
-	g_free ( tmpstr );
+    tmpstr = utils_str_itoa ( imported_transaction -> cheque );
+    if ( gsb_data_payment_get_automatic_numbering (payment_number))
+        /* we are on the default payment_number, save just the cheque number */
+        gsb_data_transaction_set_method_of_payment_content ( transaction_number,
+                        tmpstr );
+    else
+    {
+        /* we are on a automatic numbering payment, we will save the cheque only
+         * if it's not used before, else we show an warning message */
+        if (gsb_data_transaction_check_content_payment (payment_number, imported_transaction -> cheque))
+        {
+        gchar* tmpstr = g_strdup_printf ( _("Warning : the cheque number %ld is already used.\nWe skip it"),
+                        imported_transaction -> cheque );
+        dialogue_warning ( tmpstr );
+        g_free ( tmpstr );
+        }
+        else
+        gsb_data_transaction_set_method_of_payment_content ( transaction_number,
+                        utils_str_itoa ( imported_transaction -> cheque ) );
+    }
+    g_free ( tmpstr );
     }
     else
     {
-	/* comme ce n'est pas un chèque, on met sur le type par défaut */
-	if ( gsb_data_transaction_get_amount (transaction_number).mantissa < 0 )
-	    gsb_data_transaction_set_method_of_payment_number ( transaction_number,
-								gsb_data_account_get_default_debit (account_number));
-	else
-	    gsb_data_transaction_set_method_of_payment_number ( transaction_number,
-								gsb_data_account_get_default_credit (account_number));
+    /* comme ce n'est pas un chèque, on met sur le type par défaut */
+    if ( gsb_data_transaction_get_amount (transaction_number).mantissa < 0 )
+        gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+                        gsb_data_account_get_default_debit (account_number));
+    else
+        gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+                        gsb_data_account_get_default_credit (account_number));
     }
     }
     /* récupération du pointé */
     gsb_data_transaction_set_marked_transaction ( transaction_number,
-						  imported_transaction -> p_r );
+                        imported_transaction -> p_r );
     if (imported_transaction -> p_r == OPERATION_RAPPROCHEE)
-	marked_r_transactions_imported = TRUE;
+    marked_r_transactions_imported = TRUE;
 
 
     /* si c'est une ope de ventilation, lui ajoute le no de l'opération précédente */
     if ( imported_transaction -> ope_de_ventilation )
-	gsb_data_transaction_set_mother_transaction_number ( transaction_number,
-							     mother_transaction_number );
+    gsb_data_transaction_set_mother_transaction_number ( transaction_number,
+                        mother_transaction_number );
     else
-	mother_transaction_number  = transaction_number;
+    mother_transaction_number  = transaction_number;
 
     /* pbiava the 03/17/2009 delete the found transaction */
     if ( etat.get_fusion_import_planed_transactions &&

Index: gsb_currency_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_config.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- gsb_currency_config.c	30 Aug 2009 17:59:47 -0000	1.57
+++ gsb_currency_config.c	27 Sep 2009 15:30:49 -0000	1.58
@@ -61,7 +61,6 @@
                         gboolean include_obsolete );
 static gboolean gsb_currency_config_fill_tree ( GtkTreeModel *model );
 static gint gsb_currency_config_get_selected ( GtkTreeView *tree_view );
-static GtkWidget * gsb_currency_config_new_combobox ( gint * value, GCallback hook );
 static void gsb_currency_config_remove_currency ( GtkWidget *button,
                         GtkWidget *tree_view );
 static void gsb_currency_config_remove_selected_from_view ( GtkTreeView * tree_view );
@@ -873,17 +872,18 @@
     combo_box = gsb_currency_make_combobox (FALSE);
 
     if (value && *value)
-	gsb_currency_set_combobox_history ( combo_box,
-					    *value );
+    gsb_currency_set_combobox_history ( combo_box, *value );
 
-    g_signal_connect ( G_OBJECT (combo_box), "changed", (GCallback) 
-                        gsb_currency_config_set_int_from_combobox, value );
-    //~ g_signal_connect ( G_OBJECT (combo_box), "changed", (GCallback) hook, value );
+    g_signal_connect ( G_OBJECT (combo_box),
+                        "changed",
+                        (GCallback) gsb_currency_config_set_int_from_combobox,
+                        value );
     g_object_set_data ( G_OBJECT ( combo_box ), "pointer", value);
 
-	g_object_set_data ( G_OBJECT (combo_box), "changed-hook", 
-			    (gpointer) g_signal_connect_after (G_OBJECT(combo_box), "changed",
-							       G_CALLBACK (hook), value ));
+    if ( hook )
+    g_object_set_data ( G_OBJECT (combo_box), "changed-hook", 
+                        (gpointer) g_signal_connect_after (G_OBJECT(combo_box), "changed",
+                        G_CALLBACK (hook), value ));
 
     return combo_box;
 }
@@ -904,12 +904,13 @@
 
     if ( data )
     {
-	*data = gsb_currency_get_currency_from_combobox (combobox);
+    *data = gsb_currency_get_currency_from_combobox (combobox);
     }
 
     /* Mark file as modified */
-    //~ if ( etat.modification_fichier == 0 )
+    if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
+
     return (FALSE);
 }
 

Index: utils_str.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_str.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- utils_str.c	16 Sep 2009 19:46:01 -0000	1.68
+++ utils_str.c	27 Sep 2009 15:30:49 -0000	1.69
@@ -750,7 +750,7 @@
 
     long_old = g_utf8_strlen ( old_str, -1 );
     chaine = g_strndup ( str, (ptr_debut - str) );
-    chaine = g_strconcat ( chaine, new_str, ( ptr_debut + long_old ), NULL );
+    chaine = g_strconcat ( chaine, new_str, ( ptr_debut + long_old + 1 ), NULL );
     return g_strdup ( chaine );
 }
 



More information about the cvs mailing list