[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_98-29-g2142259

Pierre Biava nobody at users.sourceforge.net
Sun Jan 23 00:40:53 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  214225971023a1e8dde16277ef6d1fd08f0983a8 (commit)
       via  2cbeb73cfc64bf377c6f652b589cd985b8a25d47 (commit)
      from  c8096287ebf230573bcb19f7fa0a8f0cf936b8aa (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 214225971023a1e8dde16277ef6d1fd08f0983a8
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Jan 23 00:40:05 2011 +0100

    Temporary backup of date and balance of future reconciliation by Philippe Delorme

commit 2cbeb73cfc64bf377c6f652b589cd985b8a25d47
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Jan 23 00:19:31 2011 +0100

    deleting unnecessary variables

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

Changes:
diff --git a/src/gsb_reconcile.c b/src/gsb_reconcile.c
index a74c8a0..7bc1266 100644
--- a/src/gsb_reconcile.c
+++ b/src/gsb_reconcile.c
@@ -383,50 +383,68 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
         gtk_entry_set_text ( GTK_ENTRY ( reconcile_number_entry ), tmpstr );
     }
 
-    /* increase the last date of 1 month */
-    date = gsb_date_copy (gsb_data_reconcile_get_final_date (reconcile_number));
-    if (date)
+    /* reset records in etat if user has changed of account */
+    if (etat.reconcile_account_number != account_number)
     {
-        GDate *today;
-        gchar *string ;
-
-        string = gsb_format_gdate ( date );
-        gtk_label_set_text ( GTK_LABEL ( reconcile_last_date_label ),
-                     string);
-        gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_last_date_label ),
-                       FALSE );
-        g_free (string);
-        g_date_add_months ( date, 1 );
-
-        /* if etat.reconcile_end_date or the new date is after today, set today */
-        today = gdate_today();
-        if ( etat.reconcile_end_date || g_date_compare ( date, today) > 0 )
-        {
-            g_date_free (date);
-            date = gdate_today();
-        }
-        else
-            g_date_free (today);
-
-        /* it's not the first reconciliation, set the old balance and unsensitive the old balance entry */
-        tmpstr = gsb_real_get_string (gsb_data_reconcile_get_final_balance (reconcile_number));
-        gtk_entry_set_text ( GTK_ENTRY ( reconcile_initial_balance_entry ), tmpstr);
-        g_free ( tmpstr );
-        gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_initial_balance_entry ),
-                       FALSE );
+        if (etat.reconcile_final_balance) g_free (etat.reconcile_final_balance);
+        if (etat.reconcile_new_date) g_date_free (etat.reconcile_new_date);
+        etat.reconcile_final_balance = NULL;
+        etat.reconcile_new_date = NULL;
+        etat.reconcile_account_number = -1;
+    }
+
+    /* set last input date/amount if available */
+    if (etat.reconcile_new_date)
+    {
+        date = etat.reconcile_new_date;
     }
     else
     {
-        gtk_label_set_text ( GTK_LABEL ( reconcile_last_date_label ), _("None") );
+        /* increase the last date of 1 month */
+        date = gsb_date_copy (gsb_data_reconcile_get_final_date (reconcile_number));
+        if (date)
+        {
+            GDate *today;
+            gchar *string ;
+
+            string = gsb_format_gdate ( date );
+            gtk_label_set_text ( GTK_LABEL ( reconcile_last_date_label ),
+                    string);
+            gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_last_date_label ),
+                    FALSE );
+            g_free (string);
+            g_date_add_months ( date, 1 );
+
+            /* if etat.reconcile_end_date or the new date is after today, set today */
+            today = gdate_today();
+            if ( etat.reconcile_end_date || g_date_compare ( date, today) > 0 )
+            {
+                g_date_free (date);
+                date = gdate_today();
+            }
+            else
+                g_date_free (today);
+
+            /* it's not the first reconciliation, set the old balance and unsensitive the old balance entry */
+            tmpstr = gsb_real_get_string (gsb_data_reconcile_get_final_balance (reconcile_number));
+            gtk_entry_set_text ( GTK_ENTRY ( reconcile_initial_balance_entry ), tmpstr);
+            g_free ( tmpstr );
+            gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_initial_balance_entry ),
+                    FALSE );
+        }
+        else
+        {
+            gtk_label_set_text ( GTK_LABEL ( reconcile_last_date_label ), _("None") );
 
-        date = gdate_today();
+            date = gdate_today();
 
-        /* it's the first reconciliation, set the initial balance and make sensitive the old balance to change
-         * it if necessary */
-        tmpstr = gsb_real_get_string ( gsb_data_account_get_init_balance (account_number, -1));
-        gtk_entry_set_text ( GTK_ENTRY ( reconcile_initial_balance_entry ), tmpstr);
-        g_free ( tmpstr );
-        gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_initial_balance_entry ), TRUE );
+            /* it's the first reconciliation, set the initial balance and make sensitive the old balance to change
+             * it if necessary */
+            tmpstr = gsb_real_get_string ( gsb_data_account_get_init_balance (account_number, -1));
+            gtk_entry_set_text ( GTK_ENTRY ( reconcile_initial_balance_entry ), tmpstr);
+            g_free ( tmpstr );
+            gtk_widget_set_sensitive ( GTK_WIDGET ( reconcile_initial_balance_entry ), TRUE );
+        }
     }
 
     string = gsb_format_gdate (date);
