Exemplo n.º 1
0
gboolean csv_import_parse_debit ( struct struct_ope_importation * ope, gchar * string )
{
    if ( !string )
        return FALSE;

    if ( strlen ( string ) > 0 )
    {
        ope -> montant = gsb_real_sub ( ope -> montant,
                        utils_real_get_from_string ( string ) );
    }

    return TRUE;
}
Exemplo n.º 2
0
/**
 * TODO: Use  a real parsing
 *
 */
gboolean csv_import_parse_balance ( struct struct_ope_importation * ope, gchar * string )
{
    if ( !string )
        return FALSE;

    if ( strlen ( string ) > 0 )
    {
        ope -> montant = utils_real_get_from_string ( string );
        return TRUE;
    }

    return FALSE;
}
Exemplo n.º 3
0
/**
 * fonction de conversion de char à double pour chaine en tenant compte du séparateur décimal
 * et du séparateur de milliers configurés dans les préférences.
 *
 *
 *
 * */
gdouble utils_str_strtod ( const gchar *str_number, gchar **endptr )
{
    gdouble number;
    gsb_real real;

    if ( str_number == NULL )
        return 0.0;

    real = utils_real_get_from_string ( str_number );

    number = gsb_real_real_to_double ( real );

    return number;
}
Exemplo n.º 4
0
/**
 * update the labels according to the value in the account structure and the entries
 * so all the calculs must have been done before (for marked transactions)
 *
 * \param entry not used
 * \param null not used
 *
 * \return FALSE
 * */
gboolean gsb_reconcile_update_amounts ( GtkWidget *entry,
					    gpointer null )
{
    gsb_real amount;
    gint account_number;
    gint currency_number;
    const gchar *initial_balance;
    const gchar *final_balance;
    gchar *tmp_string;
	gchar* tmpstr;
    gboolean valide = FALSE;

    /* first get the current account number */
    account_number = gsb_gui_navigation_get_current_account ();

    /* fill the labels corresponding to the balances */
    initial_balance = gtk_entry_get_text ( GTK_ENTRY (reconcile_initial_balance_entry) );
    gtk_label_set_text ( GTK_LABEL ( reconcile_initial_balance_label ), initial_balance );

    if ( entry )
    {
        valide = gsb_form_widget_get_valide_amout_entry (
                        gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
        if ( valide )
        {
            /* the entry is valid, make it normal */
            gtk_widget_modify_base ( entry, GTK_STATE_NORMAL, NULL );
        }
        else
        {
            /* the entry is not valid, make it red */
            gtk_widget_modify_base ( entry, GTK_STATE_NORMAL, gsb_color_get_couleur ( "entry_error_color" ) );
            return FALSE;
        }
    }

    currency_number = gsb_data_account_get_currency ( account_number );
    amount = utils_real_get_calculate_entry ( reconcile_final_balance_entry );
    final_balance = utils_real_get_string_with_currency ( amount, currency_number, FALSE );
    gtk_label_set_text ( GTK_LABEL ( reconcile_final_balance_label ), final_balance );

    /* set the marked balance amount,
     * this is what we mark as P while reconciling, so it's the total marked balance
     * - the initial marked balance */
    tmp_string = utils_real_get_string_with_currency (
                        gsb_data_account_calculate_waiting_marked_balance ( account_number ),
                        currency_number,
                        FALSE );
    gtk_label_set_text ( GTK_LABEL ( reconcile_marked_balance_label ), tmp_string );
    g_free (tmp_string);

    /* calculate the variation balance and show it */
    amount = gsb_real_sub ( gsb_real_add (
                        utils_real_get_from_string ( initial_balance ),
					    gsb_data_account_calculate_waiting_marked_balance ( account_number ) ),
			            utils_real_get_from_string ( final_balance ) );

    tmpstr = utils_real_get_string_with_currency ( amount, currency_number, FALSE );
    gtk_label_set_text ( GTK_LABEL ( reconcile_variation_balance_label ), tmpstr);
    g_free ( tmpstr );

    if ( amount.mantissa )
	    gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_ok_button ), FALSE );
    else
	    gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_ok_button ), TRUE );
    return FALSE;
}
Exemplo n.º 5
0
/**
 * finish the reconciliation,
 * called by a click on the finish button
 *
 * \param button
 * \param null
 *
 * \return FALSE
 */
