Hi,

the attached patch allows for GnuCash to be compiled against the upcoming 
AqBanking4.
As you can see the impact on GnuCash is minor (we only need to add a argument 
to AB_Banking_OnlineInit() and AB_Banking_OnlineFini()).

The patch can be applied against the latest SVN of branch 2.2 (r17613).


Regards
Martin


-- 
"Things are only impossible until they're not"

Martin Preuss - http://www2.aquamaniac.de/
AqBanking - http://www.aqbanking.de/
LibChipcard - http://www.libchipcard.de/
From 6fcd4edbd118769b4e6c65cc451ed33c3474c0f2 Mon Sep 17 00:00:00 2001
From: Martin Preuss <[EMAIL PROTECTED]>
Date: Sat, 4 Oct 2008 13:20:17 +0200
Subject: [PATCH] This patch allows to compile GnuCash against the upcoming AqBanking4 as well as AqBanking3.

---
 src/import-export/aqbanking/druid-ab-initial.c    |   25 ++++++++++++++++++++-
 src/import-export/aqbanking/gnc-ab-getbalance.c   |   19 +++++++++++++++-
 src/import-export/aqbanking/gnc-ab-gettrans.c     |   19 +++++++++++++++-
 src/import-export/aqbanking/gnc-ab-transfer.c     |   19 +++++++++++++++-
 src/import-export/aqbanking/gnc-file-aqb-import.c |   20 ++++++++++++++++-
 5 files changed, 97 insertions(+), 5 deletions(-)

diff --git a/src/import-export/aqbanking/druid-ab-initial.c b/src/import-export/aqbanking/druid-ab-initial.c
index 91a6320..b9a6d0c 100644
--- a/src/import-export/aqbanking/druid-ab-initial.c
+++ b/src/import-export/aqbanking/druid-ab-initial.c
@@ -55,6 +55,13 @@ static QofLogModule log_module = G_LOG_DOMAIN;
 
 #define DRUID_AB_INITIAL_CM_CLASS "druid-ab-initial"
 
+#if (AQBANKING_VERSION_MAJOR > 3) || \
+  ((AQBANKING_VERSION_MAJOR == 3) && \
+    (AQBANKING_VERSION_MINOR == 9))
+# define AQBANKING_VERSION_4_PLUS
+#endif
+
+
 typedef struct _ABInitialInfo ABInitialInfo;
 typedef struct _DeferredInfo DeferredInfo;
 typedef struct _AccCbData AccCbData;
@@ -161,7 +168,11 @@ dai_destroy_cb(GtkObject *object, gpointer user_data)
     }
 
     if (info->gnc_hash) {
-        AB_Banking_OnlineFini(info->api);
+#ifdef AQBANKING_VERSION_4_PLUS
+	AB_Banking_OnlineFini(info->api, 0);
+#else
+	AB_Banking_OnlineFini(info->api);
+#endif
         g_hash_table_destroy(info->gnc_hash);
         info->gnc_hash = NULL;
     }
@@ -323,7 +334,11 @@ dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget,
         info->match_page_prepared = TRUE;
 
     /* Load aqbanking accounts */
+#ifdef AQBANKING_VERSION_4_PLUS
+    AB_Banking_OnlineInit(info->api, 0);
+#else
     AB_Banking_OnlineInit(info->api);
+#endif
 
     /* Determine current mapping */
     root = gnc_book_get_root_account(gnc_get_current_book());
@@ -362,7 +377,11 @@ banking_has_accounts(AB_BANKING *banking)
 
     g_return_val_if_fail(banking, FALSE);
 
+#ifdef AQBANKING_VERSION_4_PLUS
+    AB_Banking_OnlineInit(banking, 0);
+#else
     AB_Banking_OnlineInit(banking);
+#endif
 
     accl = AB_Banking_GetAccounts(banking);
     if (accl && (AB_Account_List2_GetSize(accl) > 0))
@@ -373,7 +392,11 @@ banking_has_accounts(AB_BANKING *banking)
     if (accl)
         AB_Account_List2_free(accl);
 
+#ifdef AQBANKING_VERSION_4_PLUS
+    AB_Banking_OnlineFini(banking, 0);
+#else
     AB_Banking_OnlineFini(banking);
+#endif
 
     return result;
 }
diff --git a/src/import-export/aqbanking/gnc-ab-getbalance.c b/src/import-export/aqbanking/gnc-ab-getbalance.c
index a2d61e4..751c01b 100644
--- a/src/import-export/aqbanking/gnc-ab-getbalance.c
+++ b/src/import-export/aqbanking/gnc-ab-getbalance.c
@@ -39,6 +39,12 @@
 #include "gnc-gwen-gui.h"
 #include "gnc-ui.h"
 
+#if (AQBANKING_VERSION_MAJOR > 3) || \
+  ((AQBANKING_VERSION_MAJOR == 3) && \
+    (AQBANKING_VERSION_MINOR == 9))
+# define AQBANKING_VERSION_4_PLUS
+#endif
+
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
 
@@ -62,10 +68,17 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
         g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
         return;
     }
+#ifdef AQBANKING_VERSION_4_PLUS
+    if (AB_Banking_OnlineInit(api, 0) != 0) {
+        g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
+        goto cleanup;
+    }
+#else
     if (AB_Banking_OnlineInit(api) != 0) {
         g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
         goto cleanup;
     }
+#endif
     online = TRUE;
 
     /* Get the AqBanking Account */
@@ -116,6 +129,10 @@ cleanup:
     if (job)
         AB_Job_free(job);
     if (online)
