[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_2-2-gcfbc461

Philippe Delorme nobody at users.sourceforge.net
Thu Jun 2 09:50:35 CEST 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  cfbc46142131acfad0a250e815daba21275b05d7 (commit)
       via  b28d848f5a6f964d2a56841fff9b9e3bb31ed96e (commit)
      from  f47932bcd6f90e6eb0b26eb737aa6b2ccc4a2ea0 (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 cfbc46142131acfad0a250e815daba21275b05d7
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Wed May 25 18:20:29 2011 +0200

    Move loading/saving flags to run structure

commit b28d848f5a6f964d2a56841fff9b9e3bb31ed96e
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Wed May 25 07:06:13 2011 +0200

    Moved reconciliation stuff from etat to run structure
    
    Also removed useless NULL-ckecks before g_free

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

Changes:
diff --git a/src/erreur.c b/src/erreur.c
index 0ac58e4..3018a4e 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -85,19 +85,19 @@ void traitement_sigsegv ( gint signal_nb )
     /* soit on était en train de sauver un fichier, et là on peut rien faire */
     /* sinon on essaie de sauver le fichier sous le nom entouré de # */
 
-    if ( etat.en_train_de_charger || 
-	 etat.en_train_de_sauvegarder || 
+    if ( run.is_loading || 
+	 run.is_saving || 
 	 etat.modification_fichier == 0 )
     {
 
-	if ( etat.en_train_de_charger )
+	if ( run.is_loading )
 	{
 	    old_errmsg = errmsg;
 	    errmsg = g_strconcat ( errmsg, _("File is corrupted."), NULL );
 	    g_free ( old_errmsg );
 	}
 
-	if ( etat.en_train_de_sauvegarder )
+	if ( run.is_saving )
 	{
 	    old_errmsg = errmsg;
 	    errmsg = g_strconcat ( errmsg, _("Error occured saving file."), NULL );
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index afaff6e..d8c0d11 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -879,7 +879,7 @@ void gsb_file_load_general_part ( const gchar **attribute_names,
 
     else if ( !strcmp ( attribute_names[i], "Reconcile_end_date" ) )
     {
-        etat.reconcile_end_date = utils_str_atoi ( attribute_values[i] );
+        run.reconcile_end_date = utils_str_atoi ( attribute_values[i] );
     }
 
     else if ( !strcmp ( attribute_names[i],
diff --git a/src/gsb_file_save.c b/src/gsb_file_save.c
index 8ae9f83..f77ac05 100644
--- a/src/gsb_file_save.c
+++ b/src/gsb_file_save.c
@@ -241,7 +241,7 @@ gboolean gsb_file_save_save_file ( const gchar *filename,
         /* the file doesn't exist, so we will set the only user chmod */
         do_chmod = TRUE;
 
-    etat.en_train_de_sauvegarder = 1;
+    run.is_saving = TRUE;
 
     /* we begin to try to reserve enough memory to make the entire file
      * if not enough, we will make it growth later
@@ -486,7 +486,7 @@ gboolean gsb_file_save_save_file ( const gchar *filename,
 #endif /*_MSC_VER */
     }
 
-    etat.en_train_de_sauvegarder = 0;
+    run.is_saving = FALSE;
 
     return ( TRUE );
 }
@@ -800,7 +800,7 @@ gulong gsb_file_save_general_part ( gulong iterator,
 	etat.get_fusion_import_transactions,
 	etat.get_categorie_for_payee,
 	etat.get_fyear_by_value_date,
-    etat.reconcile_end_date,
+    run.reconcile_end_date,
 	etat.utilise_logo,
     my_safe_null_str( etat.name_logo ),
     etat.is_pixmaps_dir,
diff --git a/src/gsb_form.c b/src/gsb_form.c
index 82da854..d67f101 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -2585,7 +2585,7 @@ gboolean gsb_form_finish_edition ( void )
      * the amount of marked transactions */
     if ( is_transaction
 	 &&
-	 etat.equilibrage )
+	 run.equilibrage )
     {
         if (new_transaction)
             /* we are reconciling and it's a new transaction, so need to show the checkbox */
diff --git a/src/gsb_reconcile.c b/src/gsb_reconcile.c
index badcd8b..4c89268 100644
--- a/src/gsb_reconcile.c
+++ b/src/gsb_reconcile.c
@@ -385,20 +385,21 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
         gtk_entry_set_text ( GTK_ENTRY ( reconcile_number_entry ), tmpstr );
     }
 
-    /* reset records in etat if user has changed of account */
-    if (etat.reconcile_account_number != account_number)
+    /* reset records in run structure if user has changed of account */
+    if (run.reconcile_account_number != account_number)
     {
-        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;
+        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;
     }
 
     /* set last input date/amount if available */
-    if (etat.reconcile_new_date)
+    if (run.reconcile_new_date)
     {
-        date = etat.reconcile_new_date;
+        date = run.reconcile_new_date;
     }
     else
     {
@@ -417,9 +418,9 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
             g_free (string);
             g_date_add_months ( date, 1 );
 
-            /* if etat.reconcile_end_date or the new date is after today, set today */
+            /* if run.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 )
+            if ( run.reconcile_end_date || g_date_compare ( date, today) > 0 )
             {
                 g_date_free (date);
                 date = gdate_today();
@@ -457,9 +458,8 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
 
     /* 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);
+            (run.reconcile_final_balance) ? run.reconcile_final_balance : "");
+    g_free(run.reconcile_final_balance);
 
     /* set the title */
     tmpstr = g_markup_printf_escaped ( _(" <b>%s reconciliation</b> "),
@@ -469,7 +469,7 @@ gboolean gsb_reconcile_run_reconciliation ( GtkWidget *button,
     g_free ( tmpstr );
 
     /* we go to the reconciliation mode */
-    etat.equilibrage = 1;
+    run.equilibrage = 1;
 
     /* set all the balances for reconciliation */
     gsb_reconcile_update_amounts (NULL, NULL);
@@ -634,12 +634,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;
+    /* 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;
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -705,12 +706,12 @@ void gsb_reconcile_sensitive ( gboolean sensitive )
 gboolean gsb_reconcile_cancel ( GtkWidget *button,
 				        gpointer null )
 {
-    etat.equilibrage = 0;
+    run.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 ) ) );
+    run.reconcile_account_number = gsb_gui_navigation_get_current_account ();
+    run.reconcile_final_balance = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( reconcile_final_balance_entry ) ) );
+    run.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_reconcile_config.c b/src/gsb_reconcile_config.c
index b0efbec..b7e0d26 100644
--- a/src/gsb_reconcile_config.c
+++ b/src/gsb_reconcile_config.c
@@ -115,7 +115,7 @@ GtkWidget *gsb_reconcile_config_create ( void )
                         _("Start Date + one month"),
                         _("Today's date"),
                         NULL,
-                        &etat.reconcile_end_date,
+                        &run.reconcile_end_date,
                         G_CALLBACK ( gsb_reconcile_config_end_date_changed ),
                         NULL,
                         GTK_ORIENTATION_HORIZONTAL );
@@ -588,7 +588,7 @@ gboolean gsb_reconcile_config_end_date_changed ( GtkWidget *checkbutton,
                         GdkEventButton *event,
                         gpointer data )
 {
-    etat.reconcile_end_date = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( checkbutton ), "pointer" ) );
+    run.reconcile_end_date = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( checkbutton ), "pointer" ) );
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 4130f25..1a96e3a 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -540,7 +540,7 @@ static gboolean popup_transaction_view_mode_menu ( GtkWidget * button,
     menu_item = gtk_check_menu_item_new_with_label ( _("Show reconciled transactions") );
     gtk_check_menu_item_set_active ( GTK_CHECK_MENU_ITEM (menu_item),
 				        gsb_data_account_get_r ( current_account ) );
-    if ( etat.equilibrage == 1 )
+    if ( run.equilibrage == 1 )
         gtk_widget_set_sensitive ( menu_item, FALSE );
     else
         gtk_widget_set_sensitive ( menu_item, TRUE );
@@ -554,7 +554,7 @@ static gboolean popup_transaction_view_mode_menu ( GtkWidget * button,
     menu_item = gtk_check_menu_item_new_with_label ( _("Show lines archives") );
     gtk_check_menu_item_set_active ( GTK_CHECK_MENU_ITEM (menu_item),
 				        gsb_data_account_get_l ( current_account ) );
-    if ( etat.equilibrage == 1 )
+    if ( run.equilibrage == 1 )
         gtk_widget_set_sensitive ( menu_item, FALSE );
     else
         gtk_widget_set_sensitive ( menu_item, TRUE );
@@ -1513,7 +1513,7 @@ gboolean gsb_transactions_list_button_press ( GtkWidget *tree_view,
 	 &&
 	 column == find_element_col (ELEMENT_MARK)
 	 &&
-	 (( etat.equilibrage
+	 (( run.equilibrage
 	    &&
 	    line_in_transaction == find_element_line (ELEMENT_MARK))
 	  ||
@@ -1614,7 +1614,7 @@ gboolean gsb_transactions_list_key_press ( GtkWidget *widget,
         transaction_number = gsb_data_account_get_current_transaction_number ( account_number );
         if ( transaction_number > 0 )
         {
-        if ( etat.equilibrage )
+        if ( run.equilibrage )
         {
             /* we are reconciling, so mark/unmark the transaction */
             gsb_transactions_list_switch_mark ( transaction_number );
@@ -1815,7 +1815,7 @@ gboolean gsb_transactions_list_switch_mark ( gint transaction_number )
     }
 
     /* if we are reconciling, update the amounts label */
-    if ( etat.equilibrage )
+    if ( run.equilibrage )
     {
     /* pbiava 02/12/2009 : shows the balance after you mark the transaction */
     transaction_list_set_balances (  );
@@ -1864,7 +1864,7 @@ gboolean gsb_transactions_list_switch_R_mark ( gint transaction_number )
 	return FALSE;
 
     /* if we are reconciling, cancel the action */
-    if (etat.equilibrage)
+    if (run.equilibrage)
     {
         dialogue_error ( _("You cannot switch a transaction between R and non R "
                          "while reconciling.\nPlease finish or cancel the "
@@ -2301,7 +2301,7 @@ gboolean gsb_transactions_list_delete_transaction ( gint transaction_number,
     transaction_list_select (gsb_data_account_get_current_transaction_number (account_number));
 
     /* if we are reconciling, update the amounts */
-    if ( etat.equilibrage )
+    if ( run.equilibrage )
 	gsb_reconcile_update_amounts (NULL, NULL);
 
     /* we will update the home page */
@@ -2899,7 +2899,7 @@ gint gsb_transactions_list_clone_transaction ( gint transaction_number,
             list_tmp_transactions = list_tmp_transactions -> next;
         }
     }
-    if ( etat.equilibrage )
+    if ( run.equilibrage )
         transaction_list_show_toggle_mark ( TRUE );
 
     return new_transaction_number;
@@ -3058,7 +3058,7 @@ void schedule_selected_transaction ()
 
     mise_a_jour_liste_echeances_auto_accueil = 1;
 
-    if ( etat.equilibrage == 0 )
+    if ( run.equilibrage == 0 )
     {
         gsb_gui_navigation_set_selection (GSB_SCHEDULER_PAGE, 0, NULL);
         gsb_scheduler_list_select (scheduled_number);
diff --git a/src/menu.c b/src/menu.c
index 62a135a..56b9b41 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -612,7 +612,7 @@ gboolean gsb_gui_toggle_show_reconciled ( void )
 	    return FALSE;
 
     current_account = gsb_gui_navigation_get_current_account ( );
-    if ( current_account == -1 || etat.equilibrage == 1 )
+    if ( current_account == -1 || run.equilibrage == 1 )
         return FALSE;
 
     if ( gsb_data_account_get_r ( current_account ) )
diff --git a/src/structures.h b/src/structures.h
index b67973c..d847590 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -34,13 +34,6 @@ struct gsb_etat_t
     time_t modification_fichier;
     gint is_archive;                /** TRUE if the file is an archive, FALSE else */
 
-    /* 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 */
 
     /* files and backup part */
@@ -53,8 +46,6 @@ struct gsb_etat_t
     gint affiche_nb_ecritures_listes;
     gint largeur_auto_colonnes;
     gint retient_affichage_par_compte;      /* à 1 si les caractéristiques de l'affichage (R, non R ...) diffèrent par compte */
-    gint en_train_de_sauvegarder;
-    gint en_train_de_charger;
 
     /* Fonts & logo */
     gint utilise_logo;
@@ -211,10 +202,19 @@ struct gsb_run_t
     /* initialisation variables */
     gboolean new_crypted_file;      /* 0 à l'exécution de init_variables () 1 si new crypted file*/
 
+    gboolean is_saving;
+    gboolean is_loading;
+
     /* largeur des colonnes */
     gchar *transaction_column_width;
     gchar *scheduler_column_width;
 
+    /* reconciliation */
+    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 */
 };
 
 /* declared in main.c */
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index 526f463..a0830a4 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -383,13 +383,12 @@ void init_variables ( void )
     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;
+    run.reconcile_account_number = -1;
+    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;
 
     adresse_commune = NULL;
     adresse_secondaire = NULL;


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list