gboolean gsb_reconcile_finish_reconciliation ( GtkWidget *button,
					    gpointer null )
{
    GSList *list_tmp_transactions;
    GDate *date;
    gint account_number;
    gint reconcile_number;
    gsb_real real;
	gchar* tmpstr;

    account_number = gsb_gui_navigation_get_current_account ();

    if ( gsb_real_sub ( gsb_real_add ( utils_real_get_from_string (gtk_entry_get_text ( GTK_ENTRY ( reconcile_initial_balance_entry ))),
				       gsb_data_account_calculate_waiting_marked_balance (account_number)),
			utils_real_get_from_string (gtk_entry_get_text ( GTK_ENTRY ( reconcile_final_balance_entry )))).mantissa != 0 )
    {
	dialogue_warning_hint ( _("There is a variance in balances, check that both final balance and initial balance minus marked transactions are equal."),
				_("Reconciliation can't be completed.") );
	return FALSE;
    }

    /* get and check the reconcile name */
    reconcile_number = gsb_data_reconcile_get_number_by_name (gtk_entry_get_text ( GTK_ENTRY ( reconcile_number_entry )));
    if (reconcile_number)
    {
	dialogue_warning_hint ( _("There is already a reconcile with that name, you must use another name or let it free.\nIf the reconcile name is ending by a number,\nit will be automatically incremented."),
				_("Reconciliation can't be completed.") );
	return FALSE;
    }


    /* get and save the date */
    date = gsb_calendar_entry_get_date (reconcile_new_date_entry);
    if (!date)
    {
	gchar* tmpstr = g_strdup_printf ( _("Invalid date: '%s'"),
						  gtk_entry_get_text ( GTK_ENTRY ( reconcile_new_date_entry )));
	dialogue_warning_hint ( tmpstr,
				_("Reconciliation can't be completed.") );
	g_free ( tmpstr );
	return FALSE;
    }

    if (!strlen (gtk_entry_get_text ( GTK_ENTRY ( reconcile_number_entry ))))
    {
	dialogue_warning_hint ( _("You need to set a name to the reconciliation ; at least, set a number,\nit will be automatically incremented later"),
				_("Reconciliation can't be completed.") );
	return FALSE;
    }

    /* restore the good sort of the list */
    if (transaction_list_sort_get_reconcile_sort ())
    {
	gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (reconcile_sort_list_button),
				       FALSE );
	gsb_reconcile_list_button_clicked (reconcile_sort_list_button, NULL);
    }

    tmpstr = g_strdup_printf ( _("Last statement: %s"), gsb_format_gdate (date));
    gtk_label_set_text ( GTK_LABEL ( label_last_statement ),
			 tmpstr);
    g_free ( tmpstr );

    /* create the new reconcile structure */
    reconcile_number = gsb_data_reconcile_new (gtk_entry_get_text (GTK_ENTRY (reconcile_number_entry)));
    gsb_data_reconcile_set_account ( reconcile_number, account_number );

    /* set the variables of the reconcile */
    gsb_data_reconcile_set_final_date ( reconcile_number, date );
    g_date_free (date);

    date = gsb_parse_date_string (gtk_label_get_text (GTK_LABEL (reconcile_last_date_label)));
    gsb_data_reconcile_set_init_date ( reconcile_number, date );
    g_free (date);

    real = utils_real_get_from_string ( gtk_entry_get_text (
                        GTK_ENTRY ( reconcile_initial_balance_entry ) ) );
    gsb_data_reconcile_set_init_balance ( reconcile_number, real );

    real = utils_real_get_from_string ( gtk_entry_get_text (
                        GTK_ENTRY ( reconcile_final_balance_entry ) ) );
    gsb_data_reconcile_set_final_balance ( reconcile_number,
					   real );

    /* modify the reconciled transactions */
    list_tmp_transactions = gsb_data_transaction_get_transactions_list ();

    while ( list_tmp_transactions )
    {
	gint transaction_number_tmp;
	transaction_number_tmp = gsb_data_transaction_get_transaction_number (
                        list_tmp_transactions -> data);

	if ( gsb_data_transaction_get_account_number (transaction_number_tmp) == account_number
	     &&
	     ( gsb_data_transaction_get_marked_transaction (transaction_number_tmp) == OPERATION_POINTEE
	       ||
	       gsb_data_transaction_get_marked_transaction (transaction_number_tmp) == OPERATION_TELERAPPROCHEE ))
	{
	    gsb_data_transaction_set_marked_transaction ( transaction_number_tmp,
							  OPERATION_RAPPROCHEE );
	    gsb_data_transaction_set_reconcile_number ( transaction_number_tmp,
							reconcile_number );
	}
	list_tmp_transactions = list_tmp_transactions -> next;
    }

    /* update the P and T to R in the list */
    transaction_list_update_element (ELEMENT_MARK);

    run.mise_a_jour_liste_comptes_accueil = TRUE;

    /* go back to the normal transactions list */
    gsb_reconcile_cancel (NULL, NULL);

    /* reset records in run: to do after gsb_reconcile_cancel */
    g_free (run.reconcile_final_balance);
    if (run.reconcile_new_date)
        g_date_free (run.reconcile_new_date);
    run.reconcile_final_balance = NULL;
    run.reconcile_new_date = NULL;
    run.reconcile_account_number = -1;

    gsb_file_set_modified ( TRUE );

    if ( reconcile_save_last_scheduled_convert )
    {
        gsb_gui_navigation_set_selection ( GSB_SCHEDULER_PAGE, 0, NULL );
        gsb_scheduler_list_select ( reconcile_save_last_scheduled_convert );
        gsb_scheduler_list_edit_transaction ( reconcile_save_last_scheduled_convert );
        reconcile_save_last_scheduled_convert = 0;
    }

    return FALSE;
}
Exemplo n.º 6
0
/**
 * called when the user click on the button 'create the new reconciliation'
 * check the entries and create the corresponding reconciliation
 *
 * \param button
 * \param label a message label, hidden at the beginning, that will say ok the reconciliation is created
 * 		or if there is a problem...
 *
 * \return FALSE
 * */