-        AB_Banking_OnlineFini(api);
+#ifdef AQBANKING_VERSION_4_PLUS
+	AB_Banking_OnlineFini(api, 0);
+#else
+	AB_Banking_OnlineFini(api);
+#endif
     gnc_AB_BANKING_fini(api);
 }
diff --git a/src/import-export/aqbanking/gnc-ab-gettrans.c b/src/import-export/aqbanking/gnc-ab-gettrans.c
index 0f0d7a6..d51ce61 100644
--- a/src/import-export/aqbanking/gnc-ab-gettrans.c
+++ b/src/import-export/aqbanking/gnc-ab-gettrans.c
@@ -41,6 +41,12 @@
 #include "gnc-gwen-gui.h"
 #include "import-main-matcher.h"
 
+#if (AQBANKING_VERSION_MAJOR > 3) || \
+  ((AQBANKING_VERSION_MAJOR == 3) && \
+    (AQBANKING_VERSION_MINOR == 9))
+# define AQBANKING_VERSION_4_PLUS
+#endif
+
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
 
@@ -119,10 +125,17 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
         g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
         return;
     }
+#ifdef AQBANKING_VERSION_4_PLUS
+    if (AB_Banking_OnlineInit(api, 0) != 0) {
+        g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
+        goto cleanup;
+    }
+#else
     if (AB_Banking_OnlineInit(api) != 0) {
         g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
         goto cleanup;
     }
+#endif
     online = TRUE;
 
     /* Get the AqBanking Account */
@@ -204,6 +217,10 @@ cleanup:
     if (from_date)
         GWEN_Time_free(from_date);
     if (online)
-        AB_Banking_OnlineFini(api);
+#ifdef AQBANKING_VERSION_4_PLUS
+	AB_Banking_OnlineFini(api, 0);
+#else
+	AB_Banking_OnlineFini(api);
+#endif
     gnc_AB_BANKING_fini(api);
 }
diff --git a/src/import-export/aqbanking/gnc-ab-transfer.c b/src/import-export/aqbanking/gnc-ab-transfer.c
index a6a8a69..e1111f7 100644
--- a/src/import-export/aqbanking/gnc-ab-transfer.c
+++ b/src/import-export/aqbanking/gnc-ab-transfer.c
@@ -44,6 +44,12 @@
 #include "gnc-gwen-gui.h"
 #include "gnc-ui.h"
 
+#if (AQBANKING_VERSION_MAJOR > 3) || \
+  ((AQBANKING_VERSION_MAJOR == 3) && \
+    (AQBANKING_VERSION_MINOR == 9))
+# define AQBANKING_VERSION_4_PLUS
+#endif
+
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
 
@@ -97,10 +103,17 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
         g_warning("gnc_ab_maketrans: Couldn't get AqBanking API");
         return;
     }
+#ifdef AQBANKING_VERSION_4_PLUS
+    if (AB_Banking_OnlineInit(api, 0) != 0) {
+        g_warning("gnc_ab_maketrans: Couldn't initialize AqBanking API");
+        goto cleanup;
+    }
+#else
     if (AB_Banking_OnlineInit(api) != 0) {
         g_warning("gnc_ab_maketrans: Couldn't initialize AqBanking API");
         goto cleanup;
     }
+#endif
     online = TRUE;
 
     /* Get the AqBanking Account */
@@ -294,6 +307,10 @@ cleanup:
     if (td)
         gnc_ab_trans_dialog_free(td);
     if (online)
-        AB_Banking_OnlineFini(api);
+#ifdef AQBANKING_VERSION_4_PLUS
+	AB_Banking_OnlineFini(api, 0);
+#else
+	AB_Banking_OnlineFini(api);
+#endif
     gnc_AB_BANKING_fini(api);
 }
diff --git a/src/import-export/aqbanking/gnc-file-aqb-import.c b/src/import-export/aqbanking/gnc-file-aqb-import.c
index 917554e..f7d8341 100644
--- a/src/import-export/aqbanking/gnc-file-aqb-import.c
+++ b/src/import-export/aqbanking/gnc-file-aqb-import.c
@@ -50,6 +50,12 @@
 #include "import-account-matcher.h"
 #include "import-main-matcher.h"
 
+#if (AQBANKING_VERSION_MAJOR > 3) || \
+  ((AQBANKING_VERSION_MAJOR == 3) && \
+    (AQBANKING_VERSION_MINOR == 9))
+# define AQBANKING_VERSION_4_PLUS
+#endif
+
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
@@ -100,11 +106,19 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
         g_warning("gnc_file_aqbanking_import: Couldn't get AqBanking API");
         goto cleanup;
     }
+#ifdef AQBANKING_VERSION_4_PLUS
+    if (AB_Banking_OnlineInit(api, 0) != 0) {
+        g_warning("gnc_file_aqbanking_import: "
+                  "Couldn't initialize AqBanking API");
+        goto cleanup;
+    }
+#else
     if (AB_Banking_OnlineInit(api) != 0) {
         g_warning("gnc_file_aqbanking_import: "
                   "Couldn't initialize AqBanking API");
         goto cleanup;
     }
+#endif
     online = TRUE;
 
     /* Get a GUI object */
@@ -199,7 +213,11 @@ cleanup:
     if (gui)
         gnc_GWEN_Gui_release(gui);
     if (online)
-        AB_Banking_OnlineFini(api);
+#ifdef AQBANKING_VERSION_4_PLUS
+	AB_Banking_OnlineFini(api, 0);
+#else
+	AB_Banking_OnlineFini(api);
+#endif
     if (api)
         gnc_AB_BANKING_fini(api);
     if (dtaus_fd != -1)
-- 
1.5.4.3

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to