[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_2-8-ga3fef2a
Philippe Delorme
nobody at users.sourceforge.net
Wed Jun 8 00:29:23 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 a3fef2a129309036a43e3fe9637f3593f64bf088 (commit)
from 7febcac4ae3d98fcc056b3365785d5772676c883 (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 a3fef2a129309036a43e3fe9637f3593f64bf088
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date: Wed Jun 8 00:23:18 2011 +0200
Simplify file modification calls
-----------------------------------------------------------------------
Changes:
diff --git a/src/affichage.c b/src/affichage.c
index ec928b0..64d00ab 100644
--- a/src/affichage.c
+++ b/src/affichage.c
@@ -319,8 +319,7 @@ gboolean change_choix_utilise_logo ( GtkWidget *check_button,
etat.is_pixmaps_dir = 0;
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return ( FALSE );
}
@@ -572,8 +571,7 @@ void change_logo_accueil ( GtkWidget * file_selector )
gtk_container_add ( GTK_CONTAINER ( logo_button ), preview );
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
/* **************************************************************************************************************************** */
@@ -678,8 +676,7 @@ gboolean update_homepage_title (GtkEntry *entry, gchar *value,
gsb_main_set_grisbi_title ( -1 );
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/affichage_liste.c b/src/affichage_liste.c
index d18e689..6c45956 100644
--- a/src/affichage_liste.c
+++ b/src/affichage_liste.c
@@ -276,8 +276,7 @@ gboolean gsb_transactions_list_display_sort_changed ( GtkWidget *checkbutton,
value = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( checkbutton ), "pointer" ) );
*pointeur = value;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
switch ( page_number )
@@ -325,8 +324,7 @@ static gboolean display_mode_button_changed ( GtkWidget *button,
/* update the visible account */
gsb_transactions_list_update_tree_view (gsb_gui_navigation_get_current_account (), TRUE);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1065,8 +1063,7 @@ gboolean gsb_transaction_list_config_drag_end ( GtkWidget *tree_view,
recuperation_noms_colonnes_et_tips ( );
update_titres_tree_view ( );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return (FALSE);
}
@@ -1334,8 +1331,7 @@ void gsb_transaction_list_config_toggle_element_button ( GtkWidget *toggle_butto
recuperation_noms_colonnes_et_tips ( );
update_titres_tree_view ( );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
diff --git a/src/bet_config.c b/src/bet_config.c
index 4391a9a..e3484a8 100644
--- a/src/bet_config.c
+++ b/src/bet_config.c
@@ -233,8 +233,7 @@ gboolean bet_config_general_cash_account_option_clicked ( GtkWidget *checkbutton
bet_data_select_bet_pages ( gsb_gui_navigation_get_current_account ( ) );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -783,8 +782,7 @@ void bet_config_period_clicked ( GtkWidget *togglebutton, GdkEventButton *event,
G_CALLBACK ( bet_config_period_clicked ),
button );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -851,8 +849,7 @@ void bet_config_duration_button_clicked ( GtkWidget *togglebutton,
G_CALLBACK ( bet_config_duration_number_changed ),
data );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
bet_data_update_bet_module ( account_number, -1 );
@@ -882,8 +879,7 @@ gboolean bet_config_duration_number_changed ( GtkWidget *spin_button,
gsb_data_account_set_bet_months ( account_number, months );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
bet_data_update_bet_module ( account_number, -1 );
@@ -947,8 +943,7 @@ void bet_config_origin_data_clicked ( GtkWidget *togglebutton, GdkEventButton *e
gtk_tree_view_column_set_title ( GTK_TREE_VIEW_COLUMN ( column ), title );
g_free ( title );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
bet_data_update_bet_module ( account_number, -1 );
@@ -973,8 +968,7 @@ void bet_config_fyear_clicked ( GtkWidget *combo, gpointer data )
gsb_data_account_set_bet_hist_fyear ( account_number,
bet_historical_get_fyear_from_combobox ( combo ) );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
bet_data_update_bet_module ( account_number, -1 );
@@ -1100,8 +1094,7 @@ gboolean bet_config_select_label_changed ( GtkWidget *checkbutton,
gsb_data_account_set_bet_select_label ( account_number, origine, value );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
bet_data_update_bet_module ( account_number, -1 );
@@ -1499,8 +1492,7 @@ void bet_config_finance_apply_clicked ( GtkButton *button, GtkWidget *parent )
type_taux = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( bouton ) );
gsb_data_account_set_bet_finance_type_taux ( account_number, type_taux );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
bet_finance_ui_update_amortization_tab ( account_number );
}
diff --git a/src/bet_data.c b/src/bet_data.c
index d37d650..7e0ab4d 100644
--- a/src/bet_data.c
+++ b/src/bet_data.c
@@ -1193,8 +1193,7 @@ gboolean bet_data_future_add_lines ( struct_futur_data *scheduled )
g_date_free ( date_max );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -1432,8 +1431,7 @@ gboolean bet_data_future_remove_line ( gint account_number, gint number, gboolea
break;
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
if ( maj )
{
@@ -1480,8 +1478,7 @@ gboolean bet_data_future_remove_lines ( gint account_number,
g_hash_table_iter_remove ( &iter );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1531,8 +1528,7 @@ gboolean bet_data_future_modify_lines ( struct_futur_data *scheduled )
g_hash_table_replace ( bet_future_list, key, scheduled );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -1620,8 +1616,7 @@ gboolean bet_data_transfert_add_line ( struct_transfert_data *transfert )
transfert -> number = transfert_number;
g_hash_table_insert ( bet_transfert_list, key, transfert );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -1653,8 +1648,7 @@ gboolean bet_data_transfert_remove_line ( gint account_number, gint number )
break;
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
@@ -1698,8 +1692,7 @@ gboolean bet_data_transfert_modify_line ( struct_transfert_data *transfert )
g_hash_table_replace ( bet_transfert_list, key, transfert );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
diff --git a/src/bet_finance_ui.c b/src/bet_finance_ui.c
index ba80849..256e792 100644
--- a/src/bet_finance_ui.c
+++ b/src/bet_finance_ui.c
@@ -780,8 +780,7 @@ void bet_finance_calculer_clicked ( GtkButton *button, GtkWidget *widget )
gtk_tree_path_free ( path );
g_free ( s_echeance );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
diff --git a/src/bet_hist.c b/src/bet_hist.c
index 4a0a572..efebe2e 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -345,8 +345,7 @@ gboolean bet_historical_div_toggle_clicked ( GtkCellRendererToggle *renderer,
bet_data_update_bet_module ( account_number, GSB_HISTORICAL_PAGE );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -461,8 +460,7 @@ void bet_historical_div_cell_edited (GtkCellRendererText *cell,
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
@@ -1538,8 +1536,7 @@ void bet_historical_add_last_amount ( GtkWidget *menu_item,
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
diff --git a/src/bet_tab.c b/src/bet_tab.c
index 176b4b9..0f737a5 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -2020,8 +2020,7 @@ gboolean bet_array_start_date_focus_out ( GtkWidget *entry,
gsb_data_account_set_bet_start_date ( account_number, date );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ESTIMATE );
bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
@@ -2302,8 +2301,7 @@ void bet_array_list_schedule_selected_line ( GtkWidget *menu_item,
gsb_scheduler_list_select ( scheduled_number );
gsb_scheduler_list_edit_transaction ( scheduled_number );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -2571,8 +2569,7 @@ void bet_array_auto_inc_month_toggle ( GtkToggleButton *togglebutton, gpointer
bet_data_update_bet_module ( account_number, GSB_ESTIMATE_PAGE );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
diff --git a/src/categories_onglet.c b/src/categories_onglet.c
index a448e7a..92d1be4 100644
--- a/src/categories_onglet.c
+++ b/src/categories_onglet.c
@@ -831,9 +831,7 @@ gboolean edit_category ( GtkTreeView *tree_view )
/* update the transactions list */
transaction_list_update_element (ELEMENT_CATEGORY);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
-
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
diff --git a/src/erreur.c b/src/erreur.c
index 3018a4e..0664f9b 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -87,7 +87,7 @@ void traitement_sigsegv ( gint signal_nb )
if ( run.is_loading ||
run.is_saving ||
- etat.modification_fichier == 0 )
+ !gsb_file_get_modified ( ) )
{
if ( run.is_loading )
diff --git a/src/etats_config.c b/src/etats_config.c
index 7a0ab95..9cf78df 100644
--- a/src/etats_config.c
+++ b/src/etats_config.c
@@ -1905,8 +1905,7 @@ void recuperation_info_perso_etat ( void )
/* update the payee combofix in the form, to add that report if asked */
gsb_form_widget_update_payee_combofix ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* on réaffiche l'état */
rafraichissement_etat ( gsb_gui_navigation_get_current_report ());
diff --git a/src/etats_onglet.c b/src/etats_onglet.c
index c3a5880..55e68e3 100644
--- a/src/etats_onglet.c
+++ b/src/etats_onglet.c
@@ -858,8 +858,7 @@ gboolean ajout_etat ( void )
gsb_gui_update_gui_to_report ( report_number );
personnalisation_etat ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -966,9 +965,7 @@ void efface_etat ( void )
gsb_gui_unsensitive_report_widgets ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
-
+ gsb_file_set_modified ( TRUE );
}
@@ -1273,8 +1270,7 @@ void dupliquer_etat ( void )
gsb_gui_update_gui_to_report ( report_number );
personnalisation_etat ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
diff --git a/src/gsb_account.c b/src/gsb_account.c
index 410cf22..15c91ad 100644
--- a/src/gsb_account.c
+++ b/src/gsb_account.c
@@ -145,8 +145,7 @@ gboolean gsb_account_new ( kind_account account_type,
gsb_account_property_fill_page ();
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -183,7 +182,7 @@ gboolean gsb_account_delete ( void )
/* if the last account, close the file */
if ( gsb_data_account_get_accounts_amount () == 1 )
{
- modification_fichier ( FALSE );
+ gsb_file_set_modified ( FALSE );
gsb_file_close ();
return FALSE;
}
@@ -288,8 +287,7 @@ gboolean gsb_account_delete ( void )
/* Update navigation pane. */
gsb_gui_navigation_remove_account ( deleted_account );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_account_property.c b/src/gsb_account_property.c
index 006c87a..6d20234 100644
--- a/src/gsb_account_property.c
+++ b/src/gsb_account_property.c
@@ -1041,8 +1041,7 @@ gboolean gsb_account_property_iban_key_press_event ( GtkWidget *entry,
current_account = gsb_gui_navigation_get_current_account ();
gsb_data_account_set_bank_account_iban ( current_account, iban );
gsb_account_property_iban_set_bank_from_iban ( iban );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
if ( iban && strlen (iban) > 0 )
@@ -1099,8 +1098,7 @@ gboolean gsb_account_property_iban_focus_out_event ( GtkWidget *entry,
{
gsb_data_account_set_bank_account_iban ( current_account, iban );
gsb_account_property_iban_set_bank_from_iban ( iban );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
if ( iban && strlen (iban) > 0 )
diff --git a/src/gsb_archive_config.c b/src/gsb_archive_config.c
index 20279a3..cfbf96c 100644
--- a/src/gsb_archive_config.c
+++ b/src/gsb_archive_config.c
@@ -482,8 +482,7 @@ static gboolean gsb_archive_config_delete_archive ( GtkWidget *button,
/* remove from the list */
gtk_list_store_remove ( GTK_LIST_STORE (model), &iter );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
@@ -602,8 +601,7 @@ static gboolean gsb_archive_config_destroy_archive ( GtkWidget *button,
transaction_list_set_balances ();
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
diff --git a/src/gsb_assistant_archive.c b/src/gsb_assistant_archive.c
index 6fc8a95..021ef5d 100644
--- a/src/gsb_assistant_archive.c
+++ b/src/gsb_assistant_archive.c
@@ -762,8 +762,7 @@ static gboolean gsb_assistant_archive_switch_to_success ( GtkWidget *assistant,
gsb_assistant_sensitive_button_prev ( assistant, TRUE );
gsb_assistant_sensitive_button_next ( assistant, TRUE );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* update the display of tree_view if necessary */
if ( ( account_nb = gsb_gui_navigation_get_current_account ( ) ) != -1 )
diff --git a/src/gsb_autofunc.c b/src/gsb_autofunc.c
index 6422482..8d54449 100644
--- a/src/gsb_autofunc.c
+++ b/src/gsb_autofunc.c
@@ -206,8 +206,7 @@ static gboolean gsb_autofunc_entry_changed ( GtkWidget *entry,
gtk_entry_get_text ( GTK_ENTRY (entry)));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -337,8 +336,7 @@ static gboolean gsb_autofunc_textview_changed ( GtkTextBuffer *buffer,
gtk_text_buffer_get_text (buffer, &start, &end, 0));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -512,8 +510,7 @@ static gboolean gsb_autofunc_int_changed ( GtkWidget *entry,
utils_str_atoi (gtk_entry_get_text ( GTK_ENTRY (entry))));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -645,8 +642,7 @@ static gboolean gsb_autofunc_spin_changed ( GtkWidget *spin_button,
gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON (spin_button)));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -772,8 +768,7 @@ static gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1028,8 +1023,7 @@ static gboolean gsb_autofunc_date_changed ( GtkWidget *entry,
g_date_free (date);
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1163,8 +1157,7 @@ static gboolean gsb_autofunc_real_changed ( GtkWidget *entry,
gsb_real_get_from_string (gtk_entry_get_text (GTK_ENTRY (entry))));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1294,8 +1287,7 @@ static gboolean gsb_autofunc_combobox_changed ( GtkWidget *combobox,
gsb_combo_box_get_index (combobox));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1428,8 +1420,7 @@ gboolean gsb_autofunc_currency_changed ( GtkWidget *combobox,
gsb_currency_get_currency_from_combobox (combobox));
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_automem.c b/src/gsb_automem.c
index 9daab58..3848541 100644
--- a/src/gsb_automem.c
+++ b/src/gsb_automem.c
@@ -170,8 +170,7 @@ static gboolean gsb_automem_entry_changed (GtkWidget *entry,
if ( *data )
g_free ( *data );
*data = my_strdup (gtk_entry_get_text ( GTK_ENTRY (entry) ));
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
@@ -290,8 +289,7 @@ static gboolean gsb_automem_textview_changed ( GtkTextBuffer *buffer,
if (data)
{
*data = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
@@ -397,8 +395,7 @@ static gboolean gsb_automem_checkbutton_changed ( GtkWidget *checkbutton,
if (value)
{
*value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton));
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
@@ -775,8 +772,7 @@ static gboolean gsb_automem_spin_button_changed ( GtkWidget *spin,
if ( data )
{
*data = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(spin));
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return (FALSE);
diff --git a/src/gsb_bank.c b/src/gsb_bank.c
index 01c924b..ceb89e7 100644
--- a/src/gsb_bank.c
+++ b/src/gsb_bank.c
@@ -417,8 +417,7 @@ static gboolean gsb_bank_list_changed ( GtkWidget *combobox,
{
gsb_data_account_set_bank ( gsb_gui_navigation_get_current_account ( ), bank_number );
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1075,8 +1074,7 @@ static gboolean gsb_bank_edit_bank ( gint bank_number,
gsb_bank_list_set_bank ( combobox, bank_number );
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
else
{
@@ -1209,8 +1207,7 @@ static gboolean gsb_bank_add ( GtkWidget *button,
gsb_bank_edit_bank ( bank_number, button );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1285,15 +1282,12 @@ static gboolean gsb_bank_delete ( GtkWidget *button,
gtk_list_store_remove ( GTK_LIST_STORE (model),
&iter );
gsb_data_bank_remove (bank_number);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
}
/* remove the bank from the combobox list */
gsb_bank_update_selected_line_model (NULL);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_currency_config.c b/src/gsb_currency_config.c
index babb8b7..f172ed5 100644
--- a/src/gsb_currency_config.c
+++ b/src/gsb_currency_config.c
@@ -747,8 +747,7 @@ gboolean gsb_currency_config_entry_changed ( GtkWidget *entry,
CURRENCY_FLOATING_COLUMN, gsb_data_currency_get_floating_point (currency_number),
-1);
gsb_currency_update_combobox_currency_list ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -913,8 +912,7 @@ gboolean gsb_currency_config_set_int_from_combobox ( GtkWidget *combobox, gint *
}
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return (FALSE);
}
@@ -1071,8 +1069,7 @@ dialog_return:
gsb_currency_append_currency_to_list ( GTK_LIST_STORE ( currency_tree_model ),
currency_number );
gtk_widget_destroy ( GTK_WIDGET ( dialog ));
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
}
diff --git a/src/gsb_currency_link_config.c b/src/gsb_currency_link_config.c
index 4158557..f82f6e1 100644
--- a/src/gsb_currency_link_config.c
+++ b/src/gsb_currency_link_config.c
@@ -588,8 +588,7 @@ gboolean gsb_currency_link_config_modify_link ( GtkWidget *tree_view )
else
gtk_widget_hide (label);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gsb_gui_navigation_update_home_page ( );
return FALSE;
@@ -627,8 +626,7 @@ gboolean gsb_currency_link_config_add_link ( GtkWidget *tree_view )
&iter );
gtk_tree_selection_select_iter ( gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&iter );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -672,8 +670,7 @@ gboolean gsb_currency_link_config_remove_link ( GtkWidget *tree_view )
if ( GTK_WIDGET_VISIBLE ( label ) )
gtk_widget_hide (label);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
diff --git a/src/gsb_data_account.c b/src/gsb_data_account.c
index 46abcb0..b3dd7f5 100644
--- a/src/gsb_data_account.c
+++ b/src/gsb_data_account.c
@@ -2337,8 +2337,7 @@ gboolean gsb_data_account_reorder ( GSList *new_order )
g_slist_free (last_list);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -2735,8 +2734,7 @@ void gsb_data_account_change_account_icon ( GtkWidget *button, gpointer data )
gtk_button_set_image ( GTK_BUTTON ( button ), image );
gsb_gui_navigation_update_account ( current_account );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
diff --git a/src/gsb_debug.c b/src/gsb_debug.c
index 9858d2a..81cb985 100644
--- a/src/gsb_debug.c
+++ b/src/gsb_debug.c
@@ -335,8 +335,7 @@ gboolean gsb_debug_try_fix ( gboolean (* fix) () )
if ( fix () )
{
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
dialogue_hint ( _("Grisbi successfully repaired this account file. "
"You may now save your modifications."),
_("Fix completed"));
diff --git a/src/gsb_file.c b/src/gsb_file.c
index a27e6b9..561df83 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -153,8 +153,7 @@ gboolean gsb_file_new_finish ( void )
mise_a_jour_accueil ( TRUE );
gsb_gui_navigation_set_selection ( GSB_HOME_PAGE, -1, NULL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -387,7 +386,7 @@ gboolean gsb_file_open_file ( gchar *filename )
if ( conf.sauvegarde_demarrage )
{
gsb_file_save_backup ();
- etat.modification_fichier = FALSE;
+ gsb_file_set_modified ( FALSE );
}
}
else
@@ -482,7 +481,7 @@ gboolean gsb_file_open_file ( gchar *filename )
/* for now, the flag for modification of the file is ok, but the menu couldn't be set
* as sensitive/unsensitive so do it now */
- modification_fichier (etat.modification_fichier != 0);
+ gsb_file_set_modified ( gsb_file_get_modified ( ) );
gsb_status_message ( _("Done") );
gsb_status_stop_wait ( TRUE );
@@ -535,7 +534,7 @@ gboolean gsb_file_save_file ( gint origine )
etat_force = 0;
- if ( ( !etat.modification_fichier && origine != -2 ) ||
+ if ( ( !gsb_file_get_modified ( ) && origine != -2 ) ||
!gsb_data_account_get_accounts_amount () )
{
notice_debug ( "nothing done in gsb_file_save_file" );
@@ -603,7 +602,7 @@ gboolean gsb_file_save_file ( gint origine )
/* update variables */
etat.fichier_deja_ouvert = 0;
- modification_fichier ( FALSE );
+ gsb_file_set_modified ( FALSE );
gsb_main_set_grisbi_title ( gsb_gui_navigation_get_current_account ( ) );
gsb_file_append_name_to_opened_list ( nom_fichier_comptes );
}
@@ -631,7 +630,7 @@ gboolean gsb_file_save_backup ( void )
if (!gsb_file_get_backup_path ()
||
- !etat.modification_fichier )
+ !gsb_file_get_modified ( ) )
return FALSE;
gsb_status_message ( _("Saving backup") );
@@ -784,14 +783,14 @@ static gint gsb_file_dialog_save ( void )
time_t now = time ( NULL );
gint result;
GtkWidget *dialog;
- gint difference = (gint) difftime ( now, etat.modification_fichier );
+ gint difference = (gint) difftime ( now, run.file_modification );
gchar* message;
gchar* tmpstr1;
gchar* tmpstr2;
/* si le fichier n'est pas modifié on renvoie qu'on ne veut pas enregistrer */
- if ( !etat.modification_fichier )
+ if ( ! gsb_file_get_modified ( ) )
return GTK_RESPONSE_NO;
if ( conf.sauvegarde_auto &&
@@ -1173,6 +1172,54 @@ void gsb_file_save_remove_old_file ( gchar *filename )
g_unlink ( filename );
gtk_widget_destroy ( GTK_WIDGET ( dialog ) );
}
+
+
+/**
+ * set or unset the modified flag (run structure)
+ * and sensitive or not the menu to save the file
+ *
+ * \param modif TRUE to set the modified flag, FALSE to unset
+ *
+ * \return
+ */
+void gsb_file_set_modified ( gboolean modified )
+{
+ devel_debug_int (modified);
+
+ /* If no file is loaded, do not change menu items. */
+ if ( ! gsb_data_account_get_accounts_amount () )
+ return;
+
+ if ( modified )
+ {
+ if ( ! run.file_modification )
+ {
+ run.file_modification = time ( NULL );
+ gsb_gui_sensitive_menu_item ( "/menubar/FileMenu/Save", TRUE );
+ }
+ }
+ else
+ {
+ run.file_modification = 0;
+ gsb_gui_sensitive_menu_item ( "/menubar/FileMenu/Save", FALSE );
+ }
+}
+
+
+/**
+ * Tell if the current file has been modified or not
+ *
+ * \return TRUE if modified, FALSE otherwise
+ */
+gboolean gsb_file_get_modified ( void )
+{
+ if ( run.file_modification == 0 )
+ return FALSE;
+ else
+ return TRUE;
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
diff --git a/src/gsb_file.h b/src/gsb_file.h
index 8fa5fec..21d6153 100644
--- a/src/gsb_file.h
+++ b/src/gsb_file.h
@@ -27,5 +27,7 @@ gboolean gsb_file_save ( void );
gboolean gsb_file_save_as ( void );
void gsb_file_set_backup_path ( const gchar *path );
void gsb_file_update_last_path ( const gchar *last_path );
+void gsb_file_set_modified ( gboolean modified );
+gboolean gsb_file_get_modified ( void );
/* END_DECLARATION */
#endif
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index 858cbc5..35db44e 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -8118,7 +8118,7 @@ gboolean gsb_file_load_update_previous_version ( void )
g_free ( tmpstr );
/* for now the file is not modified */
- modification_fichier ( FALSE );
+ gsb_file_set_modified ( FALSE );
switch ( version_number )
{
@@ -8865,8 +8865,7 @@ gboolean gsb_file_load_update_previous_version ( void )
/* to set just before the new version */
/* ********************************************************* */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* ************************************* */
/* opening 0.6.0 */
@@ -8878,7 +8877,7 @@ gboolean gsb_file_load_update_previous_version ( void )
case 60:
if ( conf.sauvegarde_demarrage )
- etat.modification_fichier = TRUE;
+ gsb_file_set_modified ( TRUE );
break;
default :
diff --git a/src/gsb_file_others.c b/src/gsb_file_others.c
index e73bcfe..5f4d468 100644
--- a/src/gsb_file_others.c
+++ b/src/gsb_file_others.c
@@ -587,8 +587,7 @@ gboolean gsb_file_others_load ( gchar *filename,
g_free (markup_parser);
g_free (file_content);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
else
{
@@ -835,8 +834,7 @@ gboolean gsb_file_others_load_budget_from_category ( const gchar *filename )
g_free ( markup_parser );
g_free ( file_content );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
else
{
diff --git a/src/gsb_form.c b/src/gsb_form.c
index d67f101..c016d1a 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -2690,8 +2690,7 @@ gboolean gsb_form_finish_edition ( void )
/* force the update module budget */
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* If the origin of the operation is a model, so we select the new transaction */
if ( GPOINTER_TO_INT (g_object_get_data ( G_OBJECT ( transaction_form ),
diff --git a/src/gsb_form_config.c b/src/gsb_form_config.c
index 3303c62..761adcb 100644
--- a/src/gsb_form_config.c
+++ b/src/gsb_form_config.c
@@ -728,8 +728,7 @@ gboolean gsb_form_config_toggle_element_button ( GtkWidget *toggle_button )
gsb_form_config_fill_store (account_number);
gsb_form_create_widgets ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -846,8 +845,7 @@ gboolean gsb_form_config_change_column_size ( GtkWidget *tree_view,
}
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* update the form if needed */
saved_allocation_size = 0;
@@ -881,8 +879,7 @@ gboolean gsb_form_config_add_line ( void )
gsb_form_config_fill_store (account_number);
gsb_form_create_widgets ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -957,8 +954,7 @@ gboolean gsb_form_config_remove_line ( void )
gsb_form_config_fill_store (account_number);
gsb_form_create_widgets ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -996,8 +992,7 @@ gboolean gsb_form_config_add_column ( void )
/* show the result */
gsb_form_config_realized ( form_config_tree_view, NULL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1078,8 +1073,7 @@ gboolean gsb_form_config_remove_column ( void )
/* fill the list */
gsb_form_config_realized ( form_config_tree_view, NULL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1263,8 +1257,7 @@ gboolean gsb_form_config_drag_end ( GtkWidget *tree_view,
gsb_form_config_fill_store (account_number);
gsb_form_fill_from_account (account_number);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return (FALSE);
}
diff --git a/src/gsb_fyear_config.c b/src/gsb_fyear_config.c
index 0e91e63..46c76c8 100644
--- a/src/gsb_fyear_config.c
+++ b/src/gsb_fyear_config.c
@@ -555,8 +555,7 @@ gboolean gsb_fyear_config_modify_fyear ( GtkWidget *entry,
FYEAR_INVALID_COLUMN, invalid,
FYEAR_NUMBER_COLUMN, fyear_number,
-1 );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -652,8 +651,7 @@ gboolean gsb_fyear_config_add_fyear ( GtkWidget *tree_view )
/* Update various menus */
gsb_fyear_update_fyear_list ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -744,8 +742,7 @@ gboolean gsb_fyear_config_remove_fyear ( GtkWidget *tree_view )
/* Update various menus */
gsb_fyear_update_fyear_list ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
@@ -801,8 +798,7 @@ gboolean gsb_fyear_config_associate_transactions ( void )
dialogue ( tmpstr );
g_free ( tmpstr );
transaction_list_update_element (ELEMENT_EXERCICE);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
else
dialogue ( _("no transaction to associate"));
diff --git a/src/gsb_payment_method_config.c b/src/gsb_payment_method_config.c
index a702ca4..7346bfc 100644
--- a/src/gsb_payment_method_config.c
+++ b/src/gsb_payment_method_config.c
@@ -673,8 +673,7 @@ gboolean gsb_payment_method_config_toggled ( GtkCellRendererToggle *cell,
/* clean up */
gtk_tree_path_free (path);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1152,8 +1151,7 @@ gboolean gsb_payment_method_config_add ( GtkWidget *button,
gsb_reconcile_sort_config_fill ();
/* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1247,8 +1245,7 @@ gboolean gsb_payment_method_config_remove ( GtkWidget *button,
gtk_tree_store_remove ( GTK_TREE_STORE(model), &iter );
gsb_data_payment_remove (payment_number);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_reconcile.c b/src/gsb_reconcile.c
index 4c89268..6aa8ee4 100644
--- a/src/gsb_reconcile.c
+++ b/src/gsb_reconcile.c
@@ -642,8 +642,7 @@ gboolean gsb_reconcile_finish_reconciliation ( GtkWidget *button,
run.reconcile_new_date = NULL;
run.reconcile_account_number = -1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
if ( reconcile_save_last_scheduled_convert )
{
diff --git a/src/gsb_reconcile_config.c b/src/gsb_reconcile_config.c
index b7e0d26..6c7894c 100644
--- a/src/gsb_reconcile_config.c
+++ b/src/gsb_reconcile_config.c
@@ -557,8 +557,7 @@ gboolean gsb_reconcile_config_delete ( GtkWidget *button,
/* update the last statement for that account */
gsb_navigation_update_statement_label (account_number);
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
@@ -590,8 +589,7 @@ gboolean gsb_reconcile_config_end_date_changed ( GtkWidget *checkbutton,
{
run.reconcile_end_date = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( checkbutton ), "pointer" ) );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_reconcile_sort_config.c b/src/gsb_reconcile_sort_config.c
index 490d224..512c51f 100644
--- a/src/gsb_reconcile_sort_config.c
+++ b/src/gsb_reconcile_sort_config.c
@@ -593,8 +593,7 @@ gboolean gsb_reconcile_sort_config_payment_toggled ( GtkCellRendererToggle *cell
gtk_tree_view_collapse_row ( GTK_TREE_VIEW(tree_view), treepath );
gtk_tree_path_free ( treepath );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -666,8 +665,7 @@ gboolean gsb_reconcile_sort_config_neutral_toggled ( GtkCellRendererToggle *cell
}
g_slist_free (sorted_list_copy);
gsb_reconcile_sort_config_fill ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_scheduler.c b/src/gsb_scheduler.c
index b02a046..c795105 100644
--- a/src/gsb_scheduler.c
+++ b/src/gsb_scheduler.c
@@ -545,8 +545,7 @@ void gsb_scheduler_check_scheduled_transactions_time_limit ( void )
if ( automatic_transactions_taken )
{
mise_a_jour_liste_echeances_auto_accueil = 1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
if ( scheduled_transactions_to_take )
diff --git a/src/gsb_scheduler_list.c b/src/gsb_scheduler_list.c
index 8a6ca3f..9d6e4c7 100644
--- a/src/gsb_scheduler_list.c
+++ b/src/gsb_scheduler_list.c
@@ -2075,8 +2075,7 @@ gboolean gsb_scheduler_list_delete_scheduled_transaction ( gint scheduled_number
gsb_calendar_update ();
mise_a_jour_liste_echeances_manuelles_accueil = 1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2115,8 +2114,7 @@ gboolean gsb_scheduler_list_change_scheduler_view ( enum scheduler_periodicity p
gsb_scheduler_list_set_background_color (gsb_scheduler_list_get_tree_view ());
gsb_scheduler_list_select (-1);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2427,8 +2425,7 @@ gboolean gsb_scheduler_list_clone_selected_scheduled ( GtkWidget *menu_item,
gsb_scheduler_list_set_background_color ( gsb_scheduler_list_get_tree_view ( ) );
gsb_scheduler_list_select ( new_scheduled_number );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 692714a..ad8ee75 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -1823,8 +1823,7 @@ gboolean gsb_transactions_list_switch_mark ( gint transaction_number )
gsb_navigation_update_statement_label ( account_number );
mise_a_jour_liste_comptes_accueil = 1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1977,8 +1976,7 @@ gboolean gsb_transactions_list_switch_R_mark ( gint transaction_number )
/* need to update the marked amount on the home page */
mise_a_jour_liste_comptes_accueil = 1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2311,8 +2309,7 @@ gboolean gsb_transactions_list_delete_transaction ( gint transaction_number,
if (show_warning)
gsb_form_escape_form ();
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return TRUE;
}
@@ -2705,8 +2702,7 @@ gboolean gsb_gui_change_cell_content ( GtkWidget * item, gint *element_ptr )
gsb_data_account_get_sort_type ( current_account ) );
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2788,8 +2784,7 @@ gboolean clone_selected_transaction ( GtkWidget *menu_item,
/* force the update module budget */
gsb_data_account_set_bet_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ALL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2826,8 +2821,7 @@ static gboolean gsb_transactions_list_clone_template ( GtkWidget *menu_item,
/* force the update module budget */
gsb_data_account_set_bet_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ALL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -2939,8 +2933,7 @@ gboolean move_selected_operation_to_account ( GtkMenuItem * menu_item,
mise_a_jour_accueil (FALSE);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
@@ -2972,8 +2965,7 @@ void move_selected_operation_to_account_nb ( gint *account )
gsb_data_account_colorize_current_balance ( source_account );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
}
@@ -3069,8 +3061,7 @@ void schedule_selected_transaction ()
else
gsb_reconcile_set_last_scheduled_transaction ( scheduled_number );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -3556,8 +3547,7 @@ gboolean gsb_transactions_list_change_sort_column ( GtkTreeViewColumn *tree_view
transaction_list_set_color_jour ( account_number );
transaction_list_select (selected_transaction);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -4225,8 +4215,7 @@ gboolean gsb_transactions_list_change_alignement ( GtkWidget *menu_item,
"xalign", xalign,
NULL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -4278,7 +4267,7 @@ gboolean change_aspect_liste ( gint demande )
{
case 0:
/* not used */
- break;
+ return ( TRUE );
/* 1, 2, 3 et 4 sont les nb de lignes qu'on demande à afficher */
@@ -4288,8 +4277,6 @@ gboolean change_aspect_liste ( gint demande )
"/menubar/ViewMenu/ShowOneLine" ) ),
TRUE );
gsb_transactions_list_set_visible_rows_number ( demande );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
break;
case 2 :
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4297,8 +4284,6 @@ gboolean change_aspect_liste ( gint demande )
"/menubar/ViewMenu/ShowTwoLines" ) ),
TRUE );
gsb_transactions_list_set_visible_rows_number ( demande );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
break;
case 3 :
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4306,8 +4291,6 @@ gboolean change_aspect_liste ( gint demande )
"/menubar/ViewMenu/ShowThreeLines" ) ),
TRUE );
gsb_transactions_list_set_visible_rows_number ( demande );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
break;
case 4 :
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4315,8 +4298,6 @@ gboolean change_aspect_liste ( gint demande )
"/menubar/ViewMenu/ShowFourLines" ) ),
TRUE );
gsb_transactions_list_set_visible_rows_number ( demande );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
break;
case 5 :
@@ -4324,8 +4305,6 @@ gboolean change_aspect_liste ( gint demande )
/* ope avec r */
mise_a_jour_affichage_r ( 1 );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
gsb_menu_set_block_menu_cb ( TRUE );
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4341,8 +4320,6 @@ gboolean change_aspect_liste ( gint demande )
/* ope sans r */
mise_a_jour_affichage_r ( 0 );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
gsb_menu_set_block_menu_cb ( TRUE );
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4357,8 +4334,6 @@ gboolean change_aspect_liste ( gint demande )
/* show archive lines */
gsb_transactions_list_show_archives_lines ( 1 );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
gsb_menu_set_block_menu_cb ( TRUE );
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4374,8 +4349,6 @@ gboolean change_aspect_liste ( gint demande )
/* hide archive lines */
gsb_transactions_list_show_archives_lines ( 0 );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
gsb_menu_set_block_menu_cb ( TRUE );
gtk_toggle_action_set_active ( GTK_TOGGLE_ACTION (
@@ -4387,6 +4360,7 @@ gboolean change_aspect_liste ( gint demande )
break;
}
+ gsb_file_set_modified ( TRUE );
return ( TRUE );
}
diff --git a/src/import.c b/src/import.c
index d2f1794..f5e9ca9 100644
--- a/src/import.c
+++ b/src/import.c
@@ -1659,8 +1659,7 @@ void traitement_operations_importees ( void )
"with any reconcile number yet. You may associate them with a reconcilation "
"later via the preferences windows.") );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -3533,8 +3532,7 @@ gboolean click_dialog_ope_orphelines ( GtkWidget *dialog,
mise_a_jour_liste_comptes_accueil = 1;
mise_a_jour_soldes_minimaux = 1;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
if ( result != GTK_RESPONSE_OK
&&
@@ -4261,8 +4259,7 @@ gboolean gsb_import_associations_check_add_button ( GObject * main_widget )
gboolean changement_valeur_echelle_recherche_date_import ( GtkWidget *spin_button )
{
valeur_echelle_recherche_date_import = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON ( spin_button ));
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return ( FALSE );
}
@@ -4516,8 +4513,7 @@ gboolean gsb_import_by_rule ( gint rule )
/* force the update module budget */
gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/menu.c b/src/menu.c
index 56b9b41..e46fb41 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -661,8 +661,7 @@ gboolean gsb_gui_toggle_show_closed_accounts ( void )
gsb_gui_navigation_create_account_list ( gsb_gui_navigation_get_model ( ) );
gsb_gui_navigation_update_home_page ( );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
diff --git a/src/metatree.c b/src/metatree.c
index 21d9ebc..d5e8c7b 100644
--- a/src/metatree.c
+++ b/src/metatree.c
@@ -572,8 +572,7 @@ void metatree_new_division ( GtkTreeModel *model )
metatree_fill_new_division ( iface, model, div_id );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -644,8 +643,7 @@ void metatree_new_sub_division ( GtkTreeModel *model, gint div_id )
metatree_fill_new_sub_division ( iface, model, div_id, sub_div_id );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -723,8 +721,7 @@ void appui_sur_ajout_sub_division ( GtkTreeModel * model )
metatree_new_sub_division ( model, div_id );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
gtk_tree_path_free ( path );
}
@@ -845,8 +842,7 @@ gboolean supprimer_division ( GtkTreeView * tree_view )
/* update value in the tree view */
metatree_update_tree_view ( iface );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
/* supprime dans la liste des division */
@@ -973,8 +969,7 @@ void supprimer_sub_division ( GtkTreeView * tree_view, GtkTreeModel * model,
if ( it )
fill_division_row ( model, iface, it, division );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -1024,8 +1019,7 @@ void metatree_remove_transaction ( GtkTreeView * tree_view,
fill_division_row ( model, iface, it, division );
metatree_remove_iter_and_select_next ( tree_view, model, &iter );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -1452,8 +1446,7 @@ void move_transaction_to_sub_division ( gint transaction_number,
}
/* We did some modifications */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
/**
@@ -1552,8 +1545,7 @@ void move_sub_division_to_division ( GtkTreeModel *model,
fill_sub_division_row ( model, iface, &iter,
no_dest_division, no_dest_sub_division );
gtk_tree_iter_free (iter_parent);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
/**
@@ -2669,8 +2661,7 @@ void move_transactions_to_division_payee (GtkTreeModel * model,
}
/* We did some modifications */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
@@ -3022,8 +3013,7 @@ void metatree_manage_sub_divisions ( GtkWidget *tree_view )
}
/* We did some modifications */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
diff --git a/src/navigation.c b/src/navigation.c
index cef947a..0abab47 100644
--- a/src/navigation.c
+++ b/src/navigation.c
@@ -1616,8 +1616,7 @@ gboolean navigation_drag_data_received ( GtkTreeDragDest *drag_dest,
/* update the order of accounts in first page */
mise_a_jour_liste_comptes_accueil = TRUE;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
}
diff --git a/src/parametres.c b/src/parametres.c
index 29f8699..a04d15a 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -1033,8 +1033,7 @@ gboolean gsb_config_backup_dir_chosen ( GtkWidget *button,
if ( path && strlen ( path ) > 0 )
g_free ( path );
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1246,8 +1245,7 @@ gboolean gsb_config_metatree_sort_transactions_changed ( GtkWidget *checkbutton,
break;
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -1665,8 +1663,7 @@ gboolean gsb_config_onglet_metatree_action_changed ( GtkWidget *checkbutton,
value = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( checkbutton ), "pointer" ) );
*pointeur = value;
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
return FALSE;
diff --git a/src/structures.h b/src/structures.h
index d847590..9c55153 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -31,7 +31,6 @@
* */
struct gsb_etat_t
{
- time_t modification_fichier;
gint is_archive; /** TRUE if the file is an archive, FALSE else */
gboolean debug_mode; /* TRUE in debug mode, FALSE for normale mode */
@@ -202,6 +201,8 @@ struct gsb_run_t
/* initialisation variables */
gboolean new_crypted_file; /* 0 à l'exécution de init_variables () 1 si new crypted file*/
+ /* file stuff */
+ time_t file_modification;
gboolean is_saving;
gboolean is_loading;
diff --git a/src/tiers_onglet.c b/src/tiers_onglet.c
index 8f61e21..0287412 100644
--- a/src/tiers_onglet.c
+++ b/src/tiers_onglet.c
@@ -416,8 +416,7 @@ void payees_remove_unused_payees ( void )
{
payees_fill_list ();
tmpstr = g_strdup_printf ( _("Removed %d payees."), nb_removed);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
}
else
{
@@ -720,8 +719,7 @@ gboolean edit_payee ( GtkTreeView * view )
/* update the transactions list */
transaction_list_update_element (ELEMENT_PARTY);
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
return FALSE;
}
@@ -951,8 +949,7 @@ void payees_manage_payees ( void )
payees_fill_list ();
}
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ gsb_file_set_modified ( TRUE );
/* On sélectionne le nouveau tiers */
iter = get_iter_from_div ( GTK_TREE_MODEL ( payee_tree_model ), new_payee_number, 0 );
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index 7ae28c6..a522ea0 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -219,41 +219,6 @@ extern gint valeur_echelle_recherche_date_import;
/**
- * set or unset the modified flag
- * and sensitive or not the menu to save the file
- *
- * \param modif TRUE to set the modified flag, FALSE to unset
- *
- * \return
- * */
-void modification_fichier ( gboolean modif )
-{
- devel_debug_int (modif);
-
- /* If no file is loaded, do not change menu items. */
- if ( ! gsb_data_account_get_accounts_amount () )
- {
- return;
- }
-
- if ( modif )
- {
- if ( ! etat.modification_fichier )
- {
- etat.modification_fichier = time ( NULL );
- gsb_gui_sensitive_menu_item ( "/menubar/FileMenu/Save", TRUE );
- }
- }
- else
- {
- etat.modification_fichier = 0;
- gsb_gui_sensitive_menu_item ( "/menubar/FileMenu/Save", FALSE );
- }
-}
-
-
-
-/**
* initialisation of all the variables of grisbi
* if some are not empty, free them before set it to NULL
*
diff --git a/src/traitement_variables.h b/src/traitement_variables.h
index 51b420f..40488ad 100644
--- a/src/traitement_variables.h
+++ b/src/traitement_variables.h
@@ -14,7 +14,6 @@ void initialisation_couleurs_listes ( void );
void initialise_largeur_colonnes_tab_affichage_ope ( gint type_operation, const gchar *description );
void menus_sensitifs ( gboolean sensitif );
void menus_view_sensitifs ( gboolean sensitif );
-void modification_fichier ( gboolean modif );
/*END_DECLARATION*/
hooks/post-receive
--
grisbi
More information about the cvs
mailing list