static gboolean gsb_assistant_reconcile_config_page_add_new_reconcile ( GtkWidget *button,
                        GtkWidget *label )
{
    gint reconcile_number;
    gchar *string;

    /* first, we check the date are valid */
    if ( !gsb_date_check_entry ( reconcile_init_date_entry ) )
    {
        string = make_red ( _("The initial date is not valid, please check it.") );
        gtk_label_set_markup ( GTK_LABEL ( label) , string );
        gtk_widget_grab_focus (reconcile_init_date_entry);
        g_free ( string );
        return FALSE;
    }

    if ( !gsb_date_check_entry ( reconcile_final_date_entry ) )
    {
        string = make_red ( _("The final date is not valid, please check it.") );
        gtk_label_set_markup ( GTK_LABEL ( label) , string );
        gtk_widget_grab_focus ( reconcile_final_date_entry );
        g_free ( string );
    return FALSE;
    }

    /* check there is a name */
    if ( !strlen (gtk_entry_get_text ( GTK_ENTRY ( reconcile_name_entry ) ) ) )
    {
        string = make_red ( _("Please give a name to the new reconciliation.") );
        gtk_label_set_markup ( GTK_LABEL ( label) , string );
        gtk_widget_grab_focus ( reconcile_name_entry );
        g_free ( string );
        return FALSE;
    }

    /* check if already exist the name */
    if ( gsb_data_reconcile_get_number_by_name (
     gtk_entry_get_text (GTK_ENTRY (reconcile_name_entry) ) ) )
    {
        string = make_red ( _("That name already exists, please find another one.") );
        gtk_label_set_markup ( GTK_LABEL ( label) , string );
        gtk_widget_grab_focus ( reconcile_name_entry );
        g_free ( string );
        return FALSE;
    }

    /* ok, now we can create the reconcile */
    reconcile_number = gsb_data_reconcile_new (
                        gtk_entry_get_text ( GTK_ENTRY ( reconcile_name_entry ) ) );
    if ( !reconcile_number )
    if (gsb_data_reconcile_get_number_by_name ( gtk_entry_get_text (
     GTK_ENTRY ( reconcile_name_entry ) ) ) )
    {
        string = make_red ( _("Cannot allocate memory : Bad things will happen soon.") );
        gtk_label_set_markup ( GTK_LABEL ( label) , string );
        gtk_widget_grab_focus ( reconcile_name_entry );
        g_free ( string );
        return FALSE;
    }

    gsb_data_reconcile_set_init_date ( reconcile_number,
                        gsb_calendar_entry_get_date ( reconcile_init_date_entry ) );
    gsb_data_reconcile_set_final_date ( reconcile_number,
                        gsb_calendar_entry_get_date ( reconcile_final_date_entry ) );
    gsb_data_reconcile_set_init_balance ( reconcile_number,
                        utils_real_get_from_string ( gtk_entry_get_text (
                        GTK_ENTRY (reconcile_init_balance_entry ) ) ) );
    gsb_data_reconcile_set_final_balance ( reconcile_number,
                        utils_real_get_from_string ( gtk_entry_get_text (
                        GTK_ENTRY ( reconcile_final_balance_entry ) ) ) );
    gsb_data_reconcile_set_account ( reconcile_number,
                        gsb_account_get_combo_account_number ( reconcile_account_button ) );

    /* erase the entries but not the account wich can be used again */
    gtk_entry_set_text ( GTK_ENTRY (reconcile_name_entry), "" );
    gtk_entry_set_text ( GTK_ENTRY (reconcile_init_date_entry), "" );
    gtk_entry_set_text ( GTK_ENTRY (reconcile_final_date_entry), "" );
    gtk_entry_set_text ( GTK_ENTRY (reconcile_init_balance_entry), "" );
    gtk_entry_set_text ( GTK_ENTRY (reconcile_final_balance_entry), "" );

    string = make_blue ( g_strdup_printf ( _("Reconciliation %s successfully appended!"),
                        gsb_data_reconcile_get_name ( reconcile_number ) ) );
    gtk_label_set_markup ( GTK_LABEL ( label ), string );
    g_free ( string );

    /* update the list of reconcile in the configuration list */
    gsb_reconcile_config_fill ( );

    gtk_widget_grab_focus ( reconcile_name_entry );

    return FALSE;
}
/**
 * called when something change for a link
 *
 * \param tree_view the tree_view
 *
 * \return FALSE
 * */
