r19126 - gnucash/trunk/src/import-export/aqbanking - Add support for upcoming libaqbanking-5 version.
Christian Stimming
cstim at code.gnucash.org
Thu May 6 07:40:41 EDT 2010
Author: cstim
Date: 2010-05-06 07:40:41 -0400 (Thu, 06 May 2010)
New Revision: 19126
Trac: http://svn.gnucash.org/trac/changeset/19126
Modified:
gnucash/trunk/src/import-export/aqbanking/dialog-ab-trans.c
gnucash/trunk/src/import-export/aqbanking/druid-ab-initial.c
gnucash/trunk/src/import-export/aqbanking/gnc-ab-getbalance.c
gnucash/trunk/src/import-export/aqbanking/gnc-ab-gettrans.c
gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c
gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.h
gnucash/trunk/src/import-export/aqbanking/gnc-file-aqb-import.c
gnucash/trunk/src/import-export/aqbanking/gnc-gwen-gui.c
Log:
Add support for upcoming libaqbanking-5 version.
Modified: gnucash/trunk/src/import-export/aqbanking/dialog-ab-trans.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/dialog-ab-trans.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/dialog-ab-trans.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -646,7 +646,11 @@
job = AB_JobSingleTransfer_new(ab_acc);
};
- if (!job || AB_Job_CheckAvailability(job, 0))
+ if (!job || AB_Job_CheckAvailability(job
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
if (job) AB_Job_free(job);
return NULL;
Modified: gnucash/trunk/src/import-export/aqbanking/druid-ab-initial.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/druid-ab-initial.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/druid-ab-initial.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -174,7 +174,7 @@
if (info->gnc_hash)
{
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(info->api, 0);
#else
AB_Banking_OnlineFini(info->api);
@@ -352,7 +352,7 @@
info->match_page_prepared = TRUE;
/* Load aqbanking accounts */
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineInit(info->api, 0);
#else
AB_Banking_OnlineInit(info->api);
@@ -395,7 +395,7 @@
g_return_val_if_fail(banking, FALSE);
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineInit(banking, 0);
#else
AB_Banking_OnlineInit(banking);
@@ -410,7 +410,7 @@
if (accl)
AB_Account_List2_free(accl);
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(banking, 0);
#else
AB_Banking_OnlineFini(banking);
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-getbalance.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-getbalance.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-getbalance.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -64,7 +64,7 @@
return;
}
if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
, 0
#endif
) != 0)
@@ -84,7 +84,11 @@
/* Get a GetBalance job and enqueue it */
job = AB_JobGetBalance_new(ab_acc);
- if (!job || AB_Job_CheckAvailability(job, 0))
+ if (!job || AB_Job_CheckAvailability(job
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
g_warning("gnc_ab_getbalance: JobGetBalance not available for this "
"account");
@@ -105,7 +109,11 @@
context = AB_ImExporterContext_new();
/* Execute the job */
- if (AB_Banking_ExecuteJobs(api, job_list, context, 0))
+ if (AB_Banking_ExecuteJobs(api, job_list, context
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
g_warning("gnc_ab_getbalance: Error on executing job");
goto cleanup;
@@ -126,7 +134,7 @@
if (job)
AB_Job_free(job);
if (online)
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(api, 0);
#else
AB_Banking_OnlineFini(api);
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-gettrans.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-gettrans.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-gettrans.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -117,7 +117,7 @@
return;
}
if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
, 0
#endif
) != 0)
@@ -146,7 +146,11 @@
/* Get a GetTransactions job and enqueue it */
job = AB_JobGetTransactions_new(ab_acc);
- if (!job || AB_Job_CheckAvailability(job, 0))
+ if (!job || AB_Job_CheckAvailability(job
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
"account");
@@ -169,7 +173,11 @@
context = AB_ImExporterContext_new();
/* Execute the job */
- if (AB_Banking_ExecuteJobs(api, job_list, context, 0))
+ if (AB_Banking_ExecuteJobs(api, job_list, context
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
g_warning("gnc_ab_gettrans: Error on executing job");
goto cleanup;
@@ -212,7 +220,7 @@
if (from_date)
GWEN_Time_free(from_date);
if (online)
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(api, 0);
#else
AB_Banking_OnlineFini(api);
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -100,7 +100,7 @@
return;
}
if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
, 0
#endif
) != 0)
@@ -175,7 +175,11 @@
/* Get a job and enqueue it */
ab_trans = gnc_ab_trans_dialog_get_ab_trans(td);
job = gnc_ab_trans_dialog_get_job(td);
- if (!job || AB_Job_CheckAvailability(job, 0))
+ if (!job || AB_Job_CheckAvailability(job
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
if (!gnc_verify_dialog(
parent, FALSE, "%s",
@@ -256,7 +260,11 @@
}
/* Finally, execute the job */
- AB_Banking_ExecuteJobs(api, job_list, context, 0);
+ AB_Banking_ExecuteJobs(api, job_list, context
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ );
/* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
* status always describes better whether the job was actually
@@ -327,7 +335,7 @@
if (td)
gnc_ab_trans_dialog_free(td);
if (online)
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(api, 0);
#else
AB_Banking_OnlineFini(api);
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -902,7 +902,11 @@
g_return_val_if_fail(banking, NULL);
#ifdef AQBANKING_VERSION_4_PLUS
- rv = AB_Banking_LoadSharedConfig(banking, "certs", &perm_certs, 0);
+ rv = AB_Banking_LoadSharedConfig(banking, "certs", &perm_certs
+# ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+# endif
+ );
#else
/* FIXME: Add code for older AqBanking versions */
/* See QBankmanager 0.9.50 in src/kbanking/libs/kbanking.cpp lines 323ff
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.h
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.h 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.h 2010-05-06 11:40:41 UTC (rev 19126)
@@ -48,6 +48,17 @@
# define AQBANKING_VERSION_4_PLUS
#endif
+#if (AQBANKING_VERSION_MAJOR > 4) || \
+ ((AQBANKING_VERSION_MAJOR == 4) && \
+ (AQBANKING_VERSION_MINOR >= 99))
+/** Defined if libaqbanking5 as opposed to libaqbanking4 is being used */
+# define AQBANKING_VERSION_5_PLUS
+#endif
+
+#if defined(AQBANKING_VERSION_4_PLUS) && !defined(AQBANKING_VERSION_5_PLUS)
+# define AQBANKING_VERSION_4_EXACTLY
+#endif
+
#define GCONF_SECTION_AQBANKING "dialogs/import/hbci"
#define KEY_FORMAT_SWIFT940 "format_swift_mt940"
#define KEY_FORMAT_SWIFT942 "format_swift_mt942"
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-file-aqb-import.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-file-aqb-import.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-file-aqb-import.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -36,12 +36,20 @@
#include <glib/gstdio.h>
#include <fcntl.h>
#include <unistd.h>
-#include <gwenhywfar/io_file.h>
-#include <gwenhywfar/io_buffered.h>
-#include <gwenhywfar/iomanager.h>
+#include "gnc-ab-utils.h"
+
+#ifdef AQBANKING_VERSION_5_PLUS
+# include <gwenhywfar/syncio_file.h>
+# include <gwenhywfar/syncio_buffered.h>
+typedef GWEN_SYNCIO GWEN_IO_LAYER;
+#else
+# include <gwenhywfar/io_file.h>
+# include <gwenhywfar/io_buffered.h>
+# include <gwenhywfar/iomanager.h>
+#endif
+
#include "dialog-ab-trans.h"
-#include "gnc-ab-utils.h"
#include "gnc-file.h"
#include "gnc-file-aqb-import.h"
#include "gnc-gwen-gui.h"
@@ -103,7 +111,7 @@
goto cleanup;
}
if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
, 0
#endif
) != 0)
@@ -166,23 +174,36 @@
context = AB_ImExporterContext_new();
/* Wrap file in buffered gwen io */
+#ifdef AQBANKING_VERSION_5_PLUS
+ close(dtaus_fd);
+ io = GWEN_SyncIo_File_new(selected_filename, GWEN_SyncIo_File_CreationMode_OpenExisting);
+#else
io = GWEN_Io_LayerFile_new(dtaus_fd, -1);
- dtaus_fd = -1;
if (GWEN_Io_Manager_RegisterLayer(io))
{
g_warning("gnc_file_aqbanking_import: Failed to wrap file");
goto cleanup;
}
+#endif
+ dtaus_fd = -1;
/* Run the import */
- if (AB_ImExporter_Import(importer, context, io, db_profile, 0))
+ if (AB_ImExporter_Import(importer, context, io, db_profile
+#ifndef AQBANKING_VERSION_5_PLUS
+ , 0
+#endif
+ ))
{
g_warning("gnc_file_aqbanking_import: Error on import");
goto cleanup;
}
/* Close the file */
+#ifdef AQBANKING_VERSION_5_PLUS
+ GWEN_SyncIo_free(io);
+#else
GWEN_Io_Layer_free(io);
+#endif
/* Import the results */
ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS,
@@ -214,7 +235,7 @@
if (gui)
gnc_GWEN_Gui_release(gui);
if (online)
-#ifdef AQBANKING_VERSION_4_PLUS
+#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineFini(api, 0);
#else
AB_Banking_OnlineFini(api);
Modified: gnucash/trunk/src/import-export/aqbanking/gnc-gwen-gui.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-gwen-gui.c 2010-05-06 09:05:59 UTC (rev 19125)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-gwen-gui.c 2010-05-06 11:40:41 UTC (rev 19126)
@@ -132,6 +132,9 @@
GWEN_GUI_PASSWORD_STATUS status, guint32 guiid);
static gint loghook_cb(GWEN_GUI *gwen_gui, const gchar *log_domain,
GWEN_LOGGER_LEVEL priority, const gchar *text);
+#ifdef AQBANKING_VERSION_5_PLUS
+typedef GWEN_SYNCIO GWEN_IO_LAYER;
+#endif
static gint checkcert_cb(GWEN_GUI *gwen_gui, const GWEN_SSLCERTDESCR *cert,
GWEN_IO_LAYER *io, guint32 guiid);
More information about the gnucash-changes
mailing list