[grisbi-devel] [branch grisbi-1.0.x] [PATCH 1/2] Adding a validation message for the change of period for a deferred debit card account.

Rémi Cardona remi at gentoo.org
Mon Feb 4 20:28:24 CET 2013


Le samedi 02 février 2013 à 09:35 +0100, Pierre Biava a écrit :
>  From d8082d5677c740dfd03ce3fd4c935e28ca63c6e1 Mon Sep 17 00:00:00 2001
> From: pbiava <pierre.biava at nerim.net>
> Date: Sat, 2 Feb 2013 08:29:10 +0100
> Subject: [PATCH] Adding a validation message for the change of period for a
>   deferred debit card account.
> 
> ---
>   src/bet_data.c |   23 +++++++++++++++++++++++
>   1 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/src/bet_data.c b/src/bet_data.c
> index 6ab19a4..390708a 100644
> --- a/src/bet_data.c
> +++ b/src/bet_data.c
> @@ -26,6 +26,7 @@
>   #endif
> 
>   #include "include.h"
> +#include <glib/gi18n.h>
> 
>   /*START_INCLUDE*/
>   #include "bet_data.h"
> @@ -1861,6 +1862,28 @@ void bet_data_transfert_update_date_if_necessary 
> ( struct_transfert_data *transf
>       if ( g_date_compare ( date_jour, transfert -> date_bascule ) >= 0 )
>       {
>           gboolean same_month = FALSE;
> +        gchar *msg;
> +        const gchar *tmp_str;
> +
> +        if ( transfert -> type == 0 )
> +            tmp_str = gsb_data_account_get_name ( 
> transfert->replace_account );
> +        else
> +            tmp_str = gsb_data_partial_balance_get_name ( 
> transfert->replace_account );
> +
> +        msg = g_strdup_printf (
> +                        _("Warning: the start date of the period of 
> deferred debit card account (%s) "
> +                          "is reached or exceeded. All operations of 
> this card account must be entered "
> +                          "or they will not be taken into account in 
> the period.\n\n"
> +                          "If you have entered all transactions, 
> confirm with \"Yes\".\n"
> +                          "If you have yet to enter into transactions 
> on behalf deferred debit card finish "
> +                          "with \"No\" and update the account before 
> you start."),
> +                        tmp_str );
> +        if (!question_yes_no_hint (_("Confirmation of the change of 
> period"), msg , GTK_RESPONSE_CANCEL ))
> +        {
> +            g_free ( msg );
> +            return;
> +        }
> +            g_free ( msg );
> 

Ça me parait plus simple de tourner le if comme suit:

    int answer;
    msg = ...
    answer = question_yes_no_hint ( ... );
    g_free ( msg );
    if (!answer)
        return;

Sinon, RAS.

Rémi



More information about the devel mailing list