gboolean gsb_currency_link_config_modify_link ( GtkWidget *tree_view )
{
    GtkWidget *combobox_1;
    GtkWidget *combobox_2;
    GtkWidget *exchange_entry;
    GtkTreeModel *model;
    GtkTreeIter iter;
    gint link_number;
    gchar *invalid;
    GtkWidget *label;
	gchar* tmpstr;
    gchar *strdate;
    gsb_real number;

    if ( !gtk_tree_selection_get_selected ( gtk_tree_view_get_selection (
                        GTK_TREE_VIEW ( tree_view ) ),
					    &model,
					    &iter ) )
	return FALSE;

    gtk_tree_model_get ( GTK_TREE_MODEL (model),
			 &iter,
			 LINK_NUMBER_COLUMN, &link_number,
			 -1 );

    /* normally should not happen */
    if (!link_number)
	return FALSE;

    combobox_1 = g_object_get_data ( G_OBJECT (model),
				     "combobox_1" );
    combobox_2 = g_object_get_data ( G_OBJECT (model),
				     "combobox_2" );
    exchange_entry = g_object_get_data ( G_OBJECT (model),
					 "exchange_entry" );

    number = utils_real_get_from_string ( gtk_entry_get_text ( GTK_ENTRY (exchange_entry) ) );
    if ( number.exponent > 8 )
        gtk_entry_set_max_length (GTK_ENTRY (exchange_entry),
                        strlen( gtk_entry_get_text ( GTK_ENTRY ( exchange_entry ) ) - 1) );

    gsb_data_currency_link_set_first_currency ( link_number,
						gsb_currency_get_currency_from_combobox (combobox_1));
    gsb_data_currency_link_set_second_currency ( link_number,
						 gsb_currency_get_currency_from_combobox (combobox_2));
    gsb_data_currency_link_set_change_rate ( link_number, number );
    gsb_data_currency_link_set_modified_date ( link_number, gdate_today ( ) );

    strdate = gsb_format_gdate ( gsb_data_currency_link_get_modified_date ( link_number ) );

    if ( gsb_data_currency_link_get_invalid_link (link_number))
	invalid = GTK_STOCK_DIALOG_WARNING;
    else
	invalid = NULL;

    tmpstr = utils_real_get_string ( gsb_data_currency_link_get_change_rate ( link_number ) );
    gtk_list_store_set ( GTK_LIST_STORE (model),
			 &iter,
			 LINK_CURRENCY1_COLUMN, gsb_data_currency_get_name (gsb_data_currency_link_get_first_currency(link_number)),
			 LINK_EXCHANGE_COLUMN, tmpstr,
			 LINK_CURRENCY2_COLUMN, gsb_data_currency_get_name (gsb_data_currency_link_get_second_currency(link_number)),
             LINK_DATE_COLUMN, strdate,
			 LINK_INVALID_COLUMN, invalid,
			 -1 );
    g_free ( tmpstr );
    g_free ( strdate );

    /* set or hide the warning label */
    label = g_object_get_data (G_OBJECT (model), "warning_label");

    if ( gsb_data_currency_link_get_invalid_link (link_number))
    {
	gtk_label_set_markup ( GTK_LABEL (label),
			       gsb_data_currency_link_get_invalid_message (link_number));
	gtk_widget_show (label);
    }
    else
	gtk_widget_hide (label);

    gsb_file_set_modified ( TRUE );
    gsb_gui_navigation_update_home_page ( );

    return FALSE;
}
Exemplo n.º 8
0
gint gsb_qif_recupere_operations_from_account ( FILE *qif_file,
                        const gchar *coding_system,
                        struct struct_compte_importation *imported_account )
{
    gchar *string;
    gint returned_value;
    struct struct_ope_importation *imported_splitted = NULL;
    struct struct_ope_importation *imported_transaction;