@@ -434,7 +452,12 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
 			 string );
     g_free (string);
     g_date_free (date);
-    gtk_entry_set_text ( GTK_ENTRY ( reconcile_final_balance_entry ), "" );
+
+    /* set last input amount if available and if the account is the good one */
+    gtk_entry_set_text ( GTK_ENTRY ( reconcile_final_balance_entry ), 
+            (etat.reconcile_final_balance) ? etat.reconcile_final_balance : "");
+    if (etat.reconcile_final_balance)
+        g_free(etat.reconcile_final_balance);
 
     /* set the title */
     tmpstr = g_markup_printf_escaped ( _(" <b>%s reconciliation</b> "),
@@ -609,6 +632,13 @@ gboolean gsb_reconcile_finish_reconciliation ( GtkWidget *button,
     /* go back to the normal transactions list */
     gsb_reconcile_cancel (NULL, NULL);
 
+    /* reset records in etat: to do after gsb_reconcile_cancel */
+    if (etat.reconcile_final_balance) g_free (etat.reconcile_final_balance);
+    if (etat.reconcile_new_date) g_date_free (etat.reconcile_new_date);
+    etat.reconcile_final_balance = NULL;
+    etat.reconcile_new_date = NULL;
+    etat.reconcile_account_number = -1;
+
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
 
@@ -672,6 +702,11 @@ gboolean gsb_reconcile_cancel ( GtkWidget *button,
 {
     etat.equilibrage = 0;
 
+    /* save the final balance/new date for the next time the user will try to reconcile */
+    etat.reconcile_account_number = gsb_gui_navigation_get_current_account ();
+    etat.reconcile_final_balance = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_final_balance_entry ) ) );
+    etat.reconcile_new_date = gsb_parse_date_string ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_new_date_entry ) ) );
+
     /* set the normal color to the date entry */
     gsb_calendar_entry_set_color ( reconcile_new_date_entry, TRUE);
 
diff --git a/src/gsb_scheduler_list.c b/src/gsb_scheduler_list.c
index 062c239..17ed40c 100644
--- a/src/gsb_scheduler_list.c
+++ b/src/gsb_scheduler_list.c
@@ -525,8 +525,6 @@ gint gsb_scheduler_list_default_sort_function ( GtkTreeModel *model,
     gchar *date_str;
     gint number_1;
     gint number_2;
-    gint virtual_op_1 = 0;
-    gint virtual_op_2 = 0;
     gint return_value = 0;
 
     /* first, we sort by date (col 0) */
@@ -534,7 +532,6 @@ gint gsb_scheduler_list_default_sort_function ( GtkTreeModel *model,
                         iter_1,
                         COL_NB_DATE, &date_str,
                         SCHEDULER_COL_NB_TRANSACTION_NUMBER, &number_1,
-                        SCHEDULER_COL_NB_VIRTUAL_TRANSACTION, &virtual_op_1,
                         -1 );
     date_1 = gsb_parse_date_string ( date_str );
     g_free ( date_str );
@@ -543,7 +540,6 @@ gint gsb_scheduler_list_default_sort_function ( GtkTreeModel *model,
                         iter_2,
                         COL_NB_DATE, &date_str,
                         SCHEDULER_COL_NB_TRANSACTION_NUMBER, &number_2,
-                        SCHEDULER_COL_NB_VIRTUAL_TRANSACTION, &virtual_op_2,
                         -1 );
     date_2 = gsb_parse_date_string ( date_str );
     g_free ( date_str );
diff --git a/src/structures.h b/src/structures.h
index 900ffa6..48fe775 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -48,6 +48,9 @@ struct gsb_etat_t
     /* Rapprochement */
     gint reconcile_end_date;        /* Date initiale + 1 mois par défaut */
     gint equilibrage;
+    gint reconcile_account_number;  /* Save the last reconciliation try: account */
+    gchar *reconcile_final_balance; /* final balance amount */
+    GDate *reconcile_new_date;      /* new date */
 
     gboolean debug_mode;            /* TRUE in debug mode, FALSE for normale mode */
 
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index b91ac23..790d97d 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -327,6 +327,14 @@ void init_variables ( void )
     etat.utilise_logo = 1;
     gsb_select_icon_init_logo_variables ();
 
+    /* reconcile (etat) */
+    etat.reconcile_account_number = -1;
+    if ( etat.reconcile_final_balance )
+        g_free ( etat.reconcile_final_balance );
+    etat.reconcile_final_balance = NULL;
+    if ( etat.reconcile_new_date )
+        g_date_free ( etat.reconcile_new_date );
+    etat.reconcile_new_date = NULL;
 
     adresse_commune = NULL;
     adresse_secondaire = NULL;


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list