[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_96-3-gb665b10

Pierre Biava nobody at users.sourceforge.net
Tue Dec 14 23:10:10 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  b665b10d5e5ad51845dcee897862885cc4f62020 (commit)
      from  749d7ebd803b7b39e5fb0579db726631e5494100 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b665b10d5e5ad51845dcee897862885cc4f62020
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Dec 14 23:07:15 2010 +0100

    This time it's the last time I work on this bug :-)

-----------------------------------------------------------------------

Changes:
diff --git a/src/bet_finance_ui.c b/src/bet_finance_ui.c
index dc81931..7756063 100644
--- a/src/bet_finance_ui.c
+++ b/src/bet_finance_ui.c
@@ -680,6 +680,8 @@ void bet_finance_calculer_clicked ( GtkButton *button, GtkWidget *widget )
         g_free ( tmp_str );
         return;
     }
+    else if ( s_echeance -> capital == G_MININT64 )
+        return;
 
     /* rate */
     s_echeance -> taux = bet_finance_get_number_from_string ( widget, "taux" );
@@ -2170,6 +2172,18 @@ gboolean bet_finance_capital_entry_key_press_event ( GtkWidget *widget,
 }
 
 
+GtkWidget *bet_finance_get_capital_entry ( void )
+{
+    GtkWidget *page;
+    GtkWidget *entry;
+
+    page = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( finance_notebook ), 0 );
+    entry = g_object_get_data ( G_OBJECT ( page ), "capital" );
+
+    return entry;
+}
+
+
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/bet_finance_ui.h b/src/bet_finance_ui.h
index 9e0c592..6af258f 100644
--- a/src/bet_finance_ui.h
+++ b/src/bet_finance_ui.h
@@ -11,6 +11,7 @@
 /* START_DECLARATION */
 GtkWidget *bet_finance_create_account_page ( void );
 GtkWidget *bet_finance_create_page ( void );
+GtkWidget *bet_finance_get_capital_entry ( void );
 gdouble bet_finance_get_number_from_string ( GtkWidget *parent, const gchar *name );
 void bet_finance_switch_simulator_page ( void );
 void bet_finance_ui_update_amortization_tab ( gint account_number );
diff --git a/src/parametres.c b/src/parametres.c
index 5eb667a..a326185 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -1461,6 +1461,8 @@ GtkWidget *gsb_config_number_format_chosen ( GtkWidget *parent, gint sens )
 void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user_data )
 {
     GtkWidget *combo_box;
+    GtkWidget *entry;
+    gchar *str_capital;
     const gchar *text;
 
     text = gtk_combo_box_get_active_text ( widget );
@@ -1486,6 +1488,16 @@ void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user
         }
     }
 
+    /* reset capital */
+    entry = bet_finance_get_capital_entry ( );
+    str_capital = gsb_real_get_string_with_currency ( gsb_real_double_to_real (
+                    etat.bet_capital ),
+                    etat.bet_currency,
+                    FALSE );
+
+    gtk_entry_set_text ( GTK_ENTRY ( entry ), str_capital );
+    g_free ( str_capital );
+
     if ( GPOINTER_TO_INT ( user_data ) == GTK_ORIENTATION_HORIZONTAL )
         return;
 
@@ -1502,6 +1514,8 @@ void gsb_localisation_decimal_point_changed ( GtkComboBox *widget, gpointer user
 void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user_data )
 {
     GtkWidget *combo_box;
+    GtkWidget *entry;
+    gchar *str_capital;
     const gchar *text;
 
     text = gtk_combo_box_get_active_text ( widget );
@@ -1534,6 +1548,16 @@ void gsb_localisation_thousands_sep_changed ( GtkComboBox *widget, gpointer user
     else
         gsb_real_set_thousands_sep ( NULL );
 
+    /* reset capital */
+    entry = bet_finance_get_capital_entry ( );
+    str_capital = gsb_real_get_string_with_currency ( gsb_real_double_to_real (
+                    etat.bet_capital ),
+                    etat.bet_currency,
+                    FALSE );
+
+    gtk_entry_set_text ( GTK_ENTRY ( entry ), str_capital );
+    g_free ( str_capital );
+
     if ( GPOINTER_TO_INT ( user_data ) == GTK_ORIENTATION_HORIZONTAL )
         return;
 
diff --git a/src/utils_str.c b/src/utils_str.c
index c4d05cd..48bef1c 100644
--- a/src/utils_str.c
+++ b/src/utils_str.c
@@ -928,47 +928,15 @@ gdouble utils_str_safe_strtod ( const gchar *str_number, gchar **endptr )
  * */
 gdouble utils_str_strtod ( const gchar *str_number, gchar **endptr )
 {
-    gchar *p, *q;
     gdouble number;
+    gsb_real real;
 
     if ( str_number == NULL )
         return 0.0;
 
-    /* on supprime les espaces si necessaires */
-    if ( g_strrstr ( str_number, " " ) )
-        str_number = my_strdelimit ( str_number, " ", "" );
+    real = gsb_real_get_from_string ( str_number );
 
-    /* on met le . comme séparateur décimal */
-    if ( ( p = g_strrstr ( str_number, "," ) ) )
-    {
-        if ( ( q = g_strrstr ( str_number, "." ) ) == NULL )
-            str_number = my_strdelimit ( str_number, ",", "." );
-        else if ( p - q > 0 )
-        {
-            str_number = my_strdelimit ( str_number, ".", "" );
-            str_number = my_strdelimit ( str_number, ",", "." );
-        }
-        else
-        {
-            str_number = my_strdelimit ( str_number, ",", "" );
-        }
-    }
-    else
-    {
-        gchar *mon_thousands_sep;
-
-        mon_thousands_sep = gsb_real_get_thousands_sep ( );
-        if ( mon_thousands_sep
-         &&
-         g_strstr_len ( str_number, -1, mon_thousands_sep ) )
-        {
-            str_number = my_strdelimit ( str_number, mon_thousands_sep, "" );
-        }
-        if ( mon_thousands_sep )
-            g_free ( mon_thousands_sep );
-    }
-
-    number = g_ascii_strtod ( str_number, endptr);
+    number = gsb_real_real_to_double ( real );
 
     return number;
 }


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list