Bug #665998 - Migrate Aqbanking from druid to assistant / builder.

Patch by Robert Fewell

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21734 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2011-12-17 11:02:41 +00:00
parent 73d00a82f8
commit 26fcd177e1
14 changed files with 1765 additions and 1485 deletions

View File

@ -363,10 +363,11 @@ src/html/gnc-html-graph-gog-webkit.c
src/html/gnc-html-history.c
src/html/gnc-html-webkit.c
src/html/gncmod-html.c
src/import-export/aqbanking/aqbanking.glade
src/import-export/aqbanking/assistant-ab-initial.glade
src/import-export/aqbanking/dialog-ab.glade
src/import-export/aqbanking/dialog-ab-trans.c
src/import-export/aqbanking/dialog-daterange.c
src/import-export/aqbanking/druid-ab-initial.c
src/import-export/aqbanking/dialog-ab-daterange.c
src/import-export/aqbanking/assistant-ab-initial.c
src/import-export/aqbanking/gnc-ab-getbalance.c
src/import-export/aqbanking/gnc-ab-gettrans.c
src/import-export/aqbanking/gnc-ab-kvp.c

View File

@ -4,8 +4,8 @@ pkglib_LTLIBRARIES = libgncmod-aqbanking.la
libgncmod_aqbanking_la_SOURCES = \
dialog-ab-trans.c \
dialog-daterange.c \
druid-ab-initial.c \
dialog-ab-daterange.c \
assistant-ab-initial.c \
gnc-ab-getbalance.c \
gnc-ab-gettrans.c \
gnc-ab-kvp.c \
@ -19,8 +19,8 @@ libgncmod_aqbanking_la_SOURCES = \
noinst_HEADERS = \
dialog-ab-trans.h \
dialog-daterange.h \
druid-ab-initial.h \
dialog-ab-daterange.h \
assistant-ab-initial.h \
gnc-ab-getbalance.h \
gnc-ab-gettrans.h \
gnc-ab-kvp.h \
@ -70,10 +70,11 @@ uidir = $(GNC_UI_DIR)
ui_DATA = \
gnc-plugin-aqbanking-ui.xml
gladedir = $(GNC_GLADE_DIR)
glade_DATA = \
aqbanking.glade
gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
gtkbuilder_DATA = \
assistant-ab-initial.glade \
dialog-ab.glade
EXTRA_DIST = ${ui_DATA} ${glade_DATA}
EXTRA_DIST = ${ui_DATA} ${gtkbuilder_DATA}
INCLUDES = -DG_LOG_DOMAIN=\"gnc.import.aqbanking\"

View File

