diff --git a/src/import-export/aqbanking/dialog-ab-trans.c b/src/import-export/aqbanking/dialog-ab-trans.c index fcd9c153d7..198b10fda0 100644 --- a/src/import-export/aqbanking/dialog-ab-trans.c +++ b/src/import-export/aqbanking/dialog-ab-trans.c @@ -646,7 +646,11 @@ get_available_empty_job(AB_ACCOUNT *ab_acc, GncABTransType trans_type) 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; diff --git a/src/import-export/aqbanking/druid-ab-initial.c b/src/import-export/aqbanking/druid-ab-initial.c index 3c3e2f171f..a4daca2870 100644 --- a/src/import-export/aqbanking/druid-ab-initial.c +++ b/src/import-export/aqbanking/druid-ab-initial.c @@ -174,7 +174,7 @@ dai_destroy_cb(GtkObject *object, gpointer user_data) 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 @@ dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget, 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 @@ banking_has_accounts(AB_BANKING *banking) 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 @@ banking_has_accounts(AB_BANKING *banking) 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); diff --git a/src/import-export/aqbanking/gnc-ab-getbalance.c b/src/import-export/aqbanking/gnc-ab-getbalance.c index 3afa46740f..e0364e0d13 100644 --- a/src/import-export/aqbanking/gnc-ab-getbalance.c +++ b/src/import-export/aqbanking/gnc-ab-getbalance.c @@ -64,7 +64,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc) return; } if (AB_Banking_OnlineInit(api -#ifdef AQBANKING_VERSION_4_PLUS +#ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) @@ -84,7 +84,11 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc) /* 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 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc) 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 @@ cleanup: 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); diff --git a/src/import-export/aqbanking/gnc-ab-gettrans.c b/src/import-export/aqbanking/gnc-ab-gettrans.c index 7d3c9eca43..a5c76360b6 100644 --- a/src/import-export/aqbanking/gnc-ab-gettrans.c +++ b/src/import-export/aqbanking/gnc-ab-gettrans.c @@ -117,7 +117,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc) return; } if (AB_Banking_OnlineInit(api -#ifdef AQBANKING_VERSION_4_PLUS +#ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) @@ -146,7 +146,11 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc) /* 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 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc) 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 @@ cleanup: 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); diff --git a/src/import-export/aqbanking/gnc-ab-transfer.c b/src/import-export/aqbanking/gnc-ab-transfer.c index 1643fd393e..2367b2a4fc 100644 --- a/src/import-export/aqbanking/gnc-ab-transfer.c +++ b/src/import-export/aqbanking/gnc-ab-transfer.c @@ -100,7 +100,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc, return; } if (AB_Banking_OnlineInit(api -#ifdef AQBANKING_VERSION_4_PLUS +#ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) @@ -175,7 +175,11 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc, /* 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 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc, } /* 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 @@ cleanup: 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); diff --git a/src/import-export/aqbanking/gnc-ab-utils.c b/src/import-export/aqbanking/gnc-ab-utils.c index 0e487ff782..086202d476 100644 --- a/src/import-export/aqbanking/gnc-ab-utils.c +++ b/src/import-export/aqbanking/gnc-ab-utils.c @@ -902,7 +902,11 @@ gnc_ab_get_permanent_certs(void) 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 diff --git a/src/import-export/aqbanking/gnc-ab-utils.h b/src/import-export/aqbanking/gnc-ab-utils.h index 6ad3522641..f9ed5b85e9 100644 --- a/src/import-export/aqbanking/gnc-ab-utils.h +++ b/src/import-export/aqbanking/gnc-ab-utils.h @@ -48,6 +48,17 @@ G_BEGIN_DECLS # 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" diff --git a/src/import-export/aqbanking/gnc-file-aqb-import.c b/src/import-export/aqbanking/gnc-file-aqb-import.c index 31f8c9f8fe..94b63a8c96 100644 --- a/src/import-export/aqbanking/gnc-file-aqb-import.c +++ b/src/import-export/aqbanking/gnc-file-aqb-import.c @@ -36,12 +36,20 @@ #include #include #include -#include -#include -#include -#include "dialog-ab-trans.h" #include "gnc-ab-utils.h" + +#ifdef AQBANKING_VERSION_5_PLUS +# include +# include +typedef GWEN_SYNCIO GWEN_IO_LAYER; +#else +# include +# include +# include +#endif + +#include "dialog-ab-trans.h" #include "gnc-file.h" #include "gnc-file-aqb-import.h" #include "gnc-gwen-gui.h" @@ -103,7 +111,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername, goto cleanup; } if (AB_Banking_OnlineInit(api -#ifdef AQBANKING_VERSION_4_PLUS +#ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) @@ -166,23 +174,36 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername, 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 @@ cleanup: 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); diff --git a/src/import-export/aqbanking/gnc-gwen-gui.c b/src/import-export/aqbanking/gnc-gwen-gui.c index 5660412344..9bc24549d3 100644 --- a/src/import-export/aqbanking/gnc-gwen-gui.c +++ b/src/import-export/aqbanking/gnc-gwen-gui.c @@ -132,6 +132,9 @@ static gint setpasswordstatus_cb(GWEN_GUI *gwen_gui, const gchar *token, 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);