mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2002-09-18 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gncmod-hbci.c: Add menu-extension code for register menu items. * src/import-export/hbci/gnc-hbci-cb.h: add callback for register window's menu. * src/import-export/hbci/gnc-hbci-actions.c: Fix/improve first real HBCI task so that it might actually run. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7231 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
32808a9cf2
commit
ee73c15de5
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2002-09-18 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/gncmod-hbci.c: Add menu-extension code
|
||||
for register menu items.
|
||||
|
||||
* src/import-export/hbci/gnc-hbci-cb.h: add callback for register
|
||||
window's menu.
|
||||
|
||||
* src/import-export/hbci/gnc-hbci-actions.c: Fix/improve first
|
||||
real HBCI task so that it might actually run.
|
||||
|
||||
2002-09-17 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/gnome/window-register.c (regWindowLedger): Uses the
|
||||
|
@ -46,6 +46,9 @@ AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/gnome \
|
||||
-I${top_srcdir}/src/gnome-utils \
|
||||
-I${top_srcdir}/src/import-export \
|
||||
-I${top_srcdir}/src/register \
|
||||
-I${top_srcdir}/src/register/register-core \
|
||||
-I${top_srcdir}/src/register/ledger-core \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS} \
|
||||
${GLIB_CFLAGS} \
|
||||
|
@ -889,10 +889,37 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage,
|
||||
return FALSE;
|
||||
|
||||
{
|
||||
/* Execute a GetAccounts job. */
|
||||
/* Execute a Synchronize job, then a GetAccounts job. */
|
||||
HBCI_OutboxJob *job;
|
||||
HBCI_Error *err;
|
||||
|
||||
|
||||
job = HBCI_OutboxJobGetSystemId_OutboxJob
|
||||
(HBCI_OutboxJobGetSystemId_new (info->api,
|
||||
(HBCI_Customer *)info->newcustomer));
|
||||
HBCI_API_addJob (info->api, job);
|
||||
|
||||
if (info->interactor)
|
||||
GNCInteractor_show (info->interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(2);
|
||||
err = HBCI_API_executeQueue (info->api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
char *errstr = g_strdup_printf("on_accountinfo_next: Error at executeQueue: %s",
|
||||
HBCI_Error_message (err));
|
||||
printf("%s; status %d, result %d\n", errstr, HBCI_OutboxJob_status(job),
|
||||
HBCI_OutboxJob_result(job));
|
||||
HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor
|
||||
(HBCI_API_Hbci (info->api)), errstr);
|
||||
g_free (errstr);
|
||||
HBCI_Error_delete (err);
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return FALSE;
|
||||
}
|
||||
HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_DONE);
|
||||
HBCI_Error_delete (err);
|
||||
|
||||
/* Now the GetAccounts job. */
|
||||
job = HBCI_OutboxJobGetAccounts_OutboxJob
|
||||
(HBCI_OutboxJobGetAccounts_new ((HBCI_Customer *)info->newcustomer));
|
||||
HBCI_API_addJob (info->api, job);
|
||||
|
@ -41,6 +41,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
g_assert(gnc_acc);
|
||||
|
||||
api = gnc_hbci_api_new_currentbook (parent, &interactor);
|
||||
g_assert (interactor);
|
||||
if (api == NULL) {
|
||||
printf("gnc_hbci_getbalance: Couldn't get HBCI API.\n");
|
||||
return;
|
||||
@ -51,6 +52,8 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
printf("gnc_hbci_getbalance: No HBCI account found.\n");
|
||||
return;
|
||||
}
|
||||
printf("gnc_hbci_getbalance: HBCI account no. %s found.\n",
|
||||
HBCI_Account_accountId (h_acc));
|
||||
|
||||
{
|
||||
/* Get one customer. */
|
||||
@ -75,6 +78,8 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
list_HBCI_Customer_iter_delete (iter);
|
||||
}
|
||||
g_assert (customer);
|
||||
printf("gnc_hbci_getbalance: Customer id %s found.\n",
|
||||
HBCI_Customer_custId ((HBCI_Customer *)customer));
|
||||
|
||||
{
|
||||
/* Execute a GetBalance job. */
|
||||
@ -85,12 +90,13 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
balance_job =
|
||||
HBCI_OutboxJobGetBalance_new (customer, (HBCI_Account *)h_acc);
|
||||
job = HBCI_OutboxJobGetBalance_OutboxJob (balance_job);
|
||||
g_assert (job);
|
||||
HBCI_API_addJob (api, job);
|
||||
|
||||
if (interactor)
|
||||
GNCInteractor_show (interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(2);
|
||||
HBCI_Hbci_setDebugLevel(0);
|
||||
err = HBCI_API_executeQueue (api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
@ -105,7 +111,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return;
|
||||
}
|
||||
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);
|
||||
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
|
||||
HBCI_Error_delete (err);
|
||||
|
||||
{
|
||||
@ -118,7 +124,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
val = HBCI_Balance_value (bal);
|
||||
|
||||
gnc_verify_dialog(TRUE,
|
||||
"Account balance is %f.",
|
||||
"Result of HBCI job: \nAccount balance is %f.",
|
||||
HBCI_Value_getValue (val));
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "Account.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "window-acct-tree.h"
|
||||
#include "window-register.h"
|
||||
|
||||
#include "gnc-hbci-actions.h"
|
||||
|
||||
@ -32,13 +33,39 @@ void
|
||||
gnc_hbci_acct_tree_menu_getbalance_cb (GtkWidget * widget,
|
||||
GnomeMDIChild * child)
|
||||
{
|
||||
GNCMDIChildInfo * mc = gtk_object_get_user_data(GTK_OBJECT(child));
|
||||
GNCAcctTreeWin * win = mc->user_data;
|
||||
Account * account = gnc_acct_tree_window_get_current_account(win);
|
||||
|
||||
GNCMDIChildInfo * mc = NULL;
|
||||
GNCAcctTreeWin * win = NULL;
|
||||
Account * account = NULL;
|
||||
|
||||
g_assert (child);
|
||||
mc = gtk_object_get_user_data(GTK_OBJECT(child));
|
||||
g_assert (mc);
|
||||
win = mc->user_data;
|
||||
g_assert (win);
|
||||
account = gnc_acct_tree_window_get_current_account(win);
|
||||
g_assert (account);
|
||||
|
||||
gnc_hbci_getbalance (gnc_ui_get_toplevel (), account);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_hbci_register_menu_getbalance_cb (GtkWidget * widget,
|
||||
gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
GNCLedgerDisplay *ledger = NULL;
|
||||
Account *account = NULL;
|
||||
|
||||
/* g_assert (widget);*/
|
||||
g_assert (regData);
|
||||
ledger = gnc_RegWindow_ledger (regData);
|
||||
g_assert (ledger);
|
||||
account = gnc_ledger_display_leader (ledger);
|
||||
g_assert (account);
|
||||
|
||||
gnc_hbci_getbalance (gnc_RegWindow_window (regData), account);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_hbci_acct_tree_menu_gettrans_cb (GtkWidget * widget,
|
||||
GnomeMDIChild * child)
|
||||
|
@ -30,6 +30,11 @@ void
|
||||
gnc_hbci_acct_tree_menu_getbalance_cb (GtkWidget * widget,
|
||||
GnomeMDIChild * child);
|
||||
|
||||
/* Callback from register window to invoke Get Balance. */
|
||||
void
|
||||
gnc_hbci_register_menu_getbalance_cb (GtkWidget * widget,
|
||||
gpointer data);
|
||||
|
||||
/* Callback from account tree window to invoke Get Transactions (not
|
||||
* yet implemented). */
|
||||
void
|
||||
|
@ -11,9 +11,11 @@
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "gnc-menu-extensions.h"
|
||||
|
||||
#include "gnc-hbci-cb.h"
|
||||
#include "druid-hbci-initial.h"
|
||||
#include "druid-hbci-final.h"
|
||||
//#include "druid-hbci-final.h"
|
||||
|
||||
/* version of the gnc module system interface we require */
|
||||
int gnc_module_system_interface = 0;
|
||||
@ -44,7 +46,6 @@ gnc_module_description(void) {
|
||||
int
|
||||
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;
|
||||
@ -65,14 +66,34 @@ 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");
|
||||
gh_new_procedure("gnc:hbci-initial-setup",
|
||||
scm_hbci_initial_druid, 0, 0, 0);
|
||||
|
||||
/* Add menu items with C callbacks */
|
||||
{
|
||||
static GnomeUIInfo reg_online_submenu[] =
|
||||
{
|
||||
GNOMEUIINFO_ITEM ( N_("HBCI Get Balance"),
|
||||
N_("Get the account balance online through HBCI"),
|
||||
gnc_hbci_register_menu_getbalance_cb,
|
||||
GNOME_APP_PIXMAP_NONE),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
static GnomeUIInfo reg_online_menu[] =
|
||||
{
|
||||
GNOMEUIINFO_SUBTREE( N_("Online Actions"),
|
||||
reg_online_submenu ),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
|
||||
gnc_add_c_extension (reg_online_menu, WINDOW_NAME_REGISTER "/Actions/");
|
||||
}
|
||||
|
||||
//gh_new_procedure("gnc:hbci-finish-setup",
|
||||
//scm_hbci_final_druid, 0, 0, 0);
|
||||
|
||||
//printf("Been in gncmod-hbci.c.\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -9,13 +9,28 @@
|
||||
(gnc:add-extension
|
||||
(gnc:make-menu "HBCI" (list gnc:window-name-main "_Tools" "")))
|
||||
|
||||
|
||||
(gnc:add-extension
|
||||
(gnc:make-menu-item (N_ "HBCI Setup")
|
||||
(N_ "HBCI Setup")
|
||||
(list gnc:window-name-main "Tools" "HBCI" "")
|
||||
(list gnc:window-name-main "_Tools" "HBCI" "")
|
||||
(lambda ()
|
||||
(gnc:hbci-initial-setup))))
|
||||
|
||||
; (gnc:add-extension
|
||||
; (gnc:make-menu "Online" (list gnc:window-name-register "Actions" "")))
|
||||
|
||||
; (gnc:add-extension
|
||||
; (gnc:make-menu-item (N_ "Get Balance")
|
||||
; (N_ "Get Balance")
|
||||
; (list gnc:window-name-register "Actions" "Online" "")
|
||||
; (lambda ()
|
||||
; (gnc:hbci-initial-setup))))
|
||||
; (gnc:add-extension
|
||||
; (gnc:make-menu-item (N_ "Get Transactions")
|
||||
; (N_ "Get Transactions")
|
||||
; (list gnc:window-name-register "Actions" "Online" "")
|
||||
; (lambda ()
|
||||
; (gnc:hbci-initial-setup))))
|
||||
)
|
||||
; (gnc:add-extension
|
||||
; (gnc:make-menu-item (N_ "Final HBCI Setup")
|
||||
|
Loading…
Reference in New Issue
Block a user