gnc-file.c (gnucash-5.0.tar.bz2) | : | gnc-file.c (gnucash-5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
#include "dialog-utils.h" | #include "dialog-utils.h" | |||
#include "assistant-xml-encoding.h" | #include "assistant-xml-encoding.h" | |||
#include "gnc-commodity.h" | #include "gnc-commodity.h" | |||
#include "gnc-component-manager.h" | #include "gnc-component-manager.h" | |||
#include "gnc-engine.h" | #include "gnc-engine.h" | |||
#include "Account.h" | #include "Account.h" | |||
#include "gnc-file.h" | #include "gnc-file.h" | |||
#include "gnc-features.h" | #include "gnc-features.h" | |||
#include "gnc-filepath-utils.h" | #include "gnc-filepath-utils.h" | |||
#include "gnc-glib-utils.h" | ||||
#include "gnc-gui-query.h" | #include "gnc-gui-query.h" | |||
#include "gnc-hooks.h" | #include "gnc-hooks.h" | |||
#include "gnc-keyring.h" | #include "gnc-keyring.h" | |||
#include "gnc-splash.h" | #include "gnc-splash.h" | |||
#include "gnc-ui.h" | #include "gnc-ui.h" | |||
#include "gnc-ui-balances.h" | ||||
#include "gnc-ui-util.h" | #include "gnc-ui-util.h" | |||
#include "gnc-uri-utils.h" | #include "gnc-uri-utils.h" | |||
#include "gnc-window.h" | #include "gnc-window.h" | |||
#include "gnc-plugin-file-history.h" | #include "gnc-plugin-file-history.h" | |||
#include "qof.h" | #include "qof.h" | |||
#include "Scrub.h" | #include "Scrub.h" | |||
#include "ScrubBudget.h" | #include "ScrubBudget.h" | |||
#include "TransLog.h" | #include "TransLog.h" | |||
#include "gnc-session.h" | #include "gnc-session.h" | |||
#include "gnc-state.h" | #include "gnc-state.h" | |||
skipping to change at line 695 | skipping to change at line 697 | |||
/* Fall through */ | /* Fall through */ | |||
case GTK_RESPONSE_OK: | case GTK_RESPONSE_OK: | |||
return TRUE; | return TRUE; | |||
} | } | |||
} | } | |||
return TRUE; | return TRUE; | |||
} | } | |||
static char* | ||||
get_account_sep_warning (QofBook *book) | ||||
{ | ||||
const char *sep = gnc_get_account_separator_string (); | ||||
GList *violation_accts = gnc_account_list_name_violations (book, sep); | ||||
if (!violation_accts) | ||||
return NULL; | ||||
gchar *rv = gnc_account_name_violations_errmsg (sep, violation_accts); | ||||
g_list_free_full (violation_accts, g_free); | ||||
return rv; | ||||
} | ||||
/* private utilities for file open; done in two stages */ | /* private utilities for file open; done in two stages */ | |||
#define RESPONSE_NEW 1 | #define RESPONSE_NEW 1 | |||
#define RESPONSE_OPEN 2 | #define RESPONSE_OPEN 2 | |||
#define RESPONSE_QUIT 3 | #define RESPONSE_QUIT 3 | |||
#define RESPONSE_READONLY 4 | #define RESPONSE_READONLY 4 | |||
#define RESPONSE_FILE 5 | #define RESPONSE_FILE 5 | |||
/* This function is called after loading datafile. It's meant to | /* This function is called after loading datafile. It's meant to | |||
collect all scrubbing routines. */ | collect all scrubbing routines. */ | |||
static void | static void | |||
run_post_load_scrubs (GtkWindow *parent, QofBook *book) | run_post_load_scrubs (GtkWindow *parent, QofBook *book) | |||
{ | { | |||
const char *budget_warning = | ||||
_("This book has budgets. The internal representation of " | ||||
"budget amounts no longer depends on the Reverse Balanced " | ||||
"Accounts preference. Please review the budgets and amend " | ||||
"signs if necessary."); | ||||
GList *infos = NULL; | ||||
qof_event_suspend(); | qof_event_suspend(); | |||
/* If feature GNC_FEATURE_BUDGET_UNREVERSED is not set, and there | /* If feature GNC_FEATURE_BUDGET_UNREVERSED is not set, and there | |||
are budgets, fix signs */ | are budgets, fix signs */ | |||
if (gnc_maybe_scrub_all_budget_signs (book)) | if (gnc_maybe_scrub_all_budget_signs (book)) | |||
gnc_info_dialog (parent, "%s", _( | infos = g_list_prepend (infos, g_strdup (budget_warning)); | |||
"This book has budgets. The internal representation | ||||
of " | ||||
"budget amounts no longer depends on the Reverse Ba | ||||
lanced " | ||||
"Accounts preference. Please review the budgets and | ||||
amend " | ||||
"signs if necessary.")); | ||||
// Fix account color slots being set to 'Not Set', should run once on a book | // Fix account color slots being set to 'Not Set', should run once on a book | |||
xaccAccountScrubColorNotSet (book); | xaccAccountScrubColorNotSet (book); | |||
/* Check for account names that may contain the current separator character | ||||
* and inform the user if there are any */ | ||||
char *sep_warning = get_account_sep_warning (book); | ||||
if (sep_warning) | ||||
infos = g_list_prepend (infos, sep_warning); | ||||
qof_event_resume(); | qof_event_resume(); | |||
if (!infos) | ||||
return; | ||||
const char *header = N_("The following are noted in this file:"); | ||||
infos = g_list_reverse (infos); | ||||
infos = g_list_prepend (infos, g_strdup (_(header))); | ||||
char *final = gnc_g_list_stringjoin (infos, "\n\n• "); | ||||
gnc_info_dialog (parent, "%s", final); | ||||
g_free (final); | ||||
g_list_free_full (infos, g_free); | ||||
} | } | |||
static gboolean | static gboolean | |||
gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readon ly) | gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readon ly) | |||
{ | { | |||
QofSession *new_session; | QofSession *new_session; | |||
QofBook *new_book; | ||||
GList *invalid_account_names; | ||||
gboolean uh_oh = FALSE; | gboolean uh_oh = FALSE; | |||
char * newfile; | char * newfile; | |||
QofBackendError io_err = ERR_BACKEND_NO_ERR; | QofBackendError io_err = ERR_BACKEND_NO_ERR; | |||
gchar *scheme = NULL; | gchar *scheme = NULL; | |||
gchar *hostname = NULL; | gchar *hostname = NULL; | |||
gchar *username = NULL; | gchar *username = NULL; | |||
gchar *password = NULL; | gchar *password = NULL; | |||
gchar *path = NULL; | gchar *path = NULL; | |||
gint32 port = 0; | gint32 port = 0; | |||
skipping to change at line 1113 | skipping to change at line 1148 | |||
gnc_add_history (new_session); | gnc_add_history (new_session); | |||
g_free (newfile); | g_free (newfile); | |||
qof_event_resume (); | qof_event_resume (); | |||
gnc_gui_refresh_all (); | gnc_gui_refresh_all (); | |||
/* Call this after re-enabling events. */ | /* Call this after re-enabling events. */ | |||
gnc_book_opened (); | gnc_book_opened (); | |||
/* Check for account names that may contain the current separator character | run_post_load_scrubs (parent, gnc_get_current_book ()); | |||
* and inform the user if there are any */ | ||||
new_book = gnc_get_current_book(); | ||||
invalid_account_names = gnc_account_list_name_violations ( new_book, | ||||
gnc_get_account_separator_string() ); | ||||
if ( invalid_account_names ) | ||||
{ | ||||
gchar *message = gnc_account_name_violations_errmsg ( gnc_get_account_se | ||||
parator_string(), | ||||
invalid_account_names ); | ||||
gnc_warning_dialog(parent, "%s", message); | ||||
g_free ( message ); | ||||
g_list_free_full (invalid_account_names, g_free); | ||||
} | ||||
run_post_load_scrubs (parent, new_book); | ||||
return TRUE; | return TRUE; | |||
} | } | |||
/* Routine that pops up a file chooser dialog | /* Routine that pops up a file chooser dialog | |||
* | * | |||
* Note: this dialog is used when dbi is not enabled | * Note: this dialog is used when dbi is not enabled | |||
* so the paths used in here are always file | * so the paths used in here are always file | |||
* paths, never db uris. | * paths, never db uris. | |||
*/ | */ | |||
End of changes. 9 change blocks. | ||||
26 lines changed or deleted | 43 lines changed or added |