[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. grisbi_gtk3_1_3_0-151-g230f566
Pierre Biava
nobody at users.sourceforge.net
Fri Feb 17 22:43:09 CET 2012
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, grisbi-gtk3 has been updated
via 230f5661a03bcca4e141d18183d2170c974ed316 (commit)
via 2d8df62d65eb845453528c9037eb9d338dbd0b83 (commit)
via 928f7cb28397d2dbc2fc3081e582653d0ca1ade9 (commit)
from 29544a2eab316462b3c030f19ef1d7391ec85a1b (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 230f5661a03bcca4e141d18183d2170c974ed316
Author: pbiava <pierre.biava at nerim.net>
Date: Fri Feb 17 22:24:32 2012 +0100
deletion of the global variable titre_fichier
commit 2d8df62d65eb845453528c9037eb9d338dbd0b83
Author: pbiava <pierre.biava at nerim.net>
Date: Fri Feb 17 22:12:47 2012 +0100
deletion of the global variable nom_fichier_comptes
commit 928f7cb28397d2dbc2fc3081e582653d0ca1ade9
Author: pbiava <pierre.biava at nerim.net>
Date: Fri Feb 17 06:30:04 2012 +0100
gsb_assistant_file.c: minor change
-----------------------------------------------------------------------
Changes:
diff --git a/src/affichage.c b/src/affichage.c
index a9e6a83..b41e968 100644
--- a/src/affichage.c
+++ b/src/affichage.c
@@ -88,7 +88,6 @@ extern gchar *adresse_secondaire;
extern GtkWidget *fenetre_preferences;
extern GtkWidget *hbox_title;
extern GtkWidget *logo_accueil;
-extern gchar *titre_fichier;
/*END_EXTERN*/
@@ -365,6 +364,7 @@ GtkWidget *onglet_display_addresses ( void )
GtkWidget *paddingbox;
GtkWidget *entry;
GtkWidget *radio, *radiogroup;
+ gchar *titre_fichier;
GrisbiAppConf *conf;
conf = grisbi_app_get_conf ( );
@@ -375,6 +375,7 @@ GtkWidget *onglet_display_addresses ( void )
paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE, _("Titles") );
/* It first creates the entry of title */
+ titre_fichier = (gchar *) grisbi_app_get_active_file_title ();
entry = gsb_automem_entry_new ( &titre_fichier,
( GCallback ) update_homepage_title, NULL );
@@ -642,13 +643,12 @@ static gboolean preferences_view_update_preview_logo ( GtkFileChooser *file_choo
* \param length Not used handler parameter.
* \param position Not used handler parameter.
*/
-gboolean update_homepage_title (GtkEntry *entry, gchar *value,
- gint length, gint * position)
+gboolean update_homepage_title (GtkEntry *entry,
+ gchar *value,
+ gint length,
+ gint *position)
{
- if ( titre_fichier && strlen ( titre_fichier ) )
- g_free ( titre_fichier );
-
- titre_fichier = my_strdup ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
+ grisbi_app_set_active_file_title ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
/* set Grisbi title */
gsb_main_set_grisbi_title ( -1 );
@@ -955,6 +955,10 @@ gboolean change_grisbi_title_type ( GtkRadioButton *button, GtkWidget *entry )
switch ( conf->display_grisbi_title )
{
case GSB_ACCOUNTS_TITLE:
+ {
+ const gchar *titre_fichier;
+
+ titre_fichier = grisbi_app_get_active_file_title ();
gtk_widget_set_sensitive ( entry, TRUE );
if ( titre_fichier && strlen ( titre_fichier ) )
gtk_entry_set_text ( GTK_ENTRY ( entry ), titre_fichier );
@@ -963,6 +967,7 @@ gboolean change_grisbi_title_type ( GtkRadioButton *button, GtkWidget *entry )
gtk_entry_set_text ( GTK_ENTRY ( entry ), "" );
titre_fichier = NULL;
}
+ }
break;
case GSB_ACCOUNT_HOLDER:
gtk_widget_set_sensitive ( entry, FALSE);
diff --git a/src/erreur.c b/src/erreur.c
index 9fcf992..0e93d7b 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -62,7 +62,6 @@ static GtkWidget *print_backtrace ( void );
/*END_STATIC*/
/*START_EXTERN*/
-extern gchar *nom_fichier_comptes;
/*END_EXTERN*/
static gint debugging_grisbi;
@@ -83,7 +82,8 @@ void traitement_sigsegv ( gint signal_nb )
const gchar *gsb_file_default_dir;
gchar *errmsg = g_strdup ( "" );
gchar *old_errmsg;
- gchar *tmpstr;
+ gchar *tmp_str;
+ gchar *nom_fichier_comptes;
GtkWidget *dialog;
#ifdef HAVE_BACKTRACE
GtkWidget * expander;
@@ -91,6 +91,7 @@ void traitement_sigsegv ( gint signal_nb )
GrisbiAppConf *conf;
conf = grisbi_app_get_conf ( );
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
/* il y a 4 possibilités :
* - Demande de fermeture de la part du système
@@ -106,14 +107,14 @@ void traitement_sigsegv ( gint signal_nb )
if ( nom_fichier_comptes )
/* set # around the filename */
- nom_fichier_comptes = g_path_get_basename ( nom_fichier_comptes );
+ tmp_str = g_path_get_basename ( nom_fichier_comptes );
else
/* no name for the file, create it */
- nom_fichier_comptes = g_build_filename ( gsb_file_default_dir, "#grisbi_save_no_name.gsb#", NULL );
+ tmp_str = g_build_filename ( gsb_file_default_dir, "#grisbi_save_no_name.gsb#", NULL );
old_errmsg = g_strdup ( _("Request for forced shutdown of Grisbi \n") );
errmsg = g_markup_printf_escaped ( _("The file \"%s has been modified. Do you want to save it?\n"),
- nom_fichier_comptes );
+ tmp_str );
dialog = gtk_message_dialog_new ( GTK_WINDOW ( grisbi_app_get_active_window ( NULL ) ),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -131,12 +132,14 @@ void traitement_sigsegv ( gint signal_nb )
if ( res == GTK_RESPONSE_YES )
{
gsb_status_message ( _("Save file") );
- gsb_file_save_save_file ( nom_fichier_comptes, conf->compress_file, FALSE );
+ gsb_file_save_save_file ( tmp_str, conf->compress_file, FALSE );
gsb_status_clear ( );
}
gtk_widget_destroy ( dialog );
gsb_file_util_modify_lock ( FALSE );
+ g_free ( nom_fichier_comptes );
+ g_free ( tmp_str );
exit ( 0 );
}
@@ -165,23 +168,25 @@ void traitement_sigsegv ( gint signal_nb )
if ( nom_fichier_comptes )
/* set # around the filename */
- nom_fichier_comptes = g_path_get_basename ( nom_fichier_comptes );
+ tmp_str = g_path_get_basename ( nom_fichier_comptes );
else
/* no name for the file, create it */
- nom_fichier_comptes = g_build_filename ( gsb_file_default_dir, "#grisbi_crash_no_name#", NULL );
+ tmp_str = g_build_filename ( gsb_file_default_dir, "#grisbi_crash_no_name#", NULL );
gsb_status_message ( _("Save file") );
- gsb_file_save_save_file ( nom_fichier_comptes, conf->compress_file, FALSE );
+ gsb_file_save_save_file ( tmp_str, conf->compress_file, FALSE );
gsb_status_clear ( );
old_errmsg = errmsg;
errmsg = g_strconcat ( errmsg,
g_strdup_printf ( _("Grisbi made a backup file at '%s'."),
- nom_fichier_comptes ),
+ tmp_str ),
NULL );
g_free ( old_errmsg );
+ g_free ( nom_fichier_comptes );
+ g_free ( tmp_str );
}
old_errmsg = errmsg;
@@ -208,9 +213,9 @@ void traitement_sigsegv ( gint signal_nb )
#ifdef HAVE_BACKTRACE
{
- tmpstr = g_strconcat ( "<b>", _("Backtrace"), "</b>", NULL );
- expander = gtk_expander_new ( tmpstr );
- g_free ( tmpstr );
+ tmp_str = g_strconcat ( "<b>", _("Backtrace"), "</b>", NULL );
+ expander = gtk_expander_new ( tmp_str );
+ g_free ( tmp_str );
gtk_expander_set_use_markup ( GTK_EXPANDER ( expander ), TRUE );
gtk_container_add ( GTK_CONTAINER ( expander ), print_backtrace() );
@@ -485,9 +490,12 @@ gboolean gsb_debug_start_log ( void )
{
gchar *tmp_str;
gchar *debug_filename;
+ gchar *nom_fichier_comptes;
devel_debug ( NULL );
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+
if ( nom_fichier_comptes )
{
gchar *base_filename = g_strdup ( nom_fichier_comptes );
@@ -503,6 +511,7 @@ gboolean gsb_debug_start_log ( void )
g_free ( basename);
g_free ( complete_filename );
g_free ( base_filename );
+ g_free ( nom_fichier_comptes );
}
else
{
@@ -544,7 +553,7 @@ gboolean gsb_debug_start_log ( void )
__LINE__,
__PRETTY_FUNCTION__ );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
@@ -552,7 +561,7 @@ gboolean gsb_debug_start_log ( void )
tmp_str = gsb_main_get_print_locale_var ( );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
@@ -562,20 +571,20 @@ gboolean gsb_debug_start_log ( void )
G_GINT64_MODIFIER, G_MAXINT64 );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
tmp_str = gsb_main_get_print_dir_var ( );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
tmp_str = g_strdup ( "Formats importés\n" );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
@@ -583,7 +592,7 @@ gboolean gsb_debug_start_log ( void )
tmp_str_2 = g_strconcat ( tmp_str, "\n", NULL );
fwrite ( tmp_str_2, sizeof (gchar), strlen ( tmp_str_2 ), debug_file );
- fflush ( debug_file );
+ fflush ( debug_file );
g_free ( tmp_str );
g_free ( tmp_str_2 );
diff --git a/src/export.c b/src/export.c
index 6b2f69b..e5ca7d1 100644
--- a/src/export.c
+++ b/src/export.c
@@ -32,6 +32,7 @@
#include "export.h"
#include "dialog.h"
#include "export_csv.h"
+#include "grisbi_app.h"
#include "gsb_assistant.h"
#include "gsb_automem.h"
#include "gsb_data_account.h"
@@ -49,13 +50,14 @@ static GtkWidget * create_export_account_resume_page ( struct exported_account *
static void export_account_all_toggled ( GtkToggleButton *button,
GtkTreeView *tree_view );
static gboolean export_account_change_format ( GtkWidget * combo,
- struct exported_account * account );
+ struct exported_account * account );
static gboolean export_account_radiobutton_format_changed ( GtkWidget *checkbutton,
GdkEventButton *event,
gint *pointeur );
static void expert_account_free_account_structure ( struct exported_account *account );
-static void export_account_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
- GtkTreeModel * model );
+static void export_account_toggled ( GtkCellRendererToggle *cell,
+ gchar *path_str,
+ GtkTreeModel * model );
static GtkWidget * export_create_final_page ( GtkWidget * assistant );
static GtkWidget * export_create_resume_page ( GtkWidget * assistant );
static GtkWidget * export_create_selection_page ( GtkWidget * assistant );
@@ -65,7 +67,6 @@ static void export_resume_maybe_sensitive_next ( GtkWidget * assistant );
/*END_STATIC*/
/*START_EXTERN*/
-extern gchar *titre_fichier;
/*END_EXTERN*/
@@ -112,8 +113,10 @@ void export_accounts ( void )
if ( etat.export_files_traitement )
{
const gchar *title;
+ const gchar *titre_fichier;
gchar *tmp_str;
+ titre_fichier = grisbi_app_get_active_file_title ();
if ( titre_fichier && strlen ( titre_fichier ) )
title = titre_fichier;
else
@@ -160,7 +163,7 @@ void export_accounts ( void )
*
*
*/
-GtkWidget * export_create_selection_page ( GtkWidget * assistant )
+GtkWidget *export_create_selection_page ( GtkWidget * assistant )
{
GtkWidget * view, * vbox, * padding_box, * sw;
GtkWidget *combo;
@@ -261,7 +264,7 @@ GtkWidget * export_create_selection_page ( GtkWidget * assistant )
*
*
*/
-GtkWidget * export_create_resume_page ( GtkWidget * assistant )
+GtkWidget *export_create_resume_page ( GtkWidget * assistant )
{
GtkWidget *sw;
GtkWidget * view;
@@ -302,7 +305,7 @@ GtkWidget * export_create_resume_page ( GtkWidget * assistant )
*
*
*/
-GtkWidget * export_create_final_page ( GtkWidget * assistant )
+GtkWidget *export_create_final_page ( GtkWidget * assistant )
{
GtkWidget * view;
GtkTextBuffer * buffer;
@@ -433,7 +436,7 @@ gboolean export_enter_resume_page ( GtkWidget * assistant )
*
*
*/
-GtkWidget * create_export_account_resume_page ( struct exported_account * account )
+GtkWidget *create_export_account_resume_page ( struct exported_account * account )
{
GtkWidget * vbox, * hbox, * label, * combo;
gchar *tmpstr;
@@ -493,6 +496,7 @@ gboolean export_account_change_format ( GtkWidget *combo,
struct exported_account *account )
{
gchar *title;
+ const gchar *titre_fichier;
switch ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( combo ) ) )
{
@@ -507,9 +511,10 @@ gboolean export_account_change_format ( GtkWidget *combo,
break;
}
+ titre_fichier = grisbi_app_get_active_file_title ();
if ( titre_fichier && strlen ( titre_fichier ) )
{
- title = titre_fichier;
+ title = g_strdup ( titre_fichier );
}
else
{
@@ -522,6 +527,8 @@ gboolean export_account_change_format ( GtkWidget *combo,
NULL ) );
gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER ( account->chooser ), gsb_file_get_last_path () );
+ g_free ( title );
+
return FALSE;
}
@@ -531,8 +538,9 @@ gboolean export_account_change_format ( GtkWidget *combo,
*
*
*/
-void export_account_toggled ( GtkCellRendererToggle *cell, gchar *path_str,
- GtkTreeModel * model )
+void export_account_toggled ( GtkCellRendererToggle *cell,
+ gchar *path_str,
+ GtkTreeModel * model )
{
GtkWidget * assistant;
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
diff --git a/src/file_obfuscate.c b/src/file_obfuscate.c
index 9ab8162..de24b2e 100644
--- a/src/file_obfuscate.c
+++ b/src/file_obfuscate.c
@@ -36,6 +36,7 @@
/*START_INCLUDE*/
#include "file_obfuscate.h"
#include "dialog.h"
+#include "grisbi_app.h"
#include "gsb_assistant.h"
#include "gsb_data_account.h"
#include "gsb_data_bank.h"
@@ -60,7 +61,6 @@ static GtkWidget *file_obfuscate_page_2 ( void );
/*END_STATIC*/
/*START_EXTERN*/
-extern gchar *nom_fichier_comptes;
extern gsb_real null_real;
/*END_EXTERN*/
@@ -86,277 +86,279 @@ static GtkWidget *button_reconcile;
gboolean file_obfuscate_run ( void )
{
GtkWidget *assistant;
+ gchar *nom_fichier_comptes;
gint result;
gsb_status_message ( _("Obfuscating file...") );
assistant = gsb_assistant_new ( _("Grisbi file obfuscation"),
- _("This assistant produces anonymized copies of account files, with "
- "all personal data replaced with harmless random data, in order to "
- "attach an anonimized copy of your Grisbi file with any bug report "
- "you submit."
- "\n\n"
- "That said, please check that bugs you submit are still valid with "
- "anonymized version of your files.\n"
- "\n"
- "To avoid any problems in your file, after saving the modified file, "
- "Grisbi will close without letting you saving anything. "
- "So if you didn't save your changes, please stop this assistant, "
- "save your work and restart the obfuscation process.\n\n"
- "In next page, you will be able to select individual features to "
- "obfuscate or to keep depending on the level of privacy needed."),
- "bug.png",
- NULL );
+ _("This assistant produces anonymized copies of account files, with "
+ "all personal data replaced with harmless random data, in order to "
+ "attach an anonimized copy of your Grisbi file with any bug report "
+ "you submit."
+ "\n\n"
+ "That said, please check that bugs you submit are still valid with "
+ "anonymized version of your files.\n"
+ "\n"
+ "To avoid any problems in your file, after saving the modified file, "
+ "Grisbi will close without letting you saving anything. "
+ "So if you didn't save your changes, please stop this assistant, "
+ "save your work and restart the obfuscation process.\n\n"
+ "In next page, you will be able to select individual features to "
+ "obfuscate or to keep depending on the level of privacy needed."),
+ "bug.png",
+ NULL );
gsb_assistant_add_page ( assistant,
- file_obfuscate_page_1 (),
- 1, 0, 2, NULL );
+ file_obfuscate_page_1 (),
+ 1, 0, 2, NULL );
gsb_assistant_add_page ( assistant,
- file_obfuscate_page_2 (),
- 2, 1, -1, NULL );
+ file_obfuscate_page_2 (),
+ 2, 1, -1, NULL );
result = gsb_assistant_run ( assistant );
if (result == GTK_RESPONSE_APPLY)
{
- /* obfuscate the file */
- GSList *tmp_list;
- gchar *filename;
-
- /* remove the swp file */
- gsb_file_util_modify_lock (FALSE);
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_accounts_details)))
- {
- /* hide the details of account but not the names */
- tmp_list = gsb_data_account_get_list_accounts ();
- while (tmp_list)
- {
- gint account_number = gsb_data_account_get_no_account (tmp_list -> data);
-
- gsb_data_account_set_id (account_number,
- g_strdup_printf ("id account %d", account_number));
- gsb_data_account_set_comment (account_number, NULL);
- gsb_data_account_set_holder_name (account_number, NULL);
- gsb_data_account_set_holder_address (account_number, NULL);
- gsb_data_account_set_init_balance (account_number, null_real);
- gsb_data_account_set_mini_balance_wanted (account_number, null_real);
- gsb_data_account_set_mini_balance_authorized (account_number, null_real);
- gsb_data_account_set_bank_branch_code (account_number, NULL);
- gsb_data_account_set_bank_account_number (account_number, NULL);
- gsb_data_account_set_bank_account_key (account_number, NULL);
-
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_amount)))
- {
- /* hide the amounts of transactions */
- tmp_list = gsb_data_transaction_get_complete_transactions_list ();
- while (tmp_list)
- {
- gint transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
-
- gsb_data_transaction_set_amount (transaction_number, null_real);
- gsb_data_transaction_set_voucher (transaction_number, NULL);
- gsb_data_transaction_set_bank_references (transaction_number, NULL);
-
- tmp_list = tmp_list -> next;
- }
-
- /* hide the amounts of scheduled transactions */
- tmp_list = gsb_data_scheduled_get_scheduled_list ();
- while (tmp_list)
- {
- gint scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
-
- gsb_data_scheduled_set_amount (scheduled_number, null_real);
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_accounts_names)))
- {
- /* hide the accounts names */
- tmp_list = gsb_data_account_get_list_accounts ();
- while (tmp_list)
- {
- gint account_number = gsb_data_account_get_no_account (tmp_list -> data);
-
- gsb_data_account_set_name (account_number,
- g_strdup_printf ("Account n°%d", account_number));
-
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_payee)))
- {
- /* hide the payees names */
- tmp_list = gsb_data_payee_get_payees_list ();
- while (tmp_list)
- {
- gint payee_number = gsb_data_payee_get_no_payee (tmp_list -> data);
-
- gsb_data_payee_set_name (payee_number,
- g_strdup_printf ( "Payee n°%d", payee_number));
- gsb_data_payee_set_description (payee_number, NULL);
-
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_categories)))
- {
- /* hide the categories */
- tmp_list = gsb_data_category_get_categories_list ();
- while (tmp_list)
- {
- GSList *list_sub_categ;
- gint category_number = gsb_data_category_get_no_category (tmp_list -> data);
-
- gsb_data_category_set_name (category_number,
- g_strdup_printf ( "Category n°%d", category_number));
-
- list_sub_categ = gsb_data_category_get_sub_category_list (category_number);
- while (list_sub_categ)
- {
- gint sub_categ_number = gsb_data_category_get_no_sub_category (list_sub_categ -> data);
-
- gsb_data_category_set_sub_category_name (category_number, sub_categ_number,
- g_strdup_printf ("Sub-category n°%d", sub_categ_number));
- list_sub_categ = list_sub_categ -> next;
- }
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_budgets)))
- {
- /* hide the budgets */
- tmp_list = gsb_data_budget_get_budgets_list ();
- while (tmp_list)
- {
- GSList *list_sub_budget;
- gint budget_number = gsb_data_budget_get_no_budget (tmp_list -> data);
-
- gsb_data_budget_set_name (budget_number,
- g_strdup_printf ( "Budget n°%d", budget_number));
-
- list_sub_budget = gsb_data_budget_get_sub_budget_list (budget_number);
- while (list_sub_budget)
- {
- gint sub_budget_number = gsb_data_budget_get_no_sub_budget (list_sub_budget -> data);
-
- gsb_data_budget_set_sub_budget_name (budget_number, sub_budget_number,
- g_strdup_printf ("Sub-budget n°%d", sub_budget_number));
- list_sub_budget = list_sub_budget -> next;
- }
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_notes)))
- {
- /* hide the notes */
- tmp_list = gsb_data_transaction_get_complete_transactions_list ();
- while (tmp_list)
- {
- gint transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
-
- gsb_data_transaction_set_notes (transaction_number, NULL);
-
- tmp_list = tmp_list -> next;
- }
-
- /* hide the notes of scheduled transactions */
- tmp_list = gsb_data_scheduled_get_scheduled_list ();
- while (tmp_list)
- {
- gint scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
-
- gsb_data_scheduled_set_notes (scheduled_number, NULL);
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_banks)))
- {
- /* hide the banks */
- tmp_list = gsb_data_bank_get_bank_list ();
- while (tmp_list)
- {
- gint bank_number = gsb_data_bank_get_no_bank (tmp_list -> data);
-
- gsb_data_bank_set_name (bank_number,
- g_strdup_printf ("Bank n°%d", bank_number));
- gsb_data_bank_set_code (bank_number, NULL);
- gsb_data_bank_set_bank_address (bank_number, NULL);
- gsb_data_bank_set_bank_tel (bank_number, NULL);
- gsb_data_bank_set_bank_mail (bank_number, NULL);
- gsb_data_bank_set_bank_web (bank_number, NULL);
- gsb_data_bank_set_bank_note (bank_number, NULL);
- gsb_data_bank_set_correspondent_name (bank_number, NULL);
- gsb_data_bank_set_correspondent_tel (bank_number, NULL);
- gsb_data_bank_set_correspondent_mail (bank_number, NULL);
- gsb_data_bank_set_correspondent_fax (bank_number, NULL);
-
- tmp_list = tmp_list -> next;
- }
-
-
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_reports)))
- {
- /* hide the reports names*/
- tmp_list = gsb_data_report_get_report_list ();
- while (tmp_list)
- {
- gint report_number = gsb_data_report_get_report_number (tmp_list -> data);
-
- gsb_data_report_set_report_name ( report_number,
- g_strdup_printf ( "Report n°%d", report_number));
-
- tmp_list = tmp_list -> next;
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_reconcile)))
- {
- /* hide the reconciles */
- GList *reconcile_list;
- reconcile_list = gsb_data_reconcile_get_reconcile_list ();
- while (reconcile_list)
- {
- gint reconcile_number = gsb_data_reconcile_get_no_reconcile (reconcile_list -> data);
-
- gsb_data_reconcile_set_init_balance (reconcile_number, null_real);
- gsb_data_reconcile_set_final_balance (reconcile_number, null_real);
-
- reconcile_list = reconcile_list -> next;
- }
- }
-
- if (nom_fichier_comptes)
- {
- /* remove the .gsb */
- nom_fichier_comptes[strlen(nom_fichier_comptes) -4] = 0;
- filename = g_strconcat ( nom_fichier_comptes, "-obfuscated.gsb", NULL);
- }
- else
- filename = g_build_filename ( gsb_dirs_get_home_dir ( ), "No_name-obfuscated.gsb", NULL);
-
- if (gsb_file_save_save_file (filename, FALSE, FALSE))
- dialogue_hint ( g_strdup_printf ( _("Obfuscated file saved as\n'%s'"), filename ),
- _("Obfuscation succeeded") );
- else
- dialogue_error_hint (g_strdup_printf (_("Grisbi couldn't save the file\n'%s'"), filename ),
- _("Obfuscation failed") );
-
- /* bye bye */
- exit (0);
+ /* obfuscate the file */
+ GSList *tmp_list;
+ gchar *filename;
+
+ /* remove the swp file */
+ gsb_file_util_modify_lock (FALSE);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_accounts_details)))
+ {
+ /* hide the details of account but not the names */
+ tmp_list = gsb_data_account_get_list_accounts ();
+ while (tmp_list)
+ {
+ gint account_number = gsb_data_account_get_no_account (tmp_list -> data);
+
+ gsb_data_account_set_id (account_number,
+ g_strdup_printf ("id account %d", account_number));
+ gsb_data_account_set_comment (account_number, NULL);
+ gsb_data_account_set_holder_name (account_number, NULL);
+ gsb_data_account_set_holder_address (account_number, NULL);
+ gsb_data_account_set_init_balance (account_number, null_real);
+ gsb_data_account_set_mini_balance_wanted (account_number, null_real);
+ gsb_data_account_set_mini_balance_authorized (account_number, null_real);
+ gsb_data_account_set_bank_branch_code (account_number, NULL);
+ gsb_data_account_set_bank_account_number (account_number, NULL);
+ gsb_data_account_set_bank_account_key (account_number, NULL);
+
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_amount)))
+ {
+ /* hide the amounts of transactions */
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
+ while (tmp_list)
+ {
+ gint transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+
+ gsb_data_transaction_set_amount (transaction_number, null_real);
+ gsb_data_transaction_set_voucher (transaction_number, NULL);
+ gsb_data_transaction_set_bank_references (transaction_number, NULL);
+
+ tmp_list = tmp_list -> next;
+ }
+
+ /* hide the amounts of scheduled transactions */
+ tmp_list = gsb_data_scheduled_get_scheduled_list ();
+ while (tmp_list)
+ {
+ gint scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
+
+ gsb_data_scheduled_set_amount (scheduled_number, null_real);
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_accounts_names)))
+ {
+ /* hide the accounts names */
+ tmp_list = gsb_data_account_get_list_accounts ();
+ while (tmp_list)
+ {
+ gint account_number = gsb_data_account_get_no_account (tmp_list -> data);
+
+ gsb_data_account_set_name (account_number,
+ g_strdup_printf ("Account n°%d", account_number));
+
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_payee)))
+ {
+ /* hide the payees names */
+ tmp_list = gsb_data_payee_get_payees_list ();
+ while (tmp_list)
+ {
+ gint payee_number = gsb_data_payee_get_no_payee (tmp_list -> data);
+
+ gsb_data_payee_set_name (payee_number,
+ g_strdup_printf ( "Payee n°%d", payee_number));
+ gsb_data_payee_set_description (payee_number, NULL);
+
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_categories)))
+ {
+ /* hide the categories */
+ tmp_list = gsb_data_category_get_categories_list ();
+ while (tmp_list)
+ {
+ GSList *list_sub_categ;
+ gint category_number = gsb_data_category_get_no_category (tmp_list -> data);
+
+ gsb_data_category_set_name (category_number,
+ g_strdup_printf ( "Category n°%d", category_number));
+
+ list_sub_categ = gsb_data_category_get_sub_category_list (category_number);
+ while (list_sub_categ)
+ {
+ gint sub_categ_number = gsb_data_category_get_no_sub_category (list_sub_categ -> data);
+
+ gsb_data_category_set_sub_category_name (category_number, sub_categ_number,
+ g_strdup_printf ("Sub-category n°%d", sub_categ_number));
+ list_sub_categ = list_sub_categ -> next;
+ }
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_budgets)))
+ {
+ /* hide the budgets */
+ tmp_list = gsb_data_budget_get_budgets_list ();
+ while (tmp_list)
+ {
+ GSList *list_sub_budget;
+ gint budget_number = gsb_data_budget_get_no_budget (tmp_list -> data);
+
+ gsb_data_budget_set_name (budget_number,
+ g_strdup_printf ( "Budget n°%d", budget_number));
+
+ list_sub_budget = gsb_data_budget_get_sub_budget_list (budget_number);
+ while (list_sub_budget)
+ {
+ gint sub_budget_number = gsb_data_budget_get_no_sub_budget (list_sub_budget -> data);
+
+ gsb_data_budget_set_sub_budget_name (budget_number, sub_budget_number,
+ g_strdup_printf ("Sub-budget n°%d", sub_budget_number));
+ list_sub_budget = list_sub_budget -> next;
+ }
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_notes)))
+ {
+ /* hide the notes */
+ tmp_list = gsb_data_transaction_get_complete_transactions_list ();
+ while (tmp_list)
+ {
+ gint transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+
+ gsb_data_transaction_set_notes (transaction_number, NULL);
+
+ tmp_list = tmp_list -> next;
+ }
+
+ /* hide the notes of scheduled transactions */
+ tmp_list = gsb_data_scheduled_get_scheduled_list ();
+ while (tmp_list)
+ {
+ gint scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
+
+ gsb_data_scheduled_set_notes (scheduled_number, NULL);
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_banks)))
+ {
+ /* hide the banks */
+ tmp_list = gsb_data_bank_get_bank_list ();
+ while (tmp_list)
+ {
+ gint bank_number = gsb_data_bank_get_no_bank (tmp_list -> data);
+
+ gsb_data_bank_set_name (bank_number,
+ g_strdup_printf ("Bank n°%d", bank_number));
+ gsb_data_bank_set_code (bank_number, NULL);
+ gsb_data_bank_set_bank_address (bank_number, NULL);
+ gsb_data_bank_set_bank_tel (bank_number, NULL);
+ gsb_data_bank_set_bank_mail (bank_number, NULL);
+ gsb_data_bank_set_bank_web (bank_number, NULL);
+ gsb_data_bank_set_bank_note (bank_number, NULL);
+ gsb_data_bank_set_correspondent_name (bank_number, NULL);
+ gsb_data_bank_set_correspondent_tel (bank_number, NULL);
+ gsb_data_bank_set_correspondent_mail (bank_number, NULL);
+ gsb_data_bank_set_correspondent_fax (bank_number, NULL);
+
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_reports)))
+ {
+ /* hide the reports names*/
+ tmp_list = gsb_data_report_get_report_list ();
+ while (tmp_list)
+ {
+ gint report_number = gsb_data_report_get_report_number (tmp_list -> data);
+
+ gsb_data_report_set_report_name ( report_number,
+ g_strdup_printf ( "Report n°%d", report_number));
+
+ tmp_list = tmp_list -> next;
+ }
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_reconcile)))
+ {
+ /* hide the reconciles */
+ GList *reconcile_list;
+ reconcile_list = gsb_data_reconcile_get_reconcile_list ();
+ while (reconcile_list)
+ {
+ gint reconcile_number = gsb_data_reconcile_get_no_reconcile (reconcile_list -> data);
+
+ gsb_data_reconcile_set_init_balance (reconcile_number, null_real);
+ gsb_data_reconcile_set_final_balance (reconcile_number, null_real);
+
+ reconcile_list = reconcile_list -> next;
+ }
+ }
+
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+
+ if (nom_fichier_comptes)
+ {
+ /* remove the .gsb */
+ nom_fichier_comptes[strlen(nom_fichier_comptes) -4] = 0;
+ filename = g_strconcat ( nom_fichier_comptes, "-obfuscated.gsb", NULL);
+ g_free ( nom_fichier_comptes );
+ }
+ else
+ filename = g_build_filename ( gsb_dirs_get_home_dir ( ), "No_name-obfuscated.gsb", NULL);
+
+ if (gsb_file_save_save_file (filename, FALSE, FALSE))
+ dialogue_hint ( g_strdup_printf ( _("Obfuscated file saved as\n'%s'"), filename ),
+ _("Obfuscation succeeded") );
+ else
+ dialogue_error_hint (g_strdup_printf (_("Grisbi couldn't save the file\n'%s'"), filename ),
+ _("Obfuscation failed") );
+
+ /* bye bye */
+ exit (0);
}
gtk_widget_destroy ( assistant );
@@ -470,6 +472,7 @@ GtkWidget *file_obfuscate_page_2 ( void )
GtkTextBuffer * buffer;
GtkTextIter iter;
gchar * text, * filename;
+ gchar *nom_fichier_comptes;
vbox = gtk_vbox_new (FALSE, 5);
@@ -488,30 +491,33 @@ GtkWidget *file_obfuscate_page_2 ( void )
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
gtk_text_buffer_insert ( buffer, &iter, "\n", -1 );
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+
if (nom_fichier_comptes)
{
- gchar * base_filename = g_strdup ( nom_fichier_comptes );
- gchar * complete_filename;
- base_filename[strlen(base_filename) - 4] = 0;
- complete_filename = g_strconcat ( base_filename, "-obfuscated.gsb", NULL);
- filename = g_path_get_basename ( complete_filename );
- g_free ( complete_filename );
- g_free ( base_filename );
+ gchar * base_filename = g_strdup ( nom_fichier_comptes );
+ gchar * complete_filename;
+ base_filename[strlen(base_filename) - 4] = 0;
+ complete_filename = g_strconcat ( base_filename, "-obfuscated.gsb", NULL);
+ filename = g_path_get_basename ( complete_filename );
+ g_free ( complete_filename );
+ g_free ( base_filename );
+ g_free ( nom_fichier_comptes );
}
else
{
- filename = g_strconcat ( "No_name-obfuscated.gsb", NULL);
+ filename = g_strconcat ( "No_name-obfuscated.gsb", NULL);
}
text = g_strdup_printf ( _("Please press the 'Close' button to obfuscate your file\n\n"
- "Obfuscated file will be named %s, in the same directory as original file.\n\n"
- "Please check the bug is still there and send your file with the explanation to "
- "make the bug at bugsreports at listes.grisbi.org or on the bugracker (Mantis) "
- "at http://grisbi.tuxfamily.org/mantis/main_page.php\n\n"
- "The account is saved in text, you may double check with a text editor if there "
- "is no personal information anymore in this file."
- "Grisbi will close immediatly after saving the obfuscated file"),
- filename );
+ "Obfuscated file will be named %s, in the same directory as original file.\n\n"
+ "Please check the bug is still there and send your file with the explanation to "
+ "make the bug at bugsreports at listes.grisbi.org or on the bugracker (Mantis) "
+ "at http://grisbi.tuxfamily.org/mantis/main_page.php\n\n"
+ "The account is saved in text, you may double check with a text editor if there "
+ "is no personal information anymore in this file."
+ "Grisbi will close immediatly after saving the obfuscated file"),
+ filename );
gtk_text_buffer_insert ( buffer, &iter, text, -1 );
diff --git a/src/grisbi_app.c b/src/grisbi_app.c
index e26601e..01ba5bc 100644
--- a/src/grisbi_app.c
+++ b/src/grisbi_app.c
@@ -614,7 +614,7 @@ const gchar *grisbi_app_get_active_filename ( void )
/**
- * définit le nom du fichier associé à la fenêtre
+ * définit le nom du fichier associé à la fenêtre active
*
* \param filename
*
@@ -635,6 +635,67 @@ gboolean grisbi_app_set_active_filename ( const gchar *filename )
/**
+ * retourne le titre du fichier de la fenêtre active
+ *
+ * \param
+ *
+ * \return
+ **/
+const gchar *grisbi_app_get_active_file_title ( void )
+{
+ GrisbiApp *app;
+ GrisbiWindow *window;
+
+ app = grisbi_app_get_default ( );
+ window = grisbi_app_get_active_window ( app );
+
+ return grisbi_window_get_file_title ( window );
+}
+
+
+/**
+ * définit le titre du fichier associé à la fenêtre active
+ *
+ * \param file_title
+ *
+ * \return TRUE
+ **/
+gboolean grisbi_app_set_active_file_title ( const gchar *file_title )
+{
+ GrisbiApp *app;
+ GrisbiWindow *window;
+
+ app = grisbi_app_get_default ( );
+ window = grisbi_app_get_active_window ( app );
+
+ grisbi_window_set_file_title ( window, file_title );
+
+ return TRUE;
+}
+
+
+/**
+ * définit le titre de la fenêtre active
+ *
+ * \param title
+ *
+ * \return TRUE
+ **/
+gboolean grisbi_app_set_active_title ( const gchar *title )
+{
+ GrisbiApp *app;
+ GrisbiWindow *window;
+
+ app = grisbi_app_get_default ( );
+ window = grisbi_app_get_active_window ( app );
+
+ grisbi_window_set_window_title ( window, title );
+
+ return TRUE;
+}
+
+
+/**
* retourne le ui_manager pour la gestion des menus et barres d'outils
*
* \param
diff --git a/src/grisbi_app.h b/src/grisbi_app.h
index 1e4e6a3..79ddfd3 100644
--- a/src/grisbi_app.h
+++ b/src/grisbi_app.h
@@ -51,6 +51,7 @@ gboolean grisbi_app_close_file ( void );
GrisbiWindow *grisbi_app_create_window ( GrisbiApp *app,
GdkScreen *screen );
const gchar *grisbi_app_get_active_filename ( void );
+const gchar *grisbi_app_get_active_file_title ( void );
GtkUIManager *grisbi_app_get_active_ui_manager ( void );
GrisbiWindow *grisbi_app_get_active_window ( GrisbiApp *app );
GrisbiAppConf *grisbi_app_get_conf ( void );
@@ -59,6 +60,8 @@ gboolean grisbi_app_get_first_use ( GrisbiApp *app );
const GList *grisbi_app_get_windows ( GrisbiApp *app );
gboolean grisbi_app_quit ( void );
gboolean grisbi_app_set_active_filename ( const gchar *filename );
+gboolean grisbi_app_set_active_file_title ( const gchar *filename );
+gboolean grisbi_app_set_active_title ( const gchar *title );
/* END_DECLARATION */
G_END_DECLS
diff --git a/src/grisbi_window.c b/src/grisbi_window.c
index 6cf25a4..85f9bc3 100644
--- a/src/grisbi_window.c
+++ b/src/grisbi_window.c
@@ -69,8 +69,11 @@ struct _GrisbiWindowPrivate
/* nom du fichier associé à la fenêtre */
gchar *filename;
+ /* titre du fichier */
+ gchar *file_title;
+
/* titre de la fenêtre */
- gchar *title;
+ gchar *window_title;
/* Menus et barres d'outils */
GtkWidget *menu_bar;
@@ -113,8 +116,9 @@ static void grisbi_window_finalize ( GObject *object )
window = GRISBI_WINDOW ( object );
- g_free ( window->priv->title );
g_free ( window->priv->filename );
+ g_free ( window->priv->file_title );
+ g_free ( window->priv->window_title );
G_OBJECT_CLASS ( grisbi_window_parent_class )->finalize ( object );
}
@@ -511,15 +515,13 @@ static void grisbi_window_add_recents_sub_menu ( GtkUIManager *ui_manager,
*
*
* */
-void grisbi_window_set_title ( GrisbiApp *app,
+void grisbi_window_set_window_title ( GrisbiWindow *window,
const gchar *title )
{
- GrisbiWindow *window;
+ if ( window->priv->window_title )
+ g_free ( window->priv->window_title );
- window = grisbi_app_get_active_window ( app );
-
- if ( window->priv->title )
- g_free ( window->priv->title );
+ window->priv->window_title = g_strdup ( title );
gtk_window_set_title ( GTK_WINDOW ( window ), title );
}
@@ -581,6 +583,41 @@ gboolean grisbi_window_set_filename ( GrisbiWindow *window,
return TRUE;
}
+
+/* TITLE OF FILE */
+/**
+ * retourne le titre du fichier associé à la fenêtre
+ *
+ * \param GrisbiWindow
+ *
+ * \return title
+ **/
+const gchar *grisbi_window_get_file_title ( GrisbiWindow *window )
+{
+ return window->priv->file_title;
+}
+
+/**
+ * définit le titre du fichier associé à la fenêtre
+ *
+ * \param GrisbiWindow
+ * \param title
+ *
+ * \return TRUE
+ **/
+gboolean grisbi_window_set_file_title ( GrisbiWindow *window,
+ const gchar *file_title )
+{
+ devel_debug ( file_title );
+
+ g_free ( window->priv->file_title );
+
+ window->priv->file_title = g_strdup ( file_title );
+
+ return TRUE;
+}
+
+
/* STATUS_BAR */
/**
* Create and return a new GtkStatusBar to hold various status
diff --git a/src/grisbi_window.h b/src/grisbi_window.h
index 97f362b..0c98549 100644
--- a/src/grisbi_window.h
+++ b/src/grisbi_window.h
@@ -50,6 +50,7 @@ GType grisbi_window_get_type ( void ) G_GNUC_CONST;
GtkActionGroup *grisbi_window_get_action_group ( GrisbiWindow *window,
const gchar *action_group_name );
const gchar *grisbi_window_get_filename ( GrisbiWindow *window );
+const gchar *grisbi_window_get_file_title ( GrisbiWindow *window );
GtkWidget *grisbi_window_get_headings_eb ( GrisbiWindow *window );
GtkWidget *grisbi_window_get_widget_by_name ( const gchar *name );
GtkUIManager *grisbi_window_get_ui_manager ( GrisbiWindow *window );
@@ -59,6 +60,10 @@ void grisbi_window_headings_update_label_markup ( gchar *label_name,
gboolean escape_text );
gboolean grisbi_window_set_filename ( GrisbiWindow *window,
const gchar *filename );
+gboolean grisbi_window_set_file_title ( GrisbiWindow *window,
+ const gchar *file_title );
+void grisbi_window_set_window_title ( GrisbiWindow *window,
+ const gchar *title );
void grisbi_window_statusbar_remove ( GrisbiWindow *window );
void grisbi_window_statusbar_push ( GrisbiWindow *window,
const gchar *msg );
diff --git a/src/gsb_assistant_file.c b/src/gsb_assistant_file.c
index 7ec2e39..e762afd 100644
--- a/src/gsb_assistant_file.c
+++ b/src/gsb_assistant_file.c
@@ -57,21 +57,19 @@
/*START_STATIC*/
static gboolean gsb_assistant_file_change_title ( GtkWidget *title_entry,
- GtkWidget *filename_entry );
+ GtkWidget *filename_entry );
static gboolean gsb_assistant_file_choose_filename ( GtkWidget *button,
- GtkWidget *entry );
+ GtkWidget *entry );
static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant );
static GtkWidget *gsb_assistant_file_page_3 ( GtkWidget *assistant );
static GtkWidget *gsb_assistant_file_page_4 ( GtkWidget *assistant );
static GtkWidget *gsb_assistant_file_page_5 ( GtkWidget *assistant );
static GtkWidget *gsb_assistant_file_page_finish ( GtkWidget *assistant,
- gboolean import );
+ gboolean import );
/*END_STATIC*/
/*START_EXTERN*/
extern gchar *adresse_commune;
-extern gchar *nom_fichier_comptes;
-extern gchar *titre_fichier;
/*END_EXTERN*/
enum file_assistant_page
@@ -104,7 +102,7 @@ static GtkWidget *button_create_account_next;
* \return a GtkResponseType containing the return value at the end of the assistant
* */
GtkResponseType gsb_assistant_file_run ( gboolean first_opening,
- gboolean import )
+ gboolean import )
{
GtkResponseType return_value;
GtkWidget *assistant;
@@ -263,16 +261,14 @@ static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant )
GtkWidget *button;
GtkWidget *table;
GtkWidget *filename_entry;
+ gchar *nom_fichier_comptes;
+ gchar *titre_fichier;
page = gtk_hbox_new (FALSE, 15);
- gtk_container_set_border_width ( GTK_CONTAINER (page),
- 10 );
+ gtk_container_set_border_width ( GTK_CONTAINER (page), 10 );
- vbox = new_vbox_with_title_and_icon ( _("General configuration"),
- "payees.png" );
- gtk_box_pack_start ( GTK_BOX (page),
- vbox,
- TRUE, TRUE, 0 );
+ vbox = new_vbox_with_title_and_icon ( _("General configuration"), "payees.png" );
+ gtk_box_pack_start ( GTK_BOX (page), vbox, TRUE, TRUE, 0 );
/* table 2x3 for layout */
table = gtk_table_new ( 2, 3, FALSE );
@@ -285,56 +281,56 @@ static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant )
/* label account name */
label = gtk_label_new ( _("Accounts file title: ") );
- gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
+ gtk_misc_set_alignment (GTK_MISC ( label ), 0, 1 );
gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
- gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1,
- GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+ gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, 0, 0, 0 );
- /* need to declare filename_entry first for the next callback,
- * if no filename, set the title.gsb as default name */
+ /* need to declare filename_entry first for the next callback,
+ * if no filename, set the title.gsb as default name */
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
if ( !nom_fichier_comptes )
{
gchar *tmp_str;
- tmp_str = g_strconcat ( titre_fichier, ".gsb", NULL );
+ tmp_str = g_strconcat ( grisbi_app_get_active_file_title (), ".gsb", NULL );
nom_fichier_comptes = g_build_filename ( gsb_dirs_get_home_dir ( ), tmp_str, NULL );
g_free ( tmp_str );
}
filename_entry = gsb_automem_entry_new ( &nom_fichier_comptes, NULL, NULL);
- entry = gsb_automem_entry_new (&titre_fichier,
- ((GCallback)gsb_assistant_file_change_title), filename_entry);
- g_object_set_data ( G_OBJECT (entry),
- "last_title", my_strdup (titre_fichier));
- gtk_table_attach ( GTK_TABLE ( table ), entry, 1, 3, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0 );
+ titre_fichier = (gchar *) grisbi_app_get_active_file_title ();
+ entry = gsb_automem_entry_new ( &titre_fichier,
+ ( (GCallback) gsb_assistant_file_change_title ),
+ filename_entry );
+ g_object_set_data ( G_OBJECT (entry), "last_title", my_strdup ( titre_fichier ) );
+ gtk_table_attach ( GTK_TABLE ( table ), entry, 1, 3, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0 );
/* filename */
label = gtk_label_new ( _("Filename: ") );
gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
- gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2,
- GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+ gtk_table_attach ( GTK_TABLE ( table ), label, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, 0, 0, 0 );
- gtk_table_attach ( GTK_TABLE ( table ), filename_entry, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, 0, 0, 0 );
+ gtk_table_attach ( GTK_TABLE ( table ), filename_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0 );
button = gtk_button_new_with_label ("...");
gtk_button_set_relief ( GTK_BUTTON (button), GTK_RELIEF_NONE );
- g_signal_connect ( G_OBJECT (button), "clicked",
- G_CALLBACK (gsb_assistant_file_choose_filename), filename_entry );
+ g_signal_connect ( G_OBJECT (button),
+ "clicked",
+ G_CALLBACK ( gsb_assistant_file_choose_filename ),
+ filename_entry );
- gtk_table_attach ( GTK_TABLE ( table ), button, 2, 3, 1, 2,
- GTK_SHRINK | GTK_FILL, 0, 0, 0 );
+ gtk_table_attach ( GTK_TABLE ( table ), button, 2, 3, 1, 2, GTK_SHRINK | GTK_FILL, 0, 0, 0 );
/* will we crypt the file ? */
if ( gsb_plugin_find ( "openssl" ) )
{
button = gsb_automem_checkbutton_new ( _("Encrypt Grisbi file"),
- &(etat.crypt_file), G_CALLBACK (gsb_gui_encryption_toggled), NULL);
- gtk_box_pack_start ( GTK_BOX ( paddingbox ), button,
- FALSE, FALSE, 0 );
+ &(etat.crypt_file),
+ G_CALLBACK (gsb_gui_encryption_toggled),
+ NULL );
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), button, FALSE, FALSE, 0 );
if ( etat.crypt_file )
run.new_crypted_file = TRUE;
@@ -356,17 +352,15 @@ static GtkWidget *gsb_assistant_file_page_2 ( GtkWidget *assistant )
/* Common address */
scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC );
- gtk_box_pack_start ( GTK_BOX ( paddingbox ), scrolled_window,
- FALSE, FALSE, 0);
- gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW(scrolled_window),
- GTK_SHADOW_IN );
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC );
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), scrolled_window, FALSE, FALSE, 0);
+ gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW ( scrolled_window ), GTK_SHADOW_IN );
textview = gsb_automem_textview_new ( &adresse_commune, NULL, NULL );
- gtk_container_add ( GTK_CONTAINER ( scrolled_window ),
- textview );
+ gtk_container_add ( GTK_CONTAINER ( scrolled_window ), textview );
gtk_widget_show_all (page);
+
return page;
}
@@ -478,7 +472,7 @@ static GtkWidget *gsb_assistant_file_page_5 ( GtkWidget *assistant )
* \return a GtkWidget containing the page
* */
static GtkWidget *gsb_assistant_file_page_finish ( GtkWidget *assistant,
- gboolean import )
+ gboolean import )
{
GtkWidget *page;
GtkWidget *vbox;
@@ -598,7 +592,7 @@ static gboolean gsb_assistant_file_change_title ( GtkWidget *title_entry,
* \return FALSE
* */
static gboolean gsb_assistant_file_choose_filename ( GtkWidget *button,
- GtkWidget *entry )
+ GtkWidget *entry )
{
GtkWidget *dialog;
gchar *tmpstr;
diff --git a/src/gsb_file.c b/src/gsb_file.c
index 4f00c3b..0a52e9a 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -70,7 +70,7 @@
static void gsb_file_append_name_to_opened_list ( gchar *path_fichier );
static gboolean gsb_file_automatic_backup ( gpointer null );
static gchar *gsb_file_dialog_ask_name ( void );
-static gint gsb_file_dialog_save ( void );
+static gint gsb_file_dialog_save ( gchar *filename );
static gboolean gsb_file_save_backup ( void );
static gboolean gsb_file_save_file ( gint origine );
static void gsb_file_save_remove_old_file ( gchar *filename );
@@ -88,9 +88,7 @@ gint id_timeout = 0;
/*START_EXTERN*/
extern gchar *copy_old_filename;
-extern gchar *nom_fichier_comptes;
extern GtkWidget *table_etat;
-extern gchar *titre_fichier;
extern GtkWidget *tree_view_vbox;
/*END_EXTERN*/
@@ -238,14 +236,18 @@ gboolean gsb_file_open_menu ( void )
switch ( gtk_dialog_run ( GTK_DIALOG ( selection_fichier) ) )
{
case GTK_RESPONSE_OK:
- if ( gsb_file_close() )
+ if ( gsb_file_close () )
{
+ gchar *nom_fichier_comptes;
+
gtk_widget_hide ( selection_fichier );
nom_fichier_comptes = file_selection_get_filename ( GTK_FILE_CHOOSER ( selection_fichier ) );
gsb_file_update_last_path ( file_selection_get_last_directory (
GTK_FILE_CHOOSER ( selection_fichier ),
TRUE ) );
gsb_file_open_file ( nom_fichier_comptes );
+
+ g_free ( nom_fichier_comptes );
}
break;
default:
@@ -338,6 +340,7 @@ gboolean gsb_file_open_direct_menu ( GtkMenuItem *item,
GrisbiApp *app;
GrisbiAppConf *conf;
gint file_number;
+ gchar *nom_fichier_comptes;
/* continue only if can close the current file */
if ( !gsb_file_close ( ) )
@@ -350,6 +353,7 @@ gboolean gsb_file_open_direct_menu ( GtkMenuItem *item,
nom_fichier_comptes = my_strdup ( conf->tab_noms_derniers_fichiers_ouverts[file_number] );
gsb_file_open_file ( nom_fichier_comptes );
+ g_free ( nom_fichier_comptes );
return FALSE;
}
@@ -446,7 +450,7 @@ gboolean gsb_file_open_file ( gchar *filename )
}
/* on fixe le nom de fichier associé à la fenêtre active */
- grisbi_app_set_active_filename ( nom_fichier_comptes );
+ grisbi_app_set_active_filename ( filename );
/* ok, here the file or backup is loaded */
gsb_status_message ( _("Checking schedulers") );
@@ -538,6 +542,7 @@ gboolean gsb_file_save_file ( gint origine )
{
gint etat_force, result;
gchar *nouveau_nom_enregistrement;
+ gchar *nom_fichier_comptes = NULL;
GrisbiAppConf *conf;
devel_debug_int (origine);
@@ -555,9 +560,13 @@ gboolean gsb_file_save_file ( gint origine )
/* si le fichier de comptes n'a pas de nom ou si on enregistre sous un nouveau nom */
/* c'est ici */
-
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
if ( !nom_fichier_comptes || origine == -2 )
+ {
nouveau_nom_enregistrement = gsb_file_dialog_ask_name ();
+ if ( origine == -2 )
+ g_free ( nom_fichier_comptes );
+ }
else
nouveau_nom_enregistrement = nom_fichier_comptes;
@@ -577,7 +586,7 @@ gboolean gsb_file_save_file ( gint origine )
tmpstr1 = g_strdup_printf( _("Grisbi was unable to save this file because it is locked. "
"Please save it with another name or activate the \"%s\" option in preferences."),
("Force saving of locked files" ) );
- tmpstr2 = g_strdup_printf( _("Can not save file \"%s\""), nom_fichier_comptes );
+ tmpstr2 = g_strdup_printf( _("Can not save file \"%s\""), nouveau_nom_enregistrement );
dialogue_error_hint ( tmpstr1, tmpstr2 );
g_free ( tmpstr1 );
@@ -611,7 +620,7 @@ gboolean gsb_file_save_file ( gint origine )
/* saving was right, so unlock the last name */
gsb_file_util_modify_lock ( FALSE );
- nom_fichier_comptes = nouveau_nom_enregistrement;
+ grisbi_app_set_active_filename ( nouveau_nom_enregistrement );
/* and lock the new name */
gsb_file_util_modify_lock ( TRUE );
@@ -620,7 +629,9 @@ gboolean gsb_file_save_file ( gint origine )
etat.fichier_deja_ouvert = 0;
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 );
+ gsb_file_append_name_to_opened_list ( nouveau_nom_enregistrement );
+
+ g_free ( nouveau_nom_enregistrement );
}
gsb_status_message ( _("Done") );
@@ -643,6 +654,7 @@ gboolean gsb_file_save_backup ( void )
struct tm *day_time;
time_t temps;
gchar *name;
+ gchar *nom_fichier_comptes;
GrisbiAppConf *conf;
conf = grisbi_app_get_conf ( );
@@ -654,7 +666,8 @@ gboolean gsb_file_save_backup ( void )
gsb_status_message ( _("Saving backup") );
- name = g_path_get_basename (nom_fichier_comptes);
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+ name = g_path_get_basename ( nom_fichier_comptes );
if ( g_str_has_suffix ( name, ".gsb" ) )
{
gchar **tab_str;
@@ -696,6 +709,7 @@ gboolean gsb_file_save_backup ( void )
g_free (filename);
g_free (name);
+ g_free ( nom_fichier_comptes );
gsb_status_message ( _("Done") );
@@ -785,13 +799,13 @@ gboolean gsb_file_automatic_backup ( gpointer null )
devel_debug (NULL);
conf = grisbi_app_get_conf ( );
- if (!conf->make_backup_every_minutes)
- /* stop the timeout */
- return FALSE;
+ if ( !conf->make_backup_every_minutes )
+ /* stop the timeout */
+ return FALSE;
/* we save only if there is a nb of minutes, but don't stop the timer if not */
- if (conf->make_backup_nb_minutes)
- gsb_file_save_backup ();
+ if ( conf->make_backup_nb_minutes )
+ gsb_file_save_backup ();
return TRUE;
}
@@ -805,7 +819,7 @@ gboolean gsb_file_automatic_backup ( gpointer null )
*
* \return GTK_RESPONSE_OK to save, GTK_RESPONSE_NO not to save, other to cancel
* */
-static gint gsb_file_dialog_save ( void )
+static gint gsb_file_dialog_save ( gchar *filename )
{
gchar * hint;
gchar* time_elapsed;
@@ -828,8 +842,10 @@ static gint gsb_file_dialog_save ( void )
&&
( !etat.fichier_deja_ouvert || conf->force_enregistrement )
&&
- nom_fichier_comptes )
- return GTK_RESPONSE_OK;
+ filename )
+ {
+ return GTK_RESPONSE_OK;
+ }
/* si le fichier était déjà locké et que force enregistrement n'est pas mis, */
/* on prévient ici */
@@ -845,7 +861,7 @@ static gint gsb_file_dialog_save ( void )
message = g_strdup_printf ( _("The document '%s' is locked but modified. "
"If you want to save it, you must cancel and save it with "
"another name or activate the \"%s\" option in setup."),
- ( nom_fichier_comptes ? g_path_get_basename ( nom_fichier_comptes ) : _("unnamed") ),
+ ( filename ? g_path_get_basename ( filename ) : _("unnamed") ),
_("Force saving of locked files") );
gtk_dialog_add_buttons ( GTK_DIALOG ( dialog ),
@@ -857,7 +873,7 @@ static gint gsb_file_dialog_save ( void )
else
{
hint = g_strdup_printf ( _("Save changes to document '%s' before closing?"),
- ( nom_fichier_comptes ? g_path_get_basename ( nom_fichier_comptes ) : _("unnamed") ) );
+ ( filename ? g_path_get_basename ( filename ) : _("unnamed") ) );
message = g_strdup("");
gtk_dialog_add_buttons ( GTK_DIALOG(dialog),
@@ -916,30 +932,34 @@ static gint gsb_file_dialog_save ( void )
static gchar *gsb_file_dialog_ask_name ( void )
{
gchar *new_name;
+ gchar *nom_fichier_comptes;
GtkWidget *dialog;
gint result;
dialog = gtk_file_chooser_dialog_new ( _("Name the accounts file"),
- GTK_WINDOW ( grisbi_app_get_active_window ( NULL ) ),
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_OK,
- NULL);
+ GTK_WINDOW ( grisbi_app_get_active_window ( NULL ) ),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+ NULL);
gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER ( dialog ), gsb_file_get_last_path () );
gtk_file_chooser_set_do_overwrite_confirmation ( GTK_FILE_CHOOSER ( dialog ), TRUE);
gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
- if ( ! nom_fichier_comptes )
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+ if ( !nom_fichier_comptes )
{
gchar* tmp_str;
- tmp_str = g_strconcat ( titre_fichier, ".gsb", NULL );
+ tmp_str = g_strconcat ( grisbi_app_get_active_file_title (), ".gsb", NULL );
gtk_file_chooser_set_current_name ( GTK_FILE_CHOOSER ( dialog ), tmp_str);
g_free ( tmp_str );
}
else
- gtk_file_chooser_select_filename ( GTK_FILE_CHOOSER (dialog), nom_fichier_comptes );
+ gtk_file_chooser_select_filename ( GTK_FILE_CHOOSER (dialog), nom_fichier_comptes );
+
+ g_free ( nom_fichier_comptes );
result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
@@ -959,8 +979,9 @@ static gchar *gsb_file_dialog_ask_name ( void )
if ( ! g_strrstr ( new_name, "." ) )
{
gchar* tmpstr = new_name;
- new_name = g_strconcat ( tmpstr, ".gsb", NULL );
- g_free ( tmpstr );
+
+ new_name = g_strconcat ( tmpstr, ".gsb", NULL );
+ g_free ( tmpstr );
}
return new_name;
@@ -978,6 +999,7 @@ static gchar *gsb_file_dialog_ask_name ( void )
* */
gboolean gsb_file_close ( void )
{
+ gchar *nom_fichier_comptes = NULL;
gint result;
devel_debug (NULL);
@@ -985,8 +1007,10 @@ gboolean gsb_file_close ( void )
if ( !assert_account_loaded () )
return ( TRUE );
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+
/* ask for saving */
- result = gsb_file_dialog_save();
+ result = gsb_file_dialog_save ( nom_fichier_comptes );
switch ( result )
{
@@ -994,7 +1018,11 @@ gboolean gsb_file_close ( void )
/* try to save */
if ( !gsb_file_save_file (-1) )
+ {
+ g_free ( nom_fichier_comptes );
+
return ( FALSE );
+ }
case GTK_RESPONSE_NO :
/* remove the lock */
@@ -1004,11 +1032,12 @@ gboolean gsb_file_close ( void )
&&
nom_fichier_comptes )
gsb_file_util_modify_lock ( FALSE );
+ g_free ( nom_fichier_comptes );
/* free all the variables */
- init_variables ();
+/* init_variables ();
gsb_account_property_clear_config ( );
-
+*/
gsb_main_set_grisbi_title ( -1 );
menus_sensitifs ( FALSE );
@@ -1049,20 +1078,7 @@ void gsb_file_append_name_to_opened_list ( gchar *path_fichier )
if ( conf->nb_derniers_fichiers_ouverts < 0 )
conf->nb_derniers_fichiers_ouverts = 0;
- if ( nom_fichier_comptes && !g_path_is_absolute ( nom_fichier_comptes ) )
- {
- real_name = g_strdup( (gchar*)realpath ( nom_fichier_comptes, NULL ));
- if ( ! real_name )
- {
- notice_debug ( "could not resolve relative file name" );
- return;
- }
- devel_debug ( real_name );
- }
- else
- {
- real_name = g_strdup ( path_fichier );
- }
+ real_name = g_strdup ( path_fichier );
/* on commence par vérifier si ce fichier n'est pas dans les nb_derniers_fichiers_ouverts
* noms */
diff --git a/src/gsb_file_config.c b/src/gsb_file_config.c
index 26113f2..676a76c 100644
--- a/src/gsb_file_config.c
+++ b/src/gsb_file_config.c
@@ -58,7 +58,6 @@ static void gsb_file_config_clean_config ( GrisbiAppConf *conf );
/*START_EXTERN*/
extern struct conditional_message delete_msg[];
extern struct conditional_message messages[];
-extern gchar *nom_fichier_comptes;
/*END_EXTERN*/
@@ -303,10 +302,6 @@ gboolean gsb_file_config_load_config ( GrisbiAppConf *conf )
"Names last files",
&conf->nb_derniers_fichiers_ouverts,
NULL );
- if ( conf->tab_noms_derniers_fichiers_ouverts )
- nom_fichier_comptes = my_strdup ( conf->tab_noms_derniers_fichiers_ouverts [0]);
- else
- nom_fichier_comptes = NULL;
conf->check_for_archival = g_key_file_get_integer ( con niers_fichiers_ouverts [0]); erts ); med") ) ); ; rüL!+ På½ÿ Àå½ÿ u
üL!+ *ýL!+ %M!+ N!+ Àå½ÿ 0;N!+ °Ú½ÿ Ù½ÿ k üL!+ 6 è è! è! På½ÿ Àå½ÿ xÔN!+ °Û½ÿ üL!+ üL!+ På½ÿ `üL!+ å½ÿ ÀÏ|N!+ u
üL!+ À|N!+ ØÄ|N!+ ¨É|N!+ *ýL!+ xÔN!+ °Û½ÿ Ú½ÿ k üL!+ à! à! På½ÿ Àå½ÿ HøM!+ ܽÿ üL!+ üL!+ På½ÿ `üL!+ å½ÿ å½ÿ xå½ÿ 8+M!+ p Àå½ÿ u
üL!+ *ýL!+ ܽÿ `Û½ÿ k üL!+ G H I J K M N O P På½ÿ Àå½ÿ HUÏM!+ 0Þ½ÿ üL!+ üL!+ På½ÿ 0Ï|N!+ u
üL!+ àN!+ ¬M!+ À|N!+ ØÄ|N!+ ¨É|N!+ *ýL!+ HUÏM!+ 0Þ½ÿ pܽÿ k üL!+ 8UÏM!+ 0Þ½ÿ ܽÿ k üL!+ (UÏM!+ 0Þ½ÿ Ðܽÿ k üL!+ UÏM!+ 0Þ½ÿ ݽÿ k üL!+ ¨Î|N!+ u
üL!+ ¨É|N!+ ×½ÿ جM!+ e üL!+ ØÄ|N!+ ݽÿ yجM!+ e üL!+ À|N!+ Ðݽÿ ZجM!+ e üL!+ جM!+ àN!+ ¬M!+ À|N!+ ØäN!+ ØÄ|N!+ ¨É|N!+ *ýL!+ 8+M!+ MxM!+ Àå½ÿ p¬M!+ ß½ÿ PÞ½ÿ k üL!+ 5 6 7 8 : < = > ? @ B D På½ÿ Àå½ÿ àMuM!+ Àå½ÿ u
üL!+ %M!+ Þ½ÿ MxM!+ e üL!+ %M!+ Õ_ at fÆS Qöl±íÁcDM!+ Àå½ÿ àMuM!+ à½ÿ `ß½ÿ k üL!+ u]ÞÓ 4Q ÷U^Qʧ ¶uª¹ñìò*ÄvPå½ÿ Àå½ÿ HAM!+ ä}M!+ ç½ÿ ¦ðßN!+ ¦ðßN!+ 6{M!+ å½ÿ Àæ½ÿ xå½ÿ àá½ÿ ïN!+ u
üL!+ ØäN!+ @è½ÿ ¢ðßN!+ ç½ÿ â½ÿ ÿÿÿÿÿÿÿÿ¢ðßN!+ Èå½ÿ fig,
"IO",
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index e28e069..18f0cf9 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -187,7 +187,6 @@ extern gint no_devise_totaux_ib;
extern gint no_devise_totaux_tiers;
extern gsb_real null_real;
extern gint tab_affichage_ope[TRANSACTION_LIST_ROWS_NB][CUSTOM_MODEL_VISIBLE_COLUMNS];
-extern gchar *titre_fichier;
extern gint transaction_col_align[CUSTOM_MODEL_VISIBLE_COLUMNS];
extern gint transaction_col_width[CUSTOM_MODEL_VISIBLE_COLUMNS];
extern gint valeur_echelle_recherche_date_import;
@@ -896,7 +895,7 @@ void gsb_file_load_general_part ( const gchar **attribute_names,
}
else if ( !strcmp ( attribute_names[i], "File_title" ) && strlen (attribute_values[i]))
- titre_fichier = my_strdup (attribute_values[i]);
+ grisbi_app_set_active_file_title ( attribute_values[i] );
else
unknown = 1;
@@ -6659,9 +6658,8 @@ void gsb_file_load_general_part_before_0_6 ( GMarkupParseContext *context,
if ( !strcmp ( element_name,
"Titre" ))
{
- g_free ( titre_fichier );
- titre_fichier = my_strdup (text);
- return;
+ grisbi_app_set_active_file_title ( text );
+ return;
}
if ( !strcmp ( element_name,
diff --git a/src/gsb_file_save.c b/src/gsb_file_save.c
index eacc358..7769cc9 100644
--- a/src/gsb_file_save.c
+++ b/src/gsb_file_save.c
@@ -47,6 +47,7 @@
#include "bet_data_finance.h"
#include "bet_graph.h"
#include "dialog.h"
+#include "grisbi_app.h"
#include "gsb_color.h"
#include "gsb_data_account.h"
#include "gsb_data_archive.h"
@@ -165,7 +166,6 @@ extern gint no_devise_totaux_ib;
extern gint no_devise_totaux_tiers;
extern gint scheduler_col_width[SCHEDULER_COL_VISIBLE_COLUMNS];
extern gint tab_affichage_ope[TRANSACTION_LIST_ROWS_NB][CUSTOM_MODEL_VISIBLE_COLUMNS];
-extern gchar *titre_fichier;
extern gint transaction_col_align[CUSTOM_MODEL_VISIBLE_COLUMNS];
extern gint transaction_col_width[CUSTOM_MODEL_VISIBLE_COLUMNS];
extern gint valeur_echelle_recherche_date_import;
@@ -782,7 +782,7 @@ gulong gsb_file_save_general_part ( gulong iterator,
my_safe_null_str(VERSION),
etat.crypt_file,
is_archive,
- my_safe_null_str ( titre_fichier ),
+ my_safe_null_str ( grisbi_app_get_active_file_title () ),
my_safe_null_str(adresse_commune),
my_safe_null_str(adresse_secondaire),
my_safe_null_str ( date_format ),
diff --git a/src/gsb_file_util.c b/src/gsb_file_util.c
index 948edcc..d0de5ac 100644
--- a/src/gsb_file_util.c
+++ b/src/gsb_file_util.c
@@ -1,21 +1,24 @@
-/* file gsb_file_util.c
- * used to save the gsb files */
-/* Copyright (C) 2000-2005 Cédric Auger (cedric at grisbi.org) */
-/* http://www.grisbi.org */
-
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of the GNU General Public License as published by */
-/* the Free Software Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-
-/* This program is distributed in the hope that it will be useful, */
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
-/* GNU General Public License for more details. */
-
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* ************************************************************************** */
+/* */
+/* Copyright (C) 2001-2008 Cédric Auger (cedric at grisbi.org) */
+/* 2009-2012 Pierre Biava (grisbi at pierre.biava.name) */
+/* http://www.grisbi.org */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* */
+/* ************************************************************************** */
#ifdef HAVE_CONFIG_H
@@ -30,6 +33,7 @@
/*START_INCLUDE*/
#include "gsb_file_util.h"
#include "dialog.h"
+#include "grisbi_app.h"
#include "gsb_data_account.h"
#include "gsb_data_transaction.h"
#include "gsb_file.h"
@@ -45,7 +49,6 @@
/*START_EXTERN*/
extern struct conditional_message messages[];
-extern gchar *nom_fichier_comptes;
/*END_EXTERN*/
@@ -108,8 +111,8 @@ gboolean gsb_file_util_test_overwrite ( const gchar *filename )
* \return TRUE all is ok, FALSE a problem occured
* */
gboolean gsb_file_util_get_contents ( gchar *filename,
- gchar **file_content,
- gulong *length )
+ gchar **file_content,
+ gulong *length )
{
gzFile file;
struct stat stat_buf;
@@ -282,21 +285,33 @@ void switch_t_r ( void )
* */
gboolean gsb_file_util_modify_lock ( gboolean create_lock )
{
+ gchar *nom_fichier_comptes;
gchar *lock_filename;
devel_debug_int ( create_lock );
+
/* if the file was already opened we do nothing */
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
+
if ( ( etat.fichier_deja_ouvert )
||
!nom_fichier_comptes
||
strlen ( nom_fichier_comptes) == 0 )
+ {
+ g_free ( nom_fichier_comptes );
+
return TRUE;
+ }
/* Check if nom_fichier_comptes exists. If not, this is a new
* file so don't try to lock it. */
if ( !g_file_test ( nom_fichier_comptes, G_FILE_TEST_EXISTS ) )
+ {
+ g_free ( nom_fichier_comptes );
+
return FALSE;
+ }
/* Create the name of the lock file */
lock_filename = g_strconcat ( g_get_tmp_dir ( ),
@@ -321,6 +336,8 @@ gboolean gsb_file_util_modify_lock ( gboolean create_lock )
/* the lock is already created, return TRUE */
etat.fichier_deja_ouvert = 1;
+ g_free ( nom_fichier_comptes );
+
return TRUE;
}
@@ -337,6 +354,7 @@ gboolean gsb_file_util_modify_lock ( gboolean create_lock )
g_strerror ( errno ) );
dialogue_error ( tmp_str );
g_free ( tmp_str );
+ g_free ( nom_fichier_comptes );
return FALSE;
}
@@ -364,6 +382,7 @@ gboolean gsb_file_util_modify_lock ( gboolean create_lock )
g_strerror ( errno ) );
dialogue_error ( tmp_str );
g_free ( tmp_str );
+ g_free ( nom_fichier_comptes );
return FALSE;
}
@@ -373,39 +392,12 @@ gboolean gsb_file_util_modify_lock ( gboolean create_lock )
{
/* si le fichier est déjà ouvert on ne fait rien */
etat.fichier_deja_ouvert = 0;
- return TRUE;
- }
-}
+ g_free ( nom_fichier_comptes );
-/**
- *
- * called when loading a file, if the permissions are not set only for the user
- * propose to change the permissions
- *
- * \param
- *
- * \return
- * */
-void gsb_file_util_change_permissions ( void )
-{
- /* On Windows, the chmod feature does not work: FAT does not
- * have right access permission notions , on NTFS it to
- * complicated to implement => the feature is removed from the
- * Windows version : for that the corresponding parameter
- * check box is not displayed and the paramater is forced to
- * not display msg. */
- devel_debug (NULL);
-
-#ifndef _WIN32
- if ( question_conditional_yes_no ( "account-file-readable" ) == TRUE )
- {
- chmod ( nom_fichier_comptes, S_IRUSR | S_IWUSR );
+ return TRUE;
}
-
-#endif /* _WIN32 */
}
-
/**
*
* called when loading a file, if the permissions are not set only for the user
diff --git a/src/gsb_file_util.h b/src/gsb_file_util.h
index 0c4f03d..6eff97c 100644
--- a/src/gsb_file_util.h
+++ b/src/gsb_file_util.h
@@ -7,11 +7,10 @@
/* END_INCLUDE_H */
/* START_DECLARATION */
-void gsb_file_util_change_permissions ( void );
void gsb_file_util_display_warning_permissions ( void );
gboolean gsb_file_util_get_contents ( gchar *filename,
- gchar **file_content,
- gulong *length );
+ gchar **file_content,
+ gulong *length );
gboolean gsb_file_util_modify_lock ( gboolean create_lock );
gboolean gsb_file_util_test_overwrite ( const gchar *filename );
void switch_t_r ( void );
diff --git a/src/main.c b/src/main.c
index 773ba82..972497e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -77,8 +77,6 @@ static void gsb_main_window_set_size_and_position ( void );
/*START_EXTERN*/
-extern gchar *nom_fichier_comptes;
-extern gchar *titre_fichier;
/*END_EXTERN*/
/* variables initialisées lors de l'exécution de grisbi */
@@ -258,7 +256,7 @@ void gsb_main_load_file_if_necessary ( GrisbiCommandLine *command_line )
}
else
{
- /* open the last file if needed, nom_fichier_comptes was filled while loading the configuration */
+ /* open the last file if needed */
if ( conf->dernier_fichier_auto && conf->tab_noms_derniers_fichiers_ouverts[0] )
{
gsb_file_open_file ( conf->tab_noms_derniers_fichiers_ouverts[0] );
@@ -366,6 +364,8 @@ static void gsb_main_window_destroy_event ( GObject* obj, gpointer data)
* */
gboolean gsb_main_set_grisbi_title ( gint account_number )
{
+ gchar *nom_fichier_comptes;
+ const gchar *titre_fichier;
gchar *titre_grisbi = NULL;
gchar *titre = NULL;
gint tmp_number;
@@ -375,6 +375,8 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
devel_debug_int ( account_number );
conf = grisbi_app_get_conf ( );
+ titre_fichier = grisbi_app_get_active_file_title ();
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
if ( nom_fichier_comptes == NULL )
{
titre_grisbi = g_strdup ( _("Grisbi") );
@@ -385,8 +387,10 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
switch ( conf->display_grisbi_title )
{
case GSB_ACCOUNTS_TITLE:
+ {
if ( titre_fichier && strlen ( titre_fichier ) )
titre = g_strdup ( titre_fichier );
+ }
break;
case GSB_ACCOUNT_HOLDER:
{
@@ -415,6 +419,8 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
break;
}
+ g_free ( nom_fichier_comptes );
+
if ( titre && strlen ( titre ) > 0 )
{
titre_grisbi = g_strconcat ( titre, " - ", _("Grisbi"), NULL );
@@ -428,7 +434,7 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
return_value = FALSE;
}
}
-/* gtk_window_set_title ( GTK_WINDOW ( main_window ), titre_grisbi ); */
+ grisbi_app_set_active_title ( titre_grisbi );
gsb_main_page_update_homepage_title ( titre_grisbi );
diff --git a/src/parametres.c b/src/parametres.c
index 5f78c91..3ac6bf8 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -130,7 +130,6 @@ extern GtkWidget *account_page;
extern struct conditional_message delete_msg[];
extern struct conditional_message messages[];
extern gint mise_a_jour_liste_comptes_accueil;
-extern gchar *nom_fichier_comptes;
/*END_EXTERN*/
@@ -708,8 +707,15 @@ GtkWidget *onglet_messages_and_warnings ( void )
GtkTreeIter iter;
if ( g_utf8_collate ( messages[i].name, "account-already-opened" ) == 0 )
+ {
+ gchar *nom_fichier_comptes;
+
+ nom_fichier_comptes = g_strdup ( grisbi_app_get_active_filename () );
tmpstr = g_strdup_printf ( _(messages[i] . hint),
g_path_get_basename ( nom_fichier_comptes ) );
+
+ g_free ( nom_fichier_comptes );
+ }
else if ( g_utf8_collate ( messages[i].name, "development-version" ) == 0 )
tmpstr = g_strdup_printf ( _(messages[i] . message), VERSION );
else
diff --git a/src/tests/main_cunit.c b/src/tests/main_cunit.c
index b7fea38..28bb9f1 100644
--- a/src/tests/main_cunit.c
+++ b/src/tests/main_cunit.c
@@ -53,14 +53,13 @@
*/
GtkWidget *window = NULL;
struct gsb_run_t run;
-extern gchar *nom_fichier_comptes;
gboolean gsb_main_grisbi_close( void )
{
return FALSE;
}
gboolean gsb_main_set_grisbi_title ( gint account_number )
{
- return FALSE;
+ return FALSE;
}
gchar *gsb_main_get_print_locale_var(void) { return NULL; }
gchar *gsb_main_get_print_dir_var(void) { return NULL; }
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index 2b949ed..15fc001 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -92,8 +92,6 @@ static void initialise_number_separators ( void );
static void initialise_tab_affichage_ope ( void );
/*END_STATIC*/
-gchar *nom_fichier_comptes = NULL;
-
gchar *titre_fichier = NULL;
gchar *adresse_commune = NULL;
gchar *adresse_secondaire = NULL;
@@ -206,10 +204,6 @@ void init_variables ( void )
orphan_child_transactions = NULL;
- if ( nom_fichier_comptes )
- g_free ( nom_fichier_comptes );
- nom_fichier_comptes = NULL;
-
affichage_echeances = SCHEDULER_PERIODICITY_ONCE_VIEW;
affichage_echeances_perso_nb_libre = 0;
affichage_echeances_perso_j_m_a = PERIODICITY_DAYS;
hooks/post-receive
--
grisbi
More information about the cvs
mailing list