    imported_transaction = g_malloc0 ( sizeof ( struct struct_ope_importation ) );
    do
    {
        returned_value = get_utf8_line_from_file ( qif_file, &string, coding_system );

        /* a transaction never begin with ^ and ! */
        if ( strlen ( string )
         &&
         returned_value != EOF
         &&
         string[0] != '^'
         &&
         string[0] != '!' )
        {
            /* set the date into date_tmp */
            if ( string[0] == 'D' )
                imported_transaction -> date_tmp = my_strdup ( string + 1 );

            /* récupération du pointage */
            if ( string[0] == 'C' )
            {
                if ( string[1] == '*' )
                    imported_transaction -> p_r = OPERATION_POINTEE;
                else
                    imported_transaction -> p_r = OPERATION_RAPPROCHEE;
            }

            /* récupération de la note */
            if ( string[0] == 'M' )
            {
                imported_transaction -> notes = g_strstrip ( g_strdelimit ( string + 1, ";", '/' ) );
                if ( imported_transaction -> notes && strlen ( imported_transaction -> notes ) == 0 )
                    imported_transaction -> notes = NULL;
            }

            if ( string[0] == 'T' )
            {
                gchar *new_str;

                new_str = utils_str_localise_decimal_point_from_string ( string + 1 );
                imported_transaction -> montant = utils_real_get_from_string ( new_str );

                g_free ( new_str );
            }

            /* récupération du chèque */
            if ( string[0] == 'N' )
                imported_transaction -> cheque = my_strdup ( string + 1 );

            /* récupération du tiers */
            if ( string[0] == 'P' )
                imported_transaction -> tiers = my_strdup ( string + 1 );

            /* récupération des catég */
            if ( string[0] == 'L' )
                imported_transaction -> categ = my_strdup ( string + 1 );

            /* get the splitted transaction */
            if ( string[0] == 'S' )
            {
                /* begin a splitted transaction, if we were on a transaction, we save it */
                if ( returned_value != EOF && imported_transaction && imported_transaction -> date_tmp )
                {

                    if ( imported_splitted == NULL )
                    imported_account -> operations_importees = g_slist_append (
                                        imported_account -> operations_importees, imported_transaction );
                }
                else
                {
                    /* it's the end of file or the transaction is not valid, so the children are not valid too */
                    g_free ( imported_transaction );

                    if ( imported_splitted )
                        g_free ( imported_splitted );

                    imported_transaction = NULL;
                    imported_splitted = NULL;
                }

                /* if we were on a splitted transaction, we save it */
                if ( imported_splitted )
                    imported_account -> operations_importees = g_slist_append (
                                        imported_account -> operations_importees, imported_splitted );

                imported_splitted = g_malloc0 ( sizeof ( struct struct_ope_importation ) );

                if ( imported_transaction )
                {
                    imported_transaction -> operation_ventilee = 1;

                    /* get the data of the transaction */
                    imported_splitted -> date_tmp = my_strdup ( imported_transaction -> date_tmp );
                    imported_splitted -> tiers = imported_transaction -> tiers;
                    imported_splitted -> cheque = imported_transaction -> cheque;
                    imported_splitted -> p_r = imported_transaction -> p_r;
                    imported_splitted -> ope_de_ventilation = 1;
                }

                imported_splitted -> categ = my_strdup ( string + 1 );
            }

            /* récupération de la note de imported_splitted */
            if ( string[0] == 'E' && imported_splitted )
            {
                imported_splitted -> notes = g_strstrip ( g_strdelimit ( string + 1, ";", '/' ) );
                if ( imported_splitted -> notes && strlen ( imported_splitted -> notes ) == 0 )
                    imported_splitted -> notes = NULL;
            }

            /* récupération du montant de la imported_splitted */
            /* récupération du montant ( on doit virer la , que money met pour séparer les milliers ) */
            /* on ne vire la , que s'il y a un . */
            if ( string[0] == '$' && imported_splitted )
            {
                gchar *new_str;

                new_str = utils_str_localise_decimal_point_from_string ( string + 1 );
                imported_splitted -> montant = utils_real_get_from_string ( new_str );

                g_free ( new_str );
            }
        }
    }
    while ( string[0] != '^' && returned_value != EOF && string[0] != '!' );

