[Gnucash-changes] Further HBCI improvements.
Christian Stimming
cstim at cvs.gnucash.org
Fri May 6 17:25:44 EDT 2005
Log Message:
-----------
Further HBCI improvements.
2005-05-06 Christian Stimming <stimming at tuhh.de>
* src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button):
Finally generalize the AqBanking setup call. Now the setup wizard
for OFX-DirectConnect can be called by Tools -> HBCI Setup as
well.
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/import-export/hbci:
druid-hbci-initial.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1905
retrieving revision 1.1906
diff -LChangeLog -LChangeLog -u -r1.1905 -r1.1906
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,10 @@
+2005-05-06 Christian Stimming <stimming at tuhh.de>
+
+ * src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button):
+ Finally generalize the AqBanking setup call. Now the setup wizard
+ for OFX-DirectConnect can be called by Tools -> HBCI Setup as
+ well.
+
2005-05-05 Christian Stimming <stimming at tuhh.de>
* src/import-export/hbci/gnc-hbci-utils.c: Improve debugging
Index: druid-hbci-initial.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-initial.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lsrc/import-export/hbci/druid-hbci-initial.c -Lsrc/import-export/hbci/druid-hbci-initial.c -u -r1.59 -r1.60
--- src/import-export/hbci/druid-hbci-initial.c
+++ src/import-export/hbci/druid-hbci-initial.c
@@ -451,8 +451,9 @@
HBCIInitialInfo *info = user_data;
GWEN_BUFFER *buf;
int res;
- const GWEN_STRINGLIST *active_backends;
- const char *backend_name;
+ GWEN_PLUGIN_DESCRIPTION_LIST2 *pluginlist;
+ const char *backend_name_nc;
+ char *backend_name;
/* This is the point where we look for and start an external
application shipped with aqhbci that contains the setup druid for
@@ -468,40 +469,73 @@
AB_BANKING *banking = info->api;
g_assert(info->druid);
- /* Uh, backends will only show up here if they have been "activated"
- before, i.e. a newly installed backend without setup will not
- appear here. Well, we leave it at this for now. */
- active_backends = AB_Banking_GetActiveProviders (banking);
-
- if (GWEN_StringList_Count(active_backends) < 1)
- backend_name = "aqhbci";
- else if (GWEN_StringList_Count(active_backends) == 1)
- backend_name = GWEN_StringList_FirstString(active_backends);
+ /* Get list of all backends, active or inactive */
+ pluginlist = AB_Banking_GetProviderDescrs (banking);
+
+ /* If there is only one backend, use it, otherwise ask the user */
+ if (!pluginlist || (GWEN_PluginDescription_List2_GetSize(pluginlist) < 1))
+ /* No backend at all? Try aqhbci */
+ backend_name_nc = "aqhbci";
else {
- /* Present a selection dialog to select a particular backend */
- GList *radio_list = NULL;
- int x;
- GWEN_STRINGLISTENTRY *sentry = GWEN_StringList_FirstEntry(active_backends);
-
- while (!sentry) {
- radio_list = g_list_append(radio_list, g_strdup(GWEN_StringListEntry_Data(sentry)));
- sentry = GWEN_StringListEntry_Next (sentry);
- }
- x = gnc_choose_radio_option_dialog (GTK_WIDGET(info->window),
- _("Choose AqBanking Backend"),
- _("Please choose an AqBanking backend to be configured"),
- 0,
- radio_list);
- g_list_free(radio_list);
-
- sentry = GWEN_StringList_FirstEntry(active_backends);
- while (x > 0) {
- sentry = GWEN_StringListEntry_Next (sentry);
- x--;
+ GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *pluginlist_it =
+ GWEN_PluginDescription_List2_First(pluginlist);
+ GWEN_PLUGIN_DESCRIPTION *plugindescr;
+ g_assert (pluginlist_it);
+
+ plugindescr = GWEN_PluginDescription_List2Iterator_Data (pluginlist_it);
+ if (GWEN_PluginDescription_List2_GetSize(pluginlist) == 1)
+ /* Only one backend? Use it */
+ backend_name_nc = GWEN_PluginDescription_GetName(plugindescr);
+ else {
+ /* Present a selection dialog to select a particular backend */
+ GList *radio_list = NULL;
+ int x;
+
+ while (plugindescr) {
+ radio_list =
+ g_list_append(radio_list,
+ g_strdup_printf("%s: %s",
+ GWEN_PluginDescription_GetName(plugindescr),
+ GWEN_PluginDescription_GetShortDescr(plugindescr)));
+ plugindescr = GWEN_PluginDescription_List2Iterator_Next (pluginlist_it);
+ }
+ GWEN_PluginDescription_List2Iterator_free(pluginlist_it);
+
+ x = gnc_choose_radio_option_dialog
+ (GTK_WIDGET(info->window),
+ _("Choose AqBanking Backend"),
+ _("Please choose an AqBanking backend to be configured"),
+ 0,
+ radio_list);
+ g_list_free(radio_list);
+
+ /* User pressed cancel in choice dialog */
+ if (x == -1) {
+ GWEN_PluginDescription_List2_freeAll(pluginlist);
+ GWEN_PluginDescription_List2_free(pluginlist);
+ return;
+ }
+
+ pluginlist_it = GWEN_PluginDescription_List2_First(pluginlist);
+ plugindescr = GWEN_PluginDescription_List2Iterator_Data (pluginlist_it);
+ while (x > 0) {
+ plugindescr = GWEN_PluginDescription_List2Iterator_Next (pluginlist_it);
+ x--;
+ }
+ backend_name_nc = GWEN_PluginDescription_GetName(plugindescr);
}
- backend_name = GWEN_StringListEntry_Data (sentry);
+ GWEN_PluginDescription_List2Iterator_free(pluginlist_it);
}
+ /* Allocate the backend name again because the PluginDescr list will
+ be freed */
+ backend_name = g_strdup (backend_name_nc);
+ GWEN_PluginDescription_List2_freeAll (pluginlist);
+ GWEN_PluginDescription_List2_free (pluginlist);
+
+ /* ***** */
+
+ /* Now find out the wizard name for that backend */
buf = GWEN_Buffer_new(NULL, 300, 0, 0);
AB_Banking_FindWizard(banking, backend_name, NULL, buf);
wizard_exists = (strlen(GWEN_Buffer_GetStart(buf)) > 0);
@@ -567,23 +601,28 @@
else {
printf("on_aqhbci_button: Oops, aqhbci wizard return nonzero value: %d. The called program was \"%s\".\n", res, wizard_path);
gnc_error_dialog
- (info->window, "%s",
- _("The external program \"AqHBCI Setup Wizard\" returned a nonzero \n"
+ (info->window,
+ /* Each of the %s is the name of the backend, e.g. "aqhbci". */
+ _("The external program \"%s 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"
+ "The further HBCI setup can only be finished if the %s \n"
"Setup Wizard is run successfully. Please try to start and \n"
- "successfully finish the AqHBCI Setup Wizard program again."));
+ "successfully finish the %s Setup Wizard program again."),
+ backend_name, backend_name, backend_name);
druid_disable_next_button(info);
}
} else {
printf("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
gnc_error_dialog
- (info->window, "%s",
- _("The external program \"AqHBCI Setup Wizard\" has not been found. \n\n"
- "Did you install the package \"aqhbci-qt-tools\" of AqHBCI? \n"
- "If not, please install it now."));
+ (info->window,
+ /* Each of the %s is the name of the backend, e.g. "aqhbci". */
+ _("The external program \"%s Setup Wizard\" has not been found. \n\n"
+ "Did you install the package \"%s-qt-tools\" of %s? \n"
+ "If not, please install it now."),
+ backend_name, backend_name, backend_name);
druid_disable_next_button(info);
}
+ g_free (backend_name);
GWEN_Buffer_free(buf);
}
More information about the gnucash-changes
mailing list