[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_100-5-g3eceae5

Pierre Biava nobody at users.sourceforge.net
Sun Feb 20 23:01:48 CET 2011


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  3eceae57855963a2c9e6d4793896cf750d752a2e (commit)
      from  e3a6eedf5bfafbe58351a820addcc1fd20984b4e (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 3eceae57855963a2c9e6d4793896cf750d752a2e
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Feb 20 22:54:47 2011 +0100

    Adding the division in the debit and credit entries

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

Changes:
diff --git a/src/gsb_form_widget.c b/src/gsb_form_widget.c
index 06a7cf8..50fe93f 100644
--- a/src/gsb_form_widget.c
+++ b/src/gsb_form_widget.c
@@ -1010,7 +1010,8 @@ gboolean gsb_form_widget_get_valide_amout_entry ( const gchar *string )
         {
             if ( g_unichar_isdefined ( thousands_sep ) )
             {
-                if ( ch != '.' && ch != ',' && ch != '+' && ch != '-' && ch != '*' && ch != thousands_sep )
+                if ( ch != '.' && ch != ',' && ch != '+' && ch != '-'
+                 && ch != '*' && ch != '/' && ch != thousands_sep )
                 {
                     g_free ( mon_decimal_point );
                     g_free ( mon_thousands_sep );
@@ -1052,7 +1053,7 @@ gboolean gsb_form_widget_get_valide_amout_entry ( const gchar *string )
                     g_strfreev ( tab );
                 }
             }
-            else if ( ch != '.' && ch != ',' && ch != '+' && ch != '-' && ch != '*' )
+            else if ( ch != '.' && ch != ',' && ch != '+' && ch != '-' && ch != '*' && ch != '/' )
                 return FALSE;
         }
 
diff --git a/src/utils_editables.c b/src/utils_editables.c
index dfacd46..acf98ac 100644
--- a/src/utils_editables.c
+++ b/src/utils_editables.c
@@ -150,7 +150,7 @@ gsb_real gsb_utils_edit_calculate_entry ( GtkWidget *entry )
     gchar *pointeur;
     gsb_real total = null_real;
 	
-    string = my_strdup (gtk_entry_get_text ( GTK_ENTRY (entry)));
+    string = my_strdup ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
 
     if ( string && strlen ( string ) )
         pointeur = string + strlen ( string );
@@ -175,7 +175,7 @@ gsb_real gsb_utils_edit_calculate_entry ( GtkWidget *entry )
         total = gsb_real_add ( total,
                         gsb_real_get_from_string ( pointeur ) );
     }
-    else
+    else if ( g_utf8_strchr ( string, -1, '*' ) )
     {
         total.mantissa = 1;
         total.exponent = 0;
@@ -194,6 +194,17 @@ gsb_real gsb_utils_edit_calculate_entry ( GtkWidget *entry )
         total = gsb_real_mul ( total,
                         gsb_real_get_from_string ( pointeur ) );
     }
+    else if ( g_utf8_strchr ( string, -1, '/' ) )
+    {
+        gchar **tab;
+
+        tab = g_strsplit ( string, "/", 2 );
+
+        total = gsb_real_div ( gsb_real_get_from_string ( tab[0] ),
+                        gsb_real_get_from_string ( tab[1] ) );
+
+        g_strfreev ( tab );
+    }
 
     g_free ( string );
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list