    /* either we are at the end of a transaction, either at the end of the file */
    /* sometimes we have ^ and EOF, so we need in that case to take the transaction */
    if ( strlen ( string )
     &&
     ( returned_value != EOF || ( string && string[0]=='^') )
     &&
     string[0] != '!' )
    {
        if ( imported_splitted )
        {
            imported_account -> operations_importees = g_slist_append (
                                        imported_account -> operations_importees, imported_splitted );
            imported_splitted = NULL;
        }
        else
        {
            if ( imported_transaction -> date_tmp == NULL
             ||
             strlen ( g_strstrip ( imported_transaction -> date_tmp ) ) == 0 )
            {
                /* l'opération n'a pas de date, c'est pas normal. pour éviter de la perdre, on va lui */
                /* donner la date 01/01/1970 et on ajoute au tiers [opération sans date] */

                imported_transaction -> date_tmp = my_strdup ( "01/01/2000" );
                if ( imported_transaction -> tiers )
                    imported_transaction -> tiers = g_strconcat ( imported_transaction -> tiers,
                                        _(" [Transaction imported without date]"),
                                        NULL );
                else
                    imported_transaction -> tiers = my_strdup ( _(" [Transaction imported without date]") );
            }

            imported_account -> operations_importees = g_slist_append (
                                        imported_account -> operations_importees, imported_transaction );
        }
    }

    if ( string[0] == '!' )
    {
        if ( last_header && strlen ( last_header ) )
            g_free ( last_header );
        last_header = g_strdup ( string );
    }

    if ( returned_value != EOF  && string[0] != '!' )
        return 1;
    else if ( returned_value == EOF )
        return EOF;
    else
        return 0;
}
Exemplo n.º 9
0
/**
 * calcule le total du contenu de l'entrée donnée en argument
 * accepte les + et les - * /
 *
 * \param entry         entrée d'un montant
 *
 * \return gsb_real     total de ce qui est dans l'entrée
 */
gsb_real utils_real_get_calculate_entry ( GtkWidget *entry )
{
    gchar *string;
    gchar *pointeur;
    gsb_real total = null_real;

    string = my_strdup ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );

    if ( string && strlen ( string ) )
        pointeur = string + strlen ( string );
    else
    {
        if ( string )
            g_free ( string );
        return total;
    }

    if ( g_utf8_strchr ( string, -1, '-' ) || g_utf8_strchr ( string, -1, '+' ) )
    {
        while ( pointeur != string )
        {
            if ( pointeur[0] == '+'
                 ||
                 pointeur[0] == '-' )
            {
                total = gsb_real_add ( total,
                            utils_real_get_from_string ( pointeur ) );
                pointeur[0] = 0;
            }

            pointeur--;
        }
        total = gsb_real_add ( total,
                        utils_real_get_from_string ( pointeur ) );
    }
    else if ( g_utf8_strchr ( string, -1, '*' ) )
    {
        total.mantissa = 1;
        total.exponent = 0;

        while ( pointeur != string )
        {
            if ( pointeur[0] == '*' )
            {
                total = gsb_real_mul ( total,
                            utils_real_get_from_string ( pointeur + 1 ) );
                pointeur[0] = 0;
            }

            pointeur--;
        }
        total = gsb_real_mul ( total,
                        utils_real_get_from_string ( pointeur ) );
    }
    else if ( g_utf8_strchr ( string, -1, '/' ) )
    {
        gchar **tab;

        tab = g_strsplit ( string, "/", 2 );

        total = gsb_real_div ( utils_real_get_from_string ( tab[0] ),
                        utils_real_get_from_string ( tab[1] ) );

        g_strfreev ( tab );
    }
    else
        total = utils_real_get_from_string ( string );

    g_free ( string );

    return total;
}