@ -1,5 +1,5 @@
/*
* druid-ab-initial.c --
* assistant-ab-initial.c -- Initialise the AqBanking wizard
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@ -21,11 +21,12 @@
/**
* @internal
* @file druid-ab-initial.c
* @file assistant-ab-initial.c
* @brief AqBanking setup functionality
* @author Copyright (C) 2002 Christian Stimming <stimming@tuhh.de>
* @author Copyright (C) 2006 David Hampton <hampton@employees.org>
* @author Copyright (C) 2008 Andreas Koehler <andi5.py@gmx.net>
* @author Copyright (C) 2011 Robert Fewell
*/
#include "config.h"
@ -42,8 +43,8 @@
#include <unistd.h>
#include "dialog-utils.h"
#include "druid-ab-initial.h"
#include "druid-utils.h"
#include "assistant-ab-initial.h"
#include "assistant-utils.h"
#include "gnc-ab-kvp.h"
#include "gnc-ab-utils.h"
#include "gnc-component-manager.h"
@ -59,42 +60,48 @@
#endif
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = G_LOG_DOMAIN;
static QofLogModule log_module = GNC_MOD_ASSISTANT;
#define DRUID_AB_INITIAL_CM_CLASS "druid-ab-initial"
#define ASSISTANT_AB_INITIAL_CM_CLASS "assistant-ab-initial"
typedef struct _ABInitialInfo ABInitialInfo;
typedef struct _DeferredInfo DeferredInfo;
typedef struct _AccCbData AccCbData;
typedef struct _RevLookupData RevLookupData;
gboolean dai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
void dai_cancel_cb(GnomeDruid *druid, gpointer user_data);
void dai_destroy_cb(GtkObject *object, gpointer user_data);
void dai_wizard_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget, gpointer user_data);
void dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data);
void dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget, gpointer user_data);
void dai_finish_cb(GnomeDruidPage *druid_page, GtkWidget *widget, gpointer user_data);
void aai_on_prepare (GtkAssistant *assistant, GtkWidget *page,
gpointer user_data);
void aai_on_finish (GtkAssistant *gtkassistant, gpointer user_data);
void aai_on_cancel (GtkAssistant *assistant, gpointer user_data);
void aai_destroy_cb(GtkObject *object, gpointer user_data);
gboolean aai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
void aai_wizard_page_prepare (GtkAssistant *assistant, gpointer user_data);
void aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data);
void aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data);
static gboolean banking_has_accounts(AB_BANKING *banking);
static void hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data);
static void druid_enable_next_button(ABInitialInfo *info);
static void druid_disable_next_button(ABInitialInfo *info);
static void child_exit_cb(GPid pid, gint status, gpointer data);
static gchar *ab_account_longname(const AB_ACCOUNT *ab_acc);
static AB_ACCOUNT *update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data);
static void update_account_list(ABInitialInfo *info);
static gboolean find_gnc_acc_cb(gpointer key, gpointer value, gpointer user_data);
static gboolean clear_line_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data);
static void account_list_changed_cb(GtkTreeSelection *selection, gpointer user_data);
static void account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer user_data);
static void clear_kvp_acc_cb(Account *gnc_acc, gpointer user_data);
static void save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data);
static void cm_close_handler(gpointer user_data);
static void aai_close_handler(gpointer user_data);
struct _ABInitialInfo
{
GtkWidget *window;
GtkWidget *druid;
GtkWidget *assistant;
/* account match page */
gboolean match_page_prepared;
@ -140,7 +147,7 @@ enum account_list_cols
};
gboolean
dai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
aai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
if (event->keyval == GDK_Escape)
{
@ -154,7 +161,7 @@ dai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data
}
void
dai_cancel_cb(GnomeDruid *druid, gpointer user_data)
aai_on_cancel (GtkAssistant *gtkassistant, gpointer user_data)
{
ABInitialInfo *info = user_data;
@ -162,18 +169,18 @@ dai_cancel_cb(GnomeDruid *druid, gpointer user_data)
}
void
dai_destroy_cb(GtkObject *object, gpointer user_data)
aai_destroy_cb(GtkObject *object, gpointer user_data)
{
ABInitialInfo *info = user_data;
gnc_unregister_gui_component_by_data(DRUID_AB_INITIAL_CM_CLASS, info);
gnc_unregister_gui_component_by_data(ASSISTANT_AB_INITIAL_CM_CLASS, info);
if (info->deferred_info)
{
g_message("Online Banking druid is being closed but the wizard is still "
g_message("Online Banking assistant is being closed but the wizard is still "
"running. Inoring.");
/* Tell child_exit_cb() that there is no druid anymore */
/* Tell child_exit_cb() that there is no assistant anymore */
info->deferred_info->initial_info = NULL;
}
@ -201,23 +208,28 @@ dai_destroy_cb(GtkObject *object, gpointer user_data)
}
void
dai_wizard_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget,
gpointer user_data)
aai_wizard_page_prepare (GtkAssistant *assistant, gpointer user_data)
{
ABInitialInfo *info = user_data;
gint num = gtk_assistant_get_current_page (assistant);
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
g_return_if_fail(info->api);
/* Enable the Assistant Buttons if we accounts */
if (banking_has_accounts(info->api))
druid_enable_next_button(info);
gtk_assistant_set_page_complete (assistant, page, TRUE);
else
druid_disable_next_button(info);
gtk_assistant_set_page_complete (assistant, page, FALSE);
}
void
dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
{
ABInitialInfo *info = user_data;
gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(info->window));
GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(info->window), num);
AB_BANKING *banking = info->api;
GWEN_BUFFER *buf;
gboolean wizard_exists;
@ -248,8 +260,6 @@ dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
if (!dlg)
{
PERR("Could not lookup Setup Dialog of aqbanking!");
/* Dialog failed, but maybe the user wants to continue anyway */
druid_enable_next_button(info);
}
else
{
@ -257,12 +267,7 @@ dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
if (rv <= 0)
{
/* Dialog was aborted/rejected */
druid_disable_next_button(info);
}
else
{
/* Dialog accepted, all fine */
druid_enable_next_button(info);
PERR("Setup Dialog of aqbanking aborted/rejected !");
}
GWEN_Dialog_free(dlg);
}
@ -278,7 +283,7 @@ dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
/* This is the point where we look for and start an external
* application shipped with aqbanking that contains the setup druid
* application shipped with aqbanking that contains the setup assistant
* for AqBanking related stuff. It requires qt (but not kde). This
* application contains the very verbose step-by-step setup wizard
* for the AqBanking account, and the application is shared with
@ -318,8 +323,6 @@ dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
}
#endif
druid_disable_next_button(info);
if (wizard_exists)
{
/* Call the qt wizard. See the note above about why this
@ -371,57 +374,60 @@ dai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
"ensure this program is present. On some distributions this "
"may require installing additional packages."),
QT3_WIZARD_PACKAGE);
druid_disable_next_button(info);
}
GWEN_Buffer_free(buf);
#endif
/* Enable the Assistant Buttons if we accounts */
if (banking_has_accounts(info->api))
gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, TRUE);
else
gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, FALSE);
LEAVE(" ");
}
void
dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget,
gpointer user_data)
aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data)
{
ABInitialInfo *info = user_data;
gint num = gtk_assistant_get_current_page (assistant);
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
Account *root;
AccCbData data;
g_return_if_fail(info && info->api);
/* No way back */
gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid),
FALSE, TRUE, TRUE, TRUE);
/* Do not run this twice */
if (info->match_page_prepared)
return;
else
info->match_page_prepared = TRUE;
/* Load aqbanking accounts */
if (!info->match_page_prepared)
{
/* Load aqbanking accounts */
#ifdef AQBANKING_VERSION_4_EXACTLY
AB_Banking_OnlineInit(info->api, 0);
AB_Banking_OnlineInit(info->api, 0);
#else
AB_Banking_OnlineInit(info->api);
AB_Banking_OnlineInit(info->api);
#endif
/* Determine current mapping */
root = gnc_book_get_root_account(gnc_get_current_book());
info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal);
data.api = info->api;
data.hash = info->gnc_hash;
gnc_account_foreach_descendant(
root, (AccountCb) hash_from_kvp_acc_cb, &data);
/* Determine current mapping */
root = gnc_book_get_root_account(gnc_get_current_book());
info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal);
data.api = info->api;
data.hash = info->gnc_hash;
gnc_account_foreach_descendant(
root, (AccountCb) hash_from_kvp_acc_cb, &data);
info->match_page_prepared = TRUE;
}
/* Update the graphical representation */
update_account_list(info);
/* Enable the Assistant Buttons */
gtk_assistant_set_page_complete (assistant, page, TRUE);
}
void
dai_finish_cb(GnomeDruidPage *druid_page, GtkWidget *widget,
gpointer user_data)
aai_on_finish (GtkAssistant *assistant, gpointer user_data)
{
ABInitialInfo *info = user_data;
Account *root;
@ -479,27 +485,14 @@ hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
g_hash_table_insert(data->hash, ab_acc, gnc_acc);
}
static void
druid_enable_next_button(ABInitialInfo *info)
{
g_return_if_fail(info);
gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid),
TRUE, TRUE, TRUE, TRUE);
}
static void
druid_disable_next_button(ABInitialInfo *info)
{
g_return_if_fail(info);
gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid),
TRUE, FALSE, TRUE, TRUE);
}
static void
child_exit_cb(GPid pid, gint status, gpointer data)
{
DeferredInfo *deferred_info = data;
ABInitialInfo *info = deferred_info->initial_info;
gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(info->window));
GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(info->window), num);
gint exit_status;
#ifdef G_OS_WIN32
@ -512,14 +505,14 @@ child_exit_cb(GPid pid, gint status, gpointer data)
if (!info)
{
g_message("Online Banking wizard exited, but the druid has been "
g_message("Online Banking wizard exited, but the assistant has been "
"destroyed already");
goto cleanup_child_exit_cb;
}
if (exit_status == 0)
{
druid_enable_next_button(info);
gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, TRUE);
}
else
{
@ -556,7 +549,7 @@ child_exit_cb(GPid pid, gint status, gpointer data)
"if this wizard has run successfully. "
"Please try running the \"AqBanking Setup Wizard\" again."));
}
druid_disable_next_button(info);
gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, FALSE);
}
cleanup_child_exit_cb:
@ -624,9 +617,9 @@ update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data)
ACCOUNT_LIST_COL_GNC_NAME, gnc_name,
ACCOUNT_LIST_COL_CHECKED, FALSE,
-1);
g_free(gnc_name);
g_free(ab_name);
return NULL;
}
@ -653,6 +646,7 @@ update_account_list(ABInitialInfo *info)
/* Attach model to view again */
gtk_tree_view_set_model(info->account_view,
GTK_TREE_MODEL(info->account_store));
g_object_unref(info->account_store);
}
@ -693,9 +687,11 @@ clear_line_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
}
static void
account_list_changed_cb(GtkTreeSelection *selection, gpointer user_data)
account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer user_data)
{
ABInitialInfo *info = user_data;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
AB_ACCOUNT *ab_acc;
@ -707,14 +703,15 @@ account_list_changed_cb(GtkTreeSelection *selection, gpointer user_data)
g_return_if_fail(info);
if (!gtk_tree_selection_get_selected(selection, &model, &iter))
return;
gtk_tree_model_get(model, &iter, ACCOUNT_LIST_COL_AB_ACCT, &ab_acc, -1);
PINFO("Row has been double-clicked.");
/* Avoid recursion when unselecting the item again */
g_signal_handlers_block_by_func(selection, account_list_changed_cb, info);
gtk_tree_selection_unselect_iter(selection, &iter);
g_signal_handlers_unblock_by_func(selection, account_list_changed_cb, info);
model = gtk_tree_view_get_model(view);
selection = gtk_tree_view_get_selection(info->account_view);
if (!gtk_tree_model_get_iter(model, &iter, path))
return; /* path describes a non-existing row - should not happen */
gtk_tree_model_get(model, &iter, ACCOUNT_LIST_COL_AB_ACCT, &ab_acc, -1);
if (ab_acc)
{
@ -819,33 +816,48 @@ save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data)
}
static void
cm_close_handler(gpointer user_data)
aai_close_handler(gpointer user_data)
{
ABInitialInfo *info = user_data;
gtk_widget_destroy(info->window);
}
void aai_on_prepare (GtkAssistant *assistant, GtkWidget *page,
gpointer user_data)
{
ABInitialInfo *info = user_data;
gint currentpage = gtk_assistant_get_current_page(assistant);
switch (gtk_assistant_get_current_page(assistant))
{
case 1:
/* Current page is wizard button page */
aai_wizard_page_prepare (assistant , user_data );
break;
case 2:
/* Current page is match page */
aai_match_page_prepare (assistant , user_data );
break;
}
}
void
gnc_ab_initial_druid(void)
gnc_ab_initial_assistant(void)
{
ABInitialInfo *info;
GladeXML *xml;
GtkBuilder *builder;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
gint component_id;
info = g_new0(ABInitialInfo, 1);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder,"assistant-ab-initial.glade", "AqBanking Init Assistant");
xml = gnc_glade_xml_new("aqbanking.glade", "AqBanking Init Druid");
info->window = GTK_WIDGET(gtk_builder_get_object (builder, "AqBanking Init Assistant"));
info->window = glade_xml_get_widget(xml, "AqBanking Init Druid");
g_object_set_data_full(G_OBJECT(info->window), "xml", xml, g_object_unref);
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
info);
info->druid = glade_xml_get_widget(xml, "ab_init_druid");
gnc_druid_set_colors(GNOME_DRUID(info->druid));
gnc_assistant_set_colors (GTK_ASSISTANT (info->assistant));
info->api = gnc_AB_BANKING_new();
info->deferred_info = NULL;
@ -853,7 +865,8 @@ gnc_ab_initial_druid(void)
info->match_page_prepared = FALSE;
info->account_view =
GTK_TREE_VIEW(glade_xml_get_widget(xml, "account_page_view"));
GTK_TREE_VIEW(gtk_builder_get_object (builder, "account_page_view"));
info->account_store = gtk_list_store_new(NUM_ACCOUNT_LIST_COLS,
G_TYPE_INT, G_TYPE_STRING,
G_TYPE_POINTER, G_TYPE_STRING,
@ -879,11 +892,20 @@ gnc_ab_initial_druid(void)
gtk_tree_view_append_column(info->account_view, column);
selection = gtk_tree_view_get_selection(info->account_view);
g_signal_connect(selection, "changed",
G_CALLBACK(account_list_changed_cb), info);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect(info->account_view, "row-activated",
G_CALLBACK(account_list_clicked_cb), info);
g_signal_connect (G_OBJECT(info->window), "destroy",
G_CALLBACK (aai_destroy_cb), info);
gtk_builder_connect_signals(builder, info);
g_object_unref(G_OBJECT(builder));
component_id = gnc_register_gui_component(ASSISTANT_AB_INITIAL_CM_CLASS,
NULL, aai_close_handler, info);
component_id = gnc_register_gui_component(DRUID_AB_INITIAL_CM_CLASS,
NULL, cm_close_handler, info);
gnc_gui_component_set_session(component_id, gnc_get_current_session());
gtk_widget_show(info->window);

View File

@ -0,0 +1,162 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkAssistant" id="AqBanking Init Assistant">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="title" translatable="yes">AqBanking Initial Assistant</property>
<signal name="close" handler="aai_on_finish" swapped="no"/>
<signal name="prepare" handler="aai_on_prepare" swapped="no"/>
<signal name="cancel" handler="aai_on_cancel" swapped="no"/>
<child>
<object class="GtkLabel" id="start_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">
This assistant helps you setting up your Online Banking connection with your bank.
You first need to apply for Online Banking access at your bank. If your bank decides to grant you electronic access, they will send you a letter containing
* The bank code of your bank
* The user ID that identifies you to your bank
* The Internet address of your bank's Online Banking server
* For HBCI Online Banking, information about the cryptographic public key of your bank ("Ini-Letter").
This information will be needed in the following. Press "Forward" now.
NOTE: NO WARRANTIES FOR ANYTHING. Some banks run a poorly implemented Online Banking server. You should not rely on time-critical transfers through Online Banking, because sometimes the bank does not give you correct feedback when a transfer is rejected.
Press "Cancel" if you do not wish to setup any Online Banking connection now.
</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="page_type">intro</property>
<property name="title" translatable="yes">Initial Online Banking Setup</property>
<property name="complete">True</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="wizard_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label8877441">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">The Setup of your Online Banking connection is handled by the external program "AqBanking Setup Wizard". Please press the button below to start this program.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xscale">0</property>
<child>
<object class="GtkButton" id="ab_wizard_button">
<property name="label" translatable="yes">_Start AqBanking Wizard</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="aai_wizard_button_clicked_cb" swapped="no"/>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="page_type">intro</property>
<property name="title" translatable="yes">Start Online Banking Wizard</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="account_match_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<child>
<object class="GtkVBox" id="vbox157">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow25">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="account_page_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="rules_hint">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label828">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Double Click on the line of an Online Banking account name if you want to match it to a GnuCash account. Click "Forward" when all desired accounts are matching.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Match Online accounts with GnuCash accounts</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="finish_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">The setup for matching Online Banking accounts to GnuCash accounts is now finished. You can now invoke Online Banking actions on those accounts.
If you want to add another bank, user, or account, you can start this assistant again anytime.
Press "Apply" now.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="page_type">confirm</property>
<property name="title" translatable="yes">Online Banking Setup Finished</property>
<property name="complete">True</property>
</packing>
</child>
</object>
</interface>

View File

@ -1,5 +1,5 @@
/*
* druid-ab-initial.h -- aqbanking creation functionality
* assistant-ab-initial.h -- aqbanking creation functionality
*
*
* This program is free software; you can redistribute it and/or
@ -25,27 +25,27 @@
* @{
* @addtogroup AqBanking
* @{
* @file druid-ab-initial.h
* @file assistant-ab-initial.h
* @brief AqBanking setup functionality
* @author Copyright (C) 2002 Christian Stimming <stimming@tuhh.de>
* @author Copyright (C) 2008 Andreas Koehler <andi5.py@gmx.net>
*/
#ifndef DRUID_AB_INITIAL_H
#define DRUID_AB_INITIAL_H
#ifndef ASSISTANT_AB_INITIAL_H
#define ASSISTANT_AB_INITIAL_H
#include <glib.h>
G_BEGIN_DECLS
/**
* Create and show a druid for the aqbanking setup.
* Create and show an assistant for the aqbanking setup.
*/
void gnc_ab_initial_druid(void);
void gnc_ab_initial_assistant(void);
G_END_DECLS
/** @} */
/** @} */
#endif /* DRUID_AB_INITIAL_H */
#endif /* ASSISTANT_AB_INITIAL_H */

View File

@ -1,5 +1,5 @@
/*
* dialog-daterange.c --
* dialog-ab-daterange.c --
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@ -29,7 +29,7 @@
#include "config.h"
#include "dialog-daterange.h"
#include "dialog-ab-daterange.h"
#include "dialog-utils.h"
#include "gnc-date-edit.h"
@ -57,7 +57,7 @@ gnc_ab_enter_daterange(GtkWidget *parent,
Timespec *to_date,
gboolean *to_now)
{
GladeXML *xml;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *heading_label;
GtkWidget *first_button;
@ -68,30 +68,31 @@ gnc_ab_enter_daterange(GtkWidget *parent,
ENTER("");
xml = gnc_glade_xml_new("aqbanking.glade", "Date Range Dialog");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "Date Range Dialog");
dialog = glade_xml_get_widget(xml, "Date Range Dialog");
g_object_set_data_full(G_OBJECT(dialog), "xml", xml, g_object_unref);
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
&info);
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Date Range Dialog"));
/* Connect the signals */
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, &info );
if (parent)
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
heading_label = glade_xml_get_widget(xml, "heading_label");
first_button = glade_xml_get_widget(xml, "first_button");
last_retrieval_button = glade_xml_get_widget(xml, "last_retrieval_button");
info.enter_from_button = glade_xml_get_widget(xml, "enter_from_button");
now_button = glade_xml_get_widget(xml, "now_button");
info.enter_to_button = glade_xml_get_widget(xml, "enter_to_button");
heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
first_button = GTK_WIDGET(gtk_builder_get_object (builder, "first_button"));
last_retrieval_button = GTK_WIDGET(gtk_builder_get_object (builder, "last_retrieval_button"));
info.enter_from_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_from_button"));
now_button = GTK_WIDGET(gtk_builder_get_object (builder, "now_button"));
info.enter_to_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_to_button"));
info.from_dateedit = gnc_date_edit_new_ts(*from_date, FALSE, FALSE);
gtk_container_add(GTK_CONTAINER(glade_xml_get_widget(xml, "enter_from_box")),
gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_from_box")),
info.from_dateedit);
gtk_widget_show(info.from_dateedit);
info.to_dateedit = gnc_date_edit_new_ts(*to_date, FALSE, FALSE);
gtk_container_add(GTK_CONTAINER(glade_xml_get_widget(xml, "enter_to_box")),
gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_to_box")),
info.to_dateedit);
gtk_widget_show(info.to_dateedit);
@ -133,6 +134,8 @@ gnc_ab_enter_daterange(GtkWidget *parent,
GTK_TOGGLE_BUTTON(now_button));
}
g_object_unref(G_OBJECT(builder));
gtk_widget_destroy(dialog);
LEAVE("");

View File

@ -1,5 +1,5 @@
/*
* dialog-daterange.h --
* dialog-ab-daterange.h --
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as

View File

@ -203,7 +203,7 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
GList *templates)
{
GncABTransDialog *td;
GladeXML *xml;
GtkBuilder *builder;
const gchar *ab_ownername;
const gchar *ab_accountnumber;
const gchar *ab_bankname;
@ -244,38 +244,37 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
td->blzcheck = AccountNumberCheck_new();
#endif
xml = gnc_glade_xml_new("aqbanking.glade", "Transaction Dialog");
td->dialog = glade_xml_get_widget(xml, "Transaction Dialog");
g_object_set_data_full(G_OBJECT(td->dialog), "xml", xml, g_object_unref);
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, td);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "Transaction Dialog");
td->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Transaction Dialog"));
if (parent)
gtk_window_set_transient_for(GTK_WINDOW(td->dialog), GTK_WINDOW(parent));
/* Extract widgets */
heading_label = glade_xml_get_widget(xml, "heading_label");
recp_name_heading = glade_xml_get_widget(xml, "recp_name_heading");
td->recp_name_entry = glade_xml_get_widget(xml, "recp_name_entry");
recp_account_heading = glade_xml_get_widget(xml, "recp_account_heading");
td->recp_account_entry = glade_xml_get_widget(xml, "recp_account_entry");
recp_bankcode_heading = glade_xml_get_widget(xml, "recp_bankcode_heading");
td->recp_bankcode_entry = glade_xml_get_widget(xml, "recp_bankcode_entry");
td->recp_bankname_label = glade_xml_get_widget(xml, "recp_bankname_label");
amount_hbox = glade_xml_get_widget(xml, "amount_hbox");
td->purpose_entry = glade_xml_get_widget(xml, "purpose_entry");
td->purpose_cont_entry = glade_xml_get_widget(xml, "purpose_cont_entry");
td->purpose_cont2_entry = glade_xml_get_widget(xml, "purpose_cont2_entry");
td->purpose_cont3_entry = glade_xml_get_widget(xml, "purpose_cont3_entry");
orig_name_heading = glade_xml_get_widget(xml, "orig_name_heading");
orig_name_label = glade_xml_get_widget(xml, "orig_name_label");
orig_account_heading = glade_xml_get_widget(xml, "orig_account_heading");
orig_account_label = glade_xml_get_widget(xml, "orig_account_label");
orig_bankname_heading = glade_xml_get_widget(xml, "orig_bankname_heading");
orig_bankname_label = glade_xml_get_widget(xml, "orig_bankname_label");
orig_bankcode_heading = glade_xml_get_widget(xml, "orig_bankcode_heading");
orig_bankcode_label = glade_xml_get_widget(xml, "orig_bankcode_label");
heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
recp_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_heading"));
td->recp_name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_entry"));
recp_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_heading"));
td->recp_account_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_entry"));
recp_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_heading"));
td->recp_bankcode_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_entry"));
td->recp_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankname_label"));
amount_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox"));
td->purpose_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_entry"));
td->purpose_cont_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont_entry"));
td->purpose_cont2_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont2_entry"));
td->purpose_cont3_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont3_entry"));
orig_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_heading"));
orig_name_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_label"));
orig_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_heading"));
orig_account_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_label"));
orig_bankname_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_heading"));
orig_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_label"));
orig_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_heading"));
orig_bankcode_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_label"));
td->template_gtktreeview =
GTK_TREE_VIEW(glade_xml_get_widget(xml, "template_list"));
GTK_TREE_VIEW(gtk_builder_get_object (builder, "template_list"));
/* Amount edit */
td->amount_edit = gnc_amount_edit_new();
@ -348,6 +347,11 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
"Template Name", renderer, "text", TEMPLATE_NAME, NULL);
gtk_tree_view_append_column(td->template_gtktreeview, column);
/* Connect the Signals */
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, td);
g_object_unref(G_OBJECT(builder));
return td;
}
@ -873,7 +877,7 @@ void
dat_add_templ_cb(GtkButton *button, gpointer user_data)
{
GncABTransDialog *td = user_data;
GladeXML *xml;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *entry;
gint retval;
@ -887,10 +891,11 @@ dat_add_templ_cb(GtkButton *button, gpointer user_data)
g_return_if_fail(td);
ENTER("td=%p", td);
xml = gnc_glade_xml_new ("aqbanking.glade", "Template Name Dialog");
dialog = glade_xml_get_widget(xml, "Template Name Dialog");
g_object_set_data_full(G_OBJECT(dialog), "xml", xml, g_object_unref);
entry = glade_xml_get_widget(xml, "template_name");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "Template Name Dialog");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Template Name Dialog"));
entry = GTK_WIDGET(gtk_builder_get_object (builder, "template_name"));
/* Suggest recipient name as name of the template */
gtk_entry_set_text(GTK_ENTRY(entry),
@ -949,6 +954,8 @@ dat_add_templ_cb(GtkButton *button, gpointer user_data)
}
while (TRUE);
g_object_unref(G_OBJECT(builder));
gtk_widget_destroy(dialog);
LEAVE(" ");

View File

@ -34,7 +34,7 @@
#include <aqbanking/jobgettransactions.h>
#include "Account.h"
#include "dialog-daterange.h"
#include "dialog-ab-daterange.h"
#include "gnc-ab-gettrans.h"
#include "gnc-ab-kvp.h"
#include "gnc-ab-utils.h"

View File

@ -28,6 +28,7 @@
*/
#include "config.h"
#include "gnc-ui-util.h"
#include "gnc-ab-kvp.h"
@ -144,11 +145,12 @@ static void
force_account_dirty(Account *acct)
{
gchar *name = g_strdup(xaccAccountGetName(acct));
QofBook *book = gnc_get_current_book ();
/* This is necessary because modifying the KvpFrames doesn't mark
* accounts dirty, which means the changes wont be propagated to the
* backend.
*/
qof_book_mark_dirty(book);
xaccAccountSetName(acct, name);
g_free(name);
}

View File

@ -515,33 +515,36 @@ unregister_callbacks(GncGWENGui *gui)
static void
setup_dialog(GncGWENGui *gui)
{
GladeXML *xml;
GtkBuilder *builder;
gint component_id;
g_return_if_fail(gui);
ENTER("gui=%p", gui);
xml = gnc_glade_xml_new("aqbanking.glade", "Connection Dialog");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "Connection Dialog");
gui->dialog = glade_xml_get_widget(xml, "Connection Dialog");
g_object_set_data_full(G_OBJECT(gui->dialog), "xml", xml, g_object_unref);
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, gui);
gui->entries_table = glade_xml_get_widget(xml, "entries_table");
gui->top_entry = glade_xml_get_widget(xml, "top_entry");
gui->top_progress = glade_xml_get_widget(xml, "top_progress");
gui->second_entry = glade_xml_get_widget(xml, "second_entry");
gui->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Connection Dialog"));
gui->entries_table = GTK_WIDGET(gtk_builder_get_object (builder, "entries_table"));
gui->top_entry = GTK_WIDGET(gtk_builder_get_object (builder, "top_entry"));
gui->top_progress = GTK_WIDGET(gtk_builder_get_object (builder, "top_progress"));
gui->second_entry = GTK_WIDGET(gtk_builder_get_object (builder, "second_entry"));
gui->other_entries_box = NULL;
gui->progresses = NULL;
gui->log_text = glade_xml_get_widget(xml, "log_text");
gui->abort_button = glade_xml_get_widget(xml, "abort_button");
gui->close_button = glade_xml_get_widget(xml, "close_button");
gui->close_checkbutton = glade_xml_get_widget(xml, "close_checkbutton");
gui->log_text = GTK_WIDGET(gtk_builder_get_object (builder, "log_text"));
gui->abort_button = GTK_WIDGET(gtk_builder_get_object (builder, "abort_button"));
gui->close_button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
gui->close_checkbutton = GTK_WIDGET(gtk_builder_get_object (builder, "close_checkbutton"));
gui->accepted_certs = NULL;
gui->permanently_accepted_certs = NULL;
gui->showbox_hash = NULL;
gui->showbox_id = 1;
/* Connect the Signals */
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gui);
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON(gui->close_checkbutton),
gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL));
@ -550,6 +553,10 @@ setup_dialog(GncGWENGui *gui)
cm_close_handler, gui);
gnc_gui_component_set_session(component_id, gnc_get_current_session());
g_object_unref(G_OBJECT(builder));
reset_dialog(gui);
LEAVE(" ");
@ -971,7 +978,7 @@ static void
get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text,
gchar **input, gint min_len, gint max_len)
{
GladeXML *xml;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *heading_label;
GtkWidget *input_entry;
@ -990,15 +997,15 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text,
ENTER(" ");
/* Set up dialog */
xml = gnc_glade_xml_new("aqbanking.glade", "Password Dialog");
dialog = glade_xml_get_widget(xml, "Password Dialog");
g_object_set_data_full(G_OBJECT(dialog), "xml", xml, g_object_unref);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "Password Dialog");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Password Dialog"));
heading_label = glade_xml_get_widget(xml, "heading_label");
input_entry = glade_xml_get_widget(xml, "input_entry");
confirm_entry = glade_xml_get_widget(xml, "confirm_entry");
confirm_label = glade_xml_get_widget(xml, "confirm_label");
remember_pin_checkbutton = glade_xml_get_widget(xml, "remember_pin");
heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
input_entry = GTK_WIDGET(gtk_builder_get_object (builder, "input_entry"));
confirm_entry = GTK_WIDGET(gtk_builder_get_object (builder, "confirm_entry"));
confirm_label = GTK_WIDGET(gtk_builder_get_object (builder, "confirm_label"));
remember_pin_checkbutton = GTK_WIDGET(gtk_builder_get_object (builder, "remember_pin"));
if (is_tan)
{
gtk_widget_hide(remember_pin_checkbutton);
@ -1091,6 +1098,8 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text,
}
}
g_object_unref(G_OBJECT(builder));
/* This trashes passwords in the entries' memory as well */
gtk_widget_destroy(dialog);

View File

@ -34,7 +34,7 @@
#include "Account.h"
#include "dialog-ab-trans.h"
#include "druid-ab-initial.h"
#include "assistant-ab-initial.h"
#include "gnc-ab-getbalance.h"
#include "gnc-ab-gettrans.h"
#include "gnc-ab-transfer.h"
@ -430,7 +430,7 @@ static void
gnc_plugin_ab_cmd_setup(GtkAction *action, GncMainWindowActionData *data)
{
ENTER("action %p, main window data %p", action, data);
gnc_ab_initial_druid();
gnc_ab_initial_assistant();
LEAVE(" ");
}

View File

@ -73,7 +73,9 @@ libgncmod_aqbanking_gnc_module_init(gint refcount)
/* Add menu items with C callbacks */
gnc_plugin_aqbanking_create_plugin();
gnc_preferences_add_to_page("aqbanking.glade", "aqbanking_prefs",
/* Add AqBanking preferences to the preferences dialog */
gnc_preferences_add_to_page("dialog-ab.glade", "aqbanking_prefs",
_("Online Banking"));
/* Initialize gwen library */