[Gnucash-changes] Back-port HBCI improvements from HEAD.
Christian Stimming
cstim at cvs.gnucash.org
Thu Dec 23 11:50:07 EST 2004
Log Message:
-----------
Back-port HBCI improvements from HEAD.
2004-12-23 Christian Stimming <stimming at tuhh.de>
* src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button):
Add extra sanity checks and verbose error message if the setup
wizard of aqhbci cannot be found.
* src/import-export/hbci/gncmod-hbci.c: Fix potentially missing
initialization of gwenhywfar library, as reported by Peter
O'Gorman on Max OS X.
Tags:
----
gnucash-1-8-branch
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/import-export/hbci:
druid-hbci-initial.c
gncmod-hbci.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.380
retrieving revision 1.1461.2.381
diff -LChangeLog -LChangeLog -u -r1.1461.2.380 -r1.1461.2.381
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,13 @@
+2004-12-23 Christian Stimming <stimming at tuhh.de>
+
+ * src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button):
+ Add extra sanity checks and verbose error message if the setup
+ wizard of aqhbci cannot be found.
+
+ * src/import-export/hbci/gncmod-hbci.c: Fix potentially missing
+ initialization of gwenhywfar library, as reported by Peter
+ O'Gorman on Max OS X.
+
2004-12-11 Chris Lyttle <chris at wilddev.net>
* configure.in: Release 1.8.10
Index: druid-hbci-initial.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-initial.c,v
retrieving revision 1.26.2.13
retrieving revision 1.26.2.14
diff -Lsrc/import-export/hbci/druid-hbci-initial.c -Lsrc/import-export/hbci/druid-hbci-initial.c -u -r1.26.2.13 -r1.26.2.14
--- src/import-export/hbci/druid-hbci-initial.c
+++ src/import-export/hbci/druid-hbci-initial.c
@@ -23,9 +23,10 @@
#include "config.h"
#include <gnome.h>
-#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/wait.h>
+#include <fcntl.h>
#include <unistd.h>
#include "druid-hbci-initial.h"
@@ -448,34 +449,57 @@
GWEN_BUFFER *buf;
int res;
const char *backend_name = "aqhbci";
+
+ /* NOTE NOTE NOTE: This is the name for the external application
+ shipped with aqhbci that contains the setup druid for HBCI
+ related stuff. The name is misleading -- it requires qt but not
+ kde). This application contains the very verbose step-by-step
+ setup wizard for the HBCI account, and the application is shared
+ with other AqBanking-based financial managers that offer the HBCI
+ features (e.g. KMyMoney). See gnucash-devel discussion here
+ https://lists.gnucash.org/pipermail/gnucash-devel/2004-December/012351.html
+ */
const char *wizard_name = "kde_wizard";
+ gboolean wizard_exists;
+ const char *wizard_path;
+ int fd;
AB_BANKING *banking = info->api;
g_assert(info->druid);
buf = GWEN_Buffer_new(NULL, 200, 0, 0);
AB_Banking_GetWizardPath(banking, backend_name, buf);
+ wizard_exists = (strlen(GWEN_Buffer_GetStart(buf)) > 0);
GWEN_Buffer_AppendString(buf, "/");
- GWEN_Buffer_AppendString(buf, wizard_name);
/* {
GWEN_PLUGIN_DESCRIPTION_LIST2 *l =
AB_Banking_GetWizardDescrs(banking, backend_name);
const GWEN_PLUGIN_DESCRIPTION *x = GWEN_PluginDescription_List2_GetFront(l);
- // There needs to be a way to find the name here. Currently this doesnt work yet.
+ // There needs to be a way to find the file name here. Currently
+ // this doesnt work yet.
wizard_name = GWEN_PluginDescription_GetName(x);
GWEN_Buffer_AppendString(buf, wizard_name);
GWEN_PluginDescription_List2_freeAll(l);
} */
+ GWEN_Buffer_AppendString(buf, wizard_name);
+ wizard_path = GWEN_Buffer_GetStart(buf);
+
+ /* Really check whether the file exists */
+ fd = open( wizard_path, O_RDONLY );
+ if ( fd == -1)
+ wizard_exists = FALSE;
+ else
+ close( fd );
druid_disable_next_button(info);
AB_Banking_DeactivateProvider(banking, backend_name);
- if (strlen(GWEN_Buffer_GetStart(buf)) > 0) {
- const char *path = GWEN_Buffer_GetStart(buf);
+ if (wizard_exists) {
int wait_status;
int wait_result = 0;
- /* Call the kde wizard */
- /* res = system(path); */
+ /* Call the qt wizard (called kde wizard). See the note above
+ about why this approach is chosen. */
+
/* In gtk2, this would be g_spawn_async or similar. */
AB_Banking_Fini (info->api);
{
@@ -488,7 +512,7 @@
AB_Banking_Init (info->api);
break;
case 0: /* child */
- execl(path, path, NULL);
+ execl(wizard_path, wizard_path, NULL);
printf("Fork call failed. Cannot start AqHBCI setup wizard.");
_exit(0);
default: /* parent */
@@ -510,16 +534,30 @@
if (res == 0)
druid_enable_next_button(info);
else {
- printf("on_aqhbci_button: Oops, after successful aqhbci wizard the activation return nonzero value: %d. \n", res);
+ printf("on_aqhbci_button: Oops, after successful wizard the activation return nonzero value: %d. \n", res);
druid_disable_next_button(info);
}
}
else {
- printf("on_aqhbci_button: Oops, aqhbci wizard return nonzero value: %d. The called program was \"%s\".\n", res, path);
+ printf("on_aqhbci_button: Oops, aqhbci wizard return nonzero value: %d. The called program was \"%s\".\n", res, wizard_path);
+ gnc_error_dialog_parented
+ (GTK_WINDOW(info->window), "%s",
+ _("The external program \"AqHBCI Setup Wizard\" returned a nonzero \n"
+ "exit code which means it has not been finished successfully. \n"
+ "The further HBCI setup can only be finished if the AqHBCI \n"
+ "Setup Wizard is run successfully. Please try to start and \n"
+ "successfully finish the AqHBCI Setup Wizard program again."));
druid_disable_next_button(info);
}
} else {
- printf("on_aqhbci_button: Oops, no aqhbci wizard found. Cannot start aqhbci wizard.\n");
+ printf("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
+ gnc_error_dialog_parented
+ (GTK_WINDOW(info->window), "%s",
+ _("The external program \"AqHBCI Setup Wizard\" has not been found. \n\n"
+ "Did you install the package \"kde_wizard\" of AqHBCI? \n"
+ "If not, please install it now. (The name of that package \n"
+ "is misleading, as it does not require the KDE desktop \n"
+ "environment but only the Qt toolkit libraries.)"));
druid_disable_next_button(info);
}
GWEN_Buffer_free(buf);
Index: gncmod-hbci.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gncmod-hbci.c,v
retrieving revision 1.16.2.2
retrieving revision 1.16.2.3
diff -Lsrc/import-export/hbci/gncmod-hbci.c -Lsrc/import-export/hbci/gncmod-hbci.c -u -r1.16.2.2 -r1.16.2.3
--- src/import-export/hbci/gncmod-hbci.c
+++ src/import-export/hbci/gncmod-hbci.c
@@ -17,6 +17,7 @@
#include "gnc-hbci-cb.h"
#include "druid-hbci-initial.h"
#include "gnc-hbci-utils.h"
+#include <gwenhywfar/gwenhywfar.h>
/* version of the gnc module system interface we require */
int libgncmod_hbci_LTX_gnc_module_system_interface = 0;
@@ -73,13 +74,20 @@
/* Add menu items with C callbacks */
gnc_hbci_addmenus();
-
+
+ /* Initialize gwen library */
+ GWEN_Init();
+
return TRUE;
}
int
libgncmod_hbci_LTX_gnc_module_end(int refcount) {
gnc_AB_BANKING_delete(0);
+
+ /* Finalize gwen library */
+ GWEN_Fini();
+
return TRUE;
}
More information about the gnucash-changes
mailing list