mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2002-07-29 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/druid-hbci-initial.c: Added some initial OpenHBCI code. Still no network connectivity or data changing, though. * src/import-export/hbci/gnc-hbci-kvp.[hc]: Added kvp_frame handling for HBCI-related data. * configure.in: Added option --with-openhbci-prefix. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7130 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
2002-07-29 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/druid-hbci-initial.c: Added some initial
|
||||
OpenHBCI code. Still no network connectivity or data changing,
|
||||
though.
|
||||
|
||||
* src/import-export/hbci/gnc-hbci-kvp.[hc]: Added kvp_frame
|
||||
handling for HBCI-related data.
|
||||
|
||||
* configure.in: Added option --with-openhbci-prefix.
|
||||
|
||||
2002-07-28 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/scm/main.scm: Add module-load for HBCI.
|
||||
|
||||
18
configure.in
18
configure.in
@@ -418,16 +418,28 @@ AC_SUBST(RPC_DIR)
|
||||
### --------------------------------------------------------------------------
|
||||
### OFX
|
||||
AC_ARG_ENABLE( ofx,
|
||||
[ --enable-ofx compile with ofx support],
|
||||
[ --enable-ofx compile with ofx support (needs LibOFX)],
|
||||
OFX_DIR=ofx)
|
||||
|
||||
AC_SUBST(OFX_DIR)
|
||||
### --------------------------------------------------------------------------
|
||||
### HBCI
|
||||
AC_ARG_ENABLE( hbci,
|
||||
[ --enable-hbci compile with HBCI support],
|
||||
[ --enable-hbci compile with HBCI support (needs OpenHBCI)],
|
||||
HBCI_DIR=hbci)
|
||||
AC_ARG_WITH( openhbci-prefix,
|
||||
[ --with-openhbci-prefix=PFX Prefix where OpenHBCI is installed],
|
||||
HBCI_PREFIX="$with_openhbci_prefix",
|
||||
HBCI_PREFIX="\${prefix}")
|
||||
AC_ARG_WITH( openhbci-cfgfile,
|
||||
[ --with-openhbci-cfgfile=FILE Configuration file of OpenHBCI],
|
||||
HBCI_CFGFILE="\\\"$with_openhbci_cfgfile\\\"",
|
||||
HBCI_CFGFILE="\\\"${HOME}/.openhbci/openhbci.conf\\\"")
|
||||
|
||||
HBCI_LIBS="-L${HBCI_PREFIX}/lib -lopenhbci"
|
||||
HBCI_CFLAGS="-I${HBCI_PREFIX}/include -DHBCI_CFGFILE=${HBCI_CFGFILE}"
|
||||
AC_SUBST(HBCI_LIBS)
|
||||
AC_SUBST(HBCI_CFLAGS)
|
||||
AC_SUBST(HBCI_DIR)
|
||||
### --------------------------------------------------------------------------
|
||||
### i18n
|
||||
@@ -576,7 +588,7 @@ AC_CHECK_LIB(popt, poptStrippedArgv,, [AC_MSG_ERROR([
|
||||
### --------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE(gui,
|
||||
[ --enable-gui build the GNOME GUI components of Gnucash],
|
||||
[ --enable-gui build the GNOME GUI components of Gnucash],
|
||||
[case "${enableval}" in
|
||||
yes) gnc_build_gui=true ;;
|
||||
no) gnc_build_gui=false ;;
|
||||
|
||||
@@ -4,7 +4,9 @@ pkglib_LTLIBRARIES = libgncmod-hbci.la
|
||||
|
||||
libgncmod_hbci_la_SOURCES = \
|
||||
gncmod-hbci.c \
|
||||
druid-hbci-initial.c
|
||||
druid-hbci-initial.c \
|
||||
druid-hbci-final.c \
|
||||
gnc-hbci-kvp.c
|
||||
|
||||
noinst_HEADERS =
|
||||
|
||||
@@ -15,9 +17,8 @@ libgncmod_hbci_la_LIBADD = \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/import-export/libgncmod-generic-import.la \
|
||||
${GLIB_LIBS} \
|
||||
${GNOMEUI_LIBS}
|
||||
|
||||
# -L/home/chs/lib/unstable/lib -lopenhbci
|
||||
${GNOMEUI_LIBS} \
|
||||
${HBCI_LIBS}
|
||||
|
||||
gncscmdir = ${GNC_SCM_INSTALL_DIR}/hbci
|
||||
|
||||
@@ -38,9 +39,8 @@ AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/import-export \
|
||||
${GNOME_INCLUDEDIR} \
|
||||
${GLADE_CFLAGS} \
|
||||
${GLIB_CFLAGS}
|
||||
|
||||
# -I/home/chs/lib/unstable/include
|
||||
${GLIB_CFLAGS} \
|
||||
${HBCI_CFLAGS}
|
||||
|
||||
#gladedir = $(GNC_GLADE_DIR)
|
||||
#glade_DATA =
|
||||
|
||||
123
src/import-export/hbci/druid-hbci-final.c
Normal file
123
src/import-export/hbci/druid-hbci-final.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/********************************************************************\
|
||||
* druid-hbci-final.c -- hbci creation functionality *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnome.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "druid-hbci-final.h"
|
||||
/* #include "Group.h" */
|
||||
#include "dialog-utils.h"
|
||||
#include "druid-utils.h"
|
||||
#include <openhbci/hbciapi.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *druid;
|
||||
|
||||
/* OpenHBCI stuff */
|
||||
HBCI_API *api;
|
||||
|
||||
} HBCIFinalInfo;
|
||||
|
||||
|
||||
static void
|
||||
delete_final_druid (HBCIFinalInfo *info)
|
||||
{
|
||||
if (info == NULL) return;
|
||||
if (info->window == NULL) return;
|
||||
|
||||
gtk_widget_destroy (info->window);
|
||||
info->window = NULL;
|
||||
|
||||
if (info->api == NULL) return;
|
||||
HBCI_API_delete(info->api);
|
||||
info->api = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
on_cancel (GnomeDruid *gnomedruid,
|
||||
gpointer user_data)
|
||||
{
|
||||
HBCIFinalInfo *info = user_data;
|
||||
|
||||
delete_final_druid(info);
|
||||
}
|
||||
|
||||
static void
|
||||
on_finish (GnomeDruidPage *gnomedruidpage,
|
||||
gpointer arg1,
|
||||
gpointer user_data)
|
||||
{
|
||||
HBCIFinalInfo *info = user_data;
|
||||
|
||||
delete_final_druid(info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void gnc_hbci_final_druid (void)
|
||||
{
|
||||
HBCIFinalInfo *info;
|
||||
GladeXML *xml;
|
||||
GtkWidget *page;
|
||||
|
||||
info = g_new0 (HBCIFinalInfo, 1);
|
||||
|
||||
xml = gnc_glade_xml_new ("hbci.glade", "Finish HBCI Setup Druid");
|
||||
|
||||
info->window = glade_xml_get_widget (xml, "Finish HBCI Setup Druid");
|
||||
|
||||
info->druid = glade_xml_get_widget (xml, "hbci_final_druid");
|
||||
gnc_druid_set_colors (GNOME_DRUID (info->druid));
|
||||
|
||||
glade_xml_signal_connect_data (xml, "on_finish",
|
||||
GTK_SIGNAL_FUNC (on_finish), info);
|
||||
glade_xml_signal_connect_data (xml, "on_cancel",
|
||||
GTK_SIGNAL_FUNC (on_cancel), info);
|
||||
|
||||
/*{
|
||||
info->userid = glade_xml_get_widget(xml, "user_id_entry");
|
||||
page = glade_xml_get_widget(xml, "user_page");
|
||||
info->userpage = page;
|
||||
gtk_signal_connect (GTK_OBJECT (page), "next",
|
||||
GTK_SIGNAL_FUNC (on_userid_next), info);
|
||||
}*/
|
||||
|
||||
|
||||
//gtk_signal_connect (GTK_OBJECT(dialog), "destroy",
|
||||
// GTK_SIGNAL_FUNC(gnc_hierarchy_destroy_cb), NULL);
|
||||
|
||||
gtk_widget_show_all (info->window);
|
||||
|
||||
}
|
||||
|
||||
SCM scm_hbci_final_druid (void)
|
||||
{
|
||||
gnc_hbci_final_druid();
|
||||
return SCM_EOL;
|
||||
}
|
||||
31
src/import-export/hbci/druid-hbci-final.h
Normal file
31
src/import-export/hbci/druid-hbci-final.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/********************************************************************\
|
||||
* druid-hbci-final.h -- hbci final creation functionality *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef DRUID_HBCI_FINAL_H
|
||||
#define DRUID_HBCI_FINAL_H
|
||||
|
||||
#include <guile/gh.h>
|
||||
|
||||
void gnc_hbci_final_druid (void);
|
||||
SCM scm_hbci_final_druid (void);
|
||||
|
||||
#endif
|
||||
@@ -41,6 +41,7 @@
|
||||
/* #include "gnc-ui-util.h" */
|
||||
/* #include "io-example-account.h" */
|
||||
/* #include "top-level.h" */
|
||||
#include <openhbci/hbciapi.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -52,21 +53,62 @@ typedef struct
|
||||
GtkWidget *countrycode;
|
||||
GtkWidget *ipaddr;
|
||||
GtkWidget *port;
|
||||
|
||||
/* user info page */
|
||||
GtkWidget *userid;
|
||||
GtkWidget *userpage;
|
||||
|
||||
/* medium page */
|
||||
GtkWidget *mediumrdh;
|
||||
GtkWidget *mediumpath;
|
||||
GtkWidget *mediumddv;
|
||||
|
||||
/* iniletter server */
|
||||
GtkWidget *server_text;
|
||||
|
||||
/* iniletter user */
|
||||
GtkWidget *user_text;
|
||||
|
||||
/* OpenHBCI stuff */
|
||||
HBCI_API *api;
|
||||
|
||||
} HBCIInitialInfo;
|
||||
//static AccountGroup *our_final_group = NULL;
|
||||
|
||||
|
||||
static void
|
||||
delete_initial_druid (HBCIInitialInfo *info)
|
||||
{
|
||||
if (info == NULL) return;
|
||||
if (info->window == NULL) return;
|
||||
|
||||
gtk_widget_destroy (info->window);
|
||||
info->window = NULL;
|
||||
|
||||
if (info->api == NULL) return;
|
||||
HBCI_API_delete(info->api);
|
||||
info->api = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
on_cancel (GnomeDruid *gnomedruid,
|
||||
gpointer user_data)
|
||||
{
|
||||
HBCIInitialInfo *info = user_data;
|
||||
|
||||
delete_initial_druid(info);
|
||||
}
|
||||
|
||||
static void
|
||||
on_finish (GnomeDruidPage *gnomedruidpage,
|
||||
gpointer arg1,
|
||||
gpointer user_data)
|
||||
{
|
||||
HBCIInitialInfo *info = user_data;
|
||||
|
||||
delete_initial_druid(info);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
on_userid_next (GnomeDruidPage *gnomedruidpage,
|
||||
@@ -78,7 +120,13 @@ on_userid_next (GnomeDruidPage *gnomedruidpage,
|
||||
int countrycode;
|
||||
const char *ipaddr, *port;
|
||||
const char *userid;
|
||||
|
||||
HBCI_API *api;
|
||||
HBCI_Error *err;
|
||||
const char *cfgfile = HBCI_CFGFILE;
|
||||
char *errstring;
|
||||
HBCI_Bank *bank;
|
||||
HBCI_User *user;
|
||||
|
||||
bankcode = gtk_entry_get_text (GTK_ENTRY (info->bankcode));
|
||||
countrycode = atoi (gtk_entry_get_text (GTK_ENTRY (info->countrycode)));
|
||||
|
||||
@@ -87,6 +135,38 @@ on_userid_next (GnomeDruidPage *gnomedruidpage,
|
||||
|
||||
userid = gtk_entry_get_text (GTK_ENTRY (info->userid));
|
||||
|
||||
printf("Got bankcode %s and userid %s.\n", bankcode, userid);
|
||||
api = HBCI_API_new(FALSE, TRUE);
|
||||
err = HBCI_API_loadEnvironment(api, cfgfile);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
errstring = HBCI_Error_errorString(err);
|
||||
fprintf(stderr,"At on_userid_next, loadEnvironment: ERROR: %s\n",
|
||||
errstring);
|
||||
free(errstring);
|
||||
HBCI_API_delete(api);
|
||||
info->api = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bank = HBCI_API_findBank(api, countrycode, bankcode);
|
||||
if (bank == NULL) {
|
||||
printf("No bank found.\n");
|
||||
HBCI_API_delete(api);
|
||||
info->api = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
printf("Found bank, name %s.\n", HBCI_Bank_name(bank));
|
||||
|
||||
user = HBCI_Bank_findUser(bank, userid);
|
||||
if (user == NULL) {
|
||||
printf("No user found.\n");
|
||||
HBCI_API_delete(api);
|
||||
info->api = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
printf("Found user, name %s.\n", HBCI_User_userName(user));
|
||||
|
||||
info->api = api;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -150,6 +230,11 @@ void gnc_hbci_initial_druid (void)
|
||||
info->druid = glade_xml_get_widget (xml, "hbci_init_druid");
|
||||
gnc_druid_set_colors (GNOME_DRUID (info->druid));
|
||||
|
||||
glade_xml_signal_connect_data (xml, "on_finish",
|
||||
GTK_SIGNAL_FUNC (on_finish), info);
|
||||
glade_xml_signal_connect_data (xml, "on_cancel",
|
||||
GTK_SIGNAL_FUNC (on_cancel), info);
|
||||
|
||||
{
|
||||
info->bankcode = glade_xml_get_widget(xml, "bank_code_entry");
|
||||
info->countrycode = glade_xml_get_widget(xml, "country_code_entry");
|
||||
@@ -159,6 +244,7 @@ void gnc_hbci_initial_druid (void)
|
||||
{
|
||||
info->userid = glade_xml_get_widget(xml, "user_id_entry");
|
||||
page = glade_xml_get_widget(xml, "user_page");
|
||||
info->userpage = page;
|
||||
gtk_signal_connect (GTK_OBJECT (page), "next",
|
||||
GTK_SIGNAL_FUNC (on_userid_next), info);
|
||||
}
|
||||
@@ -182,7 +268,7 @@ void gnc_hbci_initial_druid (void)
|
||||
gtk_signal_connect (GTK_OBJECT (page), "next",
|
||||
GTK_SIGNAL_FUNC (on_iniletter_user_next), info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//gtk_signal_connect (GTK_OBJECT(dialog), "destroy",
|
||||
// GTK_SIGNAL_FUNC(gnc_hierarchy_destroy_cb), NULL);
|
||||
|
||||
2
src/import-export/hbci/glade/.cvsignore
Normal file
2
src/import-export/hbci/glade/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -722,4 +722,71 @@ Press 'Finish' now.</text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkWindow</class>
|
||||
<name>Finish HBCI Setup Druid</name>
|
||||
<title>window1</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDruid</class>
|
||||
<name>hbci_final_druid</name>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDruidPageStart</class>
|
||||
<name>druidpagestart2</name>
|
||||
<title>Finish HBCI Setup</title>
|
||||
<text>Sorry, nothing implemented here so far.</text>
|
||||
<title_color>255,255,255</title_color>
|
||||
<text_color>0,0,0</text_color>
|
||||
<background_color>25,25,112</background_color>
|
||||
<logo_background_color>255,255,255</logo_background_color>
|
||||
<textbox_color>255,255,255</textbox_color>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDruidPageStandard</class>
|
||||
<name>druidpagestandard1</name>
|
||||
<title></title>
|
||||
<title_color>255,255,255</title_color>
|
||||
<background_color>25,25,112</background_color>
|
||||
<logo_background_color>255,255,255</logo_background_color>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDruidPageStandard:vbox</child_name>
|
||||
<name>druid-vbox6</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDruidPageFinish</class>
|
||||
<name>druidpagefinish2</name>
|
||||
<title></title>
|
||||
<text></text>
|
||||
<background_color>25,25,112</background_color>
|
||||
<logo_background_color>255,255,255</logo_background_color>
|
||||
<textbox_color>255,255,255</textbox_color>
|
||||
<text_color>0,0,0</text_color>
|
||||
<title_color>255,255,255</title_color>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
||||
131
src/import-export/hbci/gnc-hbci-kvp.c
Normal file
131
src/import-export/hbci/gnc-hbci-kvp.c
Normal file
@@ -0,0 +1,131 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-kvp.c -- hbci kvp handling *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include "gnc-hbci-kvp.h"
|
||||
|
||||
#define HBCI_KEY "hbci"
|
||||
#define HBCI_ACCOUNT_ID "account-id"
|
||||
#define HBCI_BANK_CODE "bank-code"
|
||||
#define HBCI_COUNTRY_CODE "country-code"
|
||||
#define HBCI_USERID_LIST "user-id-list"
|
||||
#define HBCI_BANK_LIST "bank-list"
|
||||
|
||||
/* Account */
|
||||
gchar *gnc_hbci_get_account_accountid (Account *a)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_frame_get_slot (frame, HBCI_ACCOUNT_ID);
|
||||
return kvp_value_get_string (value);
|
||||
}
|
||||
gchar *gnc_hbci_get_account_bankcode (Account *a)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_frame_get_slot (frame, HBCI_BANK_CODE);
|
||||
return kvp_value_get_string (value);
|
||||
}
|
||||
gint gnc_hbci_get_account_countrycode (Account *a)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_frame_get_slot (frame, HBCI_COUNTRY_CODE);
|
||||
return kvp_value_get_gint64 (value);
|
||||
}
|
||||
void gnc_hbci_set_account_accountid (Account *a, const char *id)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_value_new_string (id);
|
||||
kvp_frame_set_slot (frame, HBCI_ACCOUNT_ID, value);
|
||||
}
|
||||
void gnc_hbci_set_account_bankcode (Account *a, const char *code)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_value_new_string (code);
|
||||
kvp_frame_set_slot (frame, HBCI_BANK_CODE, value);
|
||||
}
|
||||
void gnc_hbci_set_account_countrycode (Account *a, gint code)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
|
||||
kvp_value *value = kvp_value_new_gint64 (code);
|
||||
kvp_frame_set_slot (frame, HBCI_COUNTRY_CODE, value);
|
||||
}
|
||||
|
||||
|
||||
/* GNCBook */
|
||||
GList *gnc_hbci_get_book_bankframelist (GNCBook *b)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_book_kvp (b);
|
||||
kvp_value *value = kvp_frame_get_slot (frame, HBCI_BANK_LIST);
|
||||
return kvp_value_get_glist (value);
|
||||
}
|
||||
void gnc_hbci_set_book_bankframelist_nc (GNCBook *b, GList *banklist)
|
||||
{
|
||||
kvp_frame *frame = gnc_hbci_get_book_kvp (b);
|
||||
kvp_value *value = kvp_value_new_glist_nc (banklist);
|
||||
kvp_frame_set_slot_nc (frame, HBCI_BANK_LIST, value);
|
||||
}
|
||||
gchar *gnc_hbci_get_bankframe_bankcode (kvp_frame *f)
|
||||
{
|
||||
kvp_value *value = kvp_frame_get_slot (f, HBCI_BANK_CODE);
|
||||
return kvp_value_get_string (value);
|
||||
}
|
||||
gint gnc_hbci_get_bankframe_countrycode (kvp_frame *f)
|
||||
{
|
||||
kvp_value *value = kvp_frame_get_slot (f, HBCI_COUNTRY_CODE);
|
||||
return kvp_value_get_gint64 (value);
|
||||
}
|
||||
GList *gnc_hbci_get_bankframe_userids (kvp_frame *f)
|
||||
{
|
||||
kvp_value *value = kvp_frame_get_slot (f, HBCI_USERID_LIST);
|
||||
return kvp_value_get_glist (value);
|
||||
}
|
||||
kvp_frame *gnc_hbci_bankframe_new (const char *bankcode,
|
||||
gint countrycode,
|
||||
const GList *userids)
|
||||
{
|
||||
kvp_frame *newframe = kvp_frame_new();
|
||||
kvp_frame_set_slot(newframe, HBCI_BANK_CODE,
|
||||
kvp_value_new_string (bankcode));
|
||||
kvp_frame_set_slot(newframe, HBCI_COUNTRY_CODE,
|
||||
kvp_value_new_gint64 (countrycode));
|
||||
kvp_frame_set_slot(newframe, HBCI_USERID_LIST,
|
||||
kvp_value_new_glist (userids));
|
||||
return newframe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* lowlevel */
|
||||
/* getters for kvp frame in book */
|
||||
kvp_frame *gnc_hbci_get_book_kvp (GNCBook *b)
|
||||
{
|
||||
kvp_frame *toplevel = gnc_book_get_slots (b);
|
||||
return kvp_frame_get_frame (toplevel, HBCI_KEY, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* kvp frame in Account */
|
||||
kvp_frame *gnc_hbci_get_account_kvp (Account *a)
|
||||
{
|
||||
kvp_frame *toplevel = xaccAccountGetSlots (a);
|
||||
return kvp_frame_get_frame (toplevel, HBCI_KEY, NULL);
|
||||
}
|
||||
63
src/import-export/hbci/gnc-hbci-kvp.h
Normal file
63
src/import-export/hbci/gnc-hbci-kvp.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-kvp.h -- hbci kvp handling *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef GNC_HBCI_KVP_H
|
||||
#define GNC_HBCI_KVP_H
|
||||
|
||||
//#include <guile/gh.h>
|
||||
#include <glib.h>
|
||||
#include "kvp_frame.h"
|
||||
#include "Account.h"
|
||||
#include "gnc-book.h"
|
||||
|
||||
/* Account */
|
||||
gchar *gnc_hbci_get_account_accountid (Account *a);
|
||||
void gnc_hbci_set_account_accountid (Account *a, const char *id);
|
||||
|
||||
gchar *gnc_hbci_get_account_bankcode (Account *a);
|
||||
void gnc_hbci_set_account_bankcode (Account *a, const char *code);
|
||||
|
||||
gint gnc_hbci_get_account_countrycode (Account *a);
|
||||
void gnc_hbci_set_account_countrycode (Account *a, gint code);
|
||||
|
||||
/* GNCBook */
|
||||
GList *gnc_hbci_get_book_bankframelist (GNCBook *b);
|
||||
void gnc_hbci_set_book_bankframelist_nc (GNCBook *b, GList *banklist);
|
||||
|
||||
gchar *gnc_hbci_get_bankframe_bankcode (kvp_frame *f);
|
||||
gint gnc_hbci_get_bankframe_countrycode (kvp_frame *f);
|
||||
GList *gnc_hbci_get_bankframe_userids (kvp_frame *f);
|
||||
|
||||
kvp_frame *gnc_hbci_bankframe_new (const char *bankcode,
|
||||
gint countrycode,
|
||||
const GList *userids);
|
||||
|
||||
/* lowlevel */
|
||||
/* getter for kvp frame in book */
|
||||
kvp_frame *gnc_hbci_get_book_kvp (GNCBook *b);
|
||||
|
||||
/* kvp frame in Account */
|
||||
kvp_frame *gnc_hbci_get_account_kvp (Account *a);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "gnc-module-api.h"
|
||||
|
||||
#include "druid-hbci-initial.h"
|
||||
#include "druid-hbci-final.h"
|
||||
|
||||
/* version of the gnc module system interface we require */
|
||||
int gnc_module_system_interface = 0;
|
||||
@@ -41,8 +42,9 @@ gnc_module_description(void) {
|
||||
|
||||
|
||||
int
|
||||
gnc_module_init(int refcount) {
|
||||
printf("Started gncmod-hbci.c.\n");
|
||||
gnc_module_init(int refcount)
|
||||
{
|
||||
//printf("Started gncmod-hbci.c.\n");
|
||||
/* load the engine (we depend on it) */
|
||||
if(!gnc_module_load("gnucash/engine", 0)) {
|
||||
return FALSE;
|
||||
@@ -63,11 +65,13 @@ gnc_module_init(int refcount) {
|
||||
/* load the HBCI Scheme code */
|
||||
gh_eval_str("(load-from-path \"hbci/hbci.scm\")");
|
||||
|
||||
printf("Load the HBCI initial druid\n");
|
||||
//printf("Load the HBCI initial druid\n");
|
||||
gh_new_procedure("gnc:hbci-initial-setup",
|
||||
scm_hbci_initial_druid, 0, 0, 0);
|
||||
gh_new_procedure("gnc:hbci-finish-setup",
|
||||
scm_hbci_final_druid, 0, 0, 0);
|
||||
|
||||
printf("Been in gncmod-hbci.c.\n");
|
||||
//printf("Been in gncmod-hbci.c.\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
(N_ "Initial HBCI Setup")
|
||||
(list "_Tools" "HBCI" "")
|
||||
(lambda ()
|
||||
(gnc:hbci-initial-setup)))))
|
||||
;;(gnc:add-extension
|
||||
;; (gnc:make-menu-item (N_ "Finish HBCI Setup")
|
||||
;; (N_ "Finish HBCI Setup")
|
||||
;; (list "Tools" "HBCI" "")
|
||||
;; (lambda ()
|
||||
;; (gnc:hbci-finish-setup)))))
|
||||
(gnc:hbci-initial-setup))))
|
||||
(gnc:add-extension
|
||||
(gnc:make-menu-item (N_ "Final HBCI Setup")
|
||||
(N_ "Finish the HBCI Setup")
|
||||
(list "_Tools" "HBCI" "")
|
||||
(lambda ()
|
||||
(gnc:hbci-finish-setup)))))
|
||||
|
||||
(gnc:hook-add-dangler gnc:*ui-startup-hook* add-hbci-menu-items)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user