2002-11-17 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/gnc-hbci-utils.c: Fix caching of HBCI_API
	when using multiple files one after another.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7490 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2002-11-17 21:30:18 +00:00
parent 2b63cf523a
commit 4af385183c
3 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2002-11-17 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gnc-hbci-utils.c: Fix caching of HBCI_API
when using multiple files one after another.
2002-11-17 Matthew Vanecek <mevanecek@yahoo.com>
* src/backend/postgres/putil.c: Added needed header files to the c
file.

View File

@ -52,6 +52,7 @@ AM_CFLAGS = \
-I${top_srcdir}/src/import-export \
-I${top_srcdir}/src/register \
-I${top_srcdir}/src/register/register-core \
-I${top_srcdir}/src/register/register-gnome \
-I${top_srcdir}/src/register/ledger-core \
${G_WRAP_COMPILE_ARGS} \
${GUILE_INCS} \

View File

@ -74,17 +74,29 @@ gnc_hbci_api_new (const char *filename, gboolean allowNewFile,
};
static HBCI_API *gnc_hbci_api = NULL;
static char *gnc_hbci_configfile = NULL;
static GNCInteractor *gnc_hbci_inter = NULL;
HBCI_API * gnc_hbci_api_new_currentbook (GtkWidget *parent,
GNCInteractor **inter)
{
if (gnc_hbci_api == NULL) {
gnc_hbci_api = gnc_hbci_api_new
(gnc_hbci_get_book_configfile (gnc_get_current_book ()),
FALSE, parent, inter);
/* No API cached -- create new one. */
gnc_hbci_configfile =
g_strdup (gnc_hbci_get_book_configfile (gnc_get_current_book ()));
gnc_hbci_api = gnc_hbci_api_new (gnc_hbci_configfile,
FALSE, parent, inter);
gnc_hbci_inter = *inter;
} else if ((gnc_hbci_configfile != NULL) &&
(strcmp(gnc_hbci_configfile,
gnc_hbci_get_book_configfile (gnc_get_current_book ()))
!= 0)) {
/* Wrong API cached -- delete old and create new. */
gnc_hbci_api_delete (gnc_hbci_api);
printf("gnc_hbci_api_new_currentbook: Wrong HBCI_API cached; creating new one.\n");
return gnc_hbci_api_new_currentbook (parent, inter);
}
/* Correct API cached. */
*inter = gnc_hbci_inter;
return gnc_hbci_api;
};
@ -94,6 +106,8 @@ void gnc_hbci_api_delete (HBCI_API *api)
if (api == gnc_hbci_api) {
gnc_hbci_api = NULL;
gnc_hbci_inter = NULL;
g_free (gnc_hbci_configfile);
gnc_hbci_configfile = NULL;
}
HBCI_API_delete (api);
}