Implement AQBanking import selection dialog directly in Gtk.

This commit is contained in:
John Ralls 2022-10-11 14:12:12 -07:00
parent 118fc8cbaf
commit 5a0455462c
11 changed files with 681 additions and 14 deletions

View File

@ -6,6 +6,7 @@ add_subdirectory(test)
set (aqbanking_SOURCES
dialog-ab-trans.c
dialog-ab-daterange.c
dialog-ab-select-imexporter.c
assistant-ab-initial.c
gnc-ab-getbalance.c
gnc-ab-gettrans.c
@ -25,6 +26,7 @@ set_source_files_properties (${aqbanking_SOURCES} PROPERTIES OBJECT_DEPENDS ${CO
set (aqbanking_noinst_HEADERS
dialog-ab-trans.h
dialog-ab-daterange.h
dialog-ab-select-imexporter.h
assistant-ab-initial.h
gnc-ab-getbalance.h
gnc-ab-gettrans.h

View File

@ -0,0 +1,257 @@
/*
* dialog-ab-select-imexporter.c --
*
* 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
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
/**
* @internal
* @file dialog-ab-select-imexporter.h
* @brief Dialog to select AQBanking importer/exporter and format profile.
* @author Copyright (C) 2022 John Ralls <jralls@ceridwen.us>
*/
#include <config.h>
#include <glib/gi18n.h>
#include "dialog-ab-select-imexporter.h"
#include <dialog-utils.h>
static QofLogModule log_module = G_LOG_DOMAIN;
struct _GncABSelectImExDlg
{
GtkWidget *dialog;
GtkWidget *parent;
GtkListStore *imexporter_list;
GtkListStore *profile_list;
GtkWidget *select_imexporter;
GtkWidget *select_profile;
GtkWidget *ok_button;
AB_BANKING* abi;
};
// Expose the selection handlers to GtkBuilder.
G_MODULE_EXPORT gboolean imexporter_changed(GtkTreeSelection* sel,
gpointer data);
G_MODULE_EXPORT gboolean profile_changed(GtkTreeSelection* sel, gpointer data);
static gboolean
clear_model_row (GtkTreeModel* model, GtkTreePath* path,
GtkTreeIter* iter, gpointer data)
{
char *name, *desc;
g_return_val_if_fail (model && iter, TRUE);
gtk_tree_model_get (model, iter, 0, &name, 1, &desc, -1);
g_free (name);
g_free (desc);
return FALSE;
}
static void
clear_tree_model (GtkTreeModel* model)
{
gtk_tree_model_foreach (model, clear_model_row, NULL);
gtk_list_store_clear (GTK_LIST_STORE (model));
}
static void
populate_tree_model (GtkTreeModel* model, GList* entries)
{
clear_tree_model (model);
for (GList* node = entries; node; node = g_list_next (node))
{
AB_Node_Pair *pair = (AB_Node_Pair*)(node->data);
GtkTreeIter iter;
gtk_list_store_insert_with_values (GTK_LIST_STORE (model),
&iter, -1,
0, pair->name,
1, pair->descr,
-1);
g_slice_free1 (sizeof(AB_Node_Pair), pair);
}
}
GncABSelectImExDlg*
gnc_ab_select_imex_dlg_new (GtkWidget* parent, AB_BANKING* abi)
{
GncABSelectImExDlg* imexd;
GtkBuilder* builder;
GList* imexporters;
GtkTreeSelection *imex_select = NULL, *prof_select = NULL;
g_return_val_if_fail (abi, NULL);
imexporters = gnc_ab_imexporter_list (abi);
g_return_val_if_fail (imexporters, NULL);
imexd = g_new0(GncABSelectImExDlg, 1);
imexd->parent = parent;
imexd->abi = abi;
g_signal_connect (parent, "destroy",
G_CALLBACK (gtk_widget_destroyed), &imexd->parent);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "imexporter-list");
gnc_builder_add_from_file (builder, "dialog-ab.glade", "profile-list");
gnc_builder_add_from_file (builder, "dialog-ab.glade",
"aqbanking-select-imexporter-dialog");
imexd->dialog =
GTK_WIDGET (gtk_builder_get_object (builder,
"aqbanking-select-imexporter-dialog"));
g_signal_connect (imexd->dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), &imexd->dialog);
imexd->imexporter_list =
GTK_LIST_STORE (gtk_builder_get_object (builder, "imexporter-list"));
imexd->profile_list =
GTK_LIST_STORE (gtk_builder_get_object (builder, "profile-list"));
imexd->select_imexporter =
GTK_WIDGET (gtk_builder_get_object (builder, "imexporter-sel"));
imexd->select_profile =
GTK_WIDGET (gtk_builder_get_object (builder, "profile-sel"));
imexd->ok_button =
GTK_WIDGET (gtk_builder_get_object (builder, "imex-okbutton"));
imex_select = GTK_TREE_SELECTION (gtk_builder_get_object (builder, "imex-selection"));
prof_select = GTK_TREE_SELECTION (gtk_builder_get_object (builder, "prof-selection"));
populate_tree_model (GTK_TREE_MODEL (imexd->imexporter_list),
imexporters);
g_signal_connect (imex_select, "changed", G_CALLBACK(imexporter_changed),
imexd);
g_signal_connect (prof_select, "changed", G_CALLBACK(profile_changed),
imexd);
g_list_free (imexporters);
g_object_unref (G_OBJECT (builder));
gtk_window_set_transient_for (GTK_WINDOW (imexd->dialog),
GTK_WINDOW (imexd->parent));
return imexd;
}
void
gnc_ab_select_imex_dlg_destroy (GncABSelectImExDlg* imexd)
{
if (imexd->imexporter_list)
clear_tree_model (GTK_TREE_MODEL (imexd->imexporter_list));
if (imexd->profile_list)
clear_tree_model (GTK_TREE_MODEL (imexd->profile_list));
if (imexd->dialog)
gtk_widget_destroy (imexd->dialog);
g_free (imexd);
}
gboolean
imexporter_changed(GtkTreeSelection* sel, gpointer data)
{
GncABSelectImExDlg* imexd = (GncABSelectImExDlg*)data;
GtkTreeIter iter;
GtkTreeModel* model;
gtk_widget_set_sensitive (imexd->ok_button, FALSE);
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
char* name = NULL;
GList* profiles = NULL;
gtk_tree_model_get (model, &iter, 0, &name, -1);
if (name && *name)
{
profiles = gnc_ab_imexporter_profile_list (imexd->abi, name);
g_free (name);
}
clear_tree_model (GTK_TREE_MODEL (imexd->profile_list));
if (profiles)
{
populate_tree_model (GTK_TREE_MODEL (imexd->profile_list), profiles);
}
else
{
gtk_widget_set_sensitive (imexd->ok_button, TRUE);
return FALSE;
}
if (!profiles->next)
{
GtkTreePath* path = gtk_tree_path_new_first();
GtkTreeSelection* profile_sel =
gtk_tree_view_get_selection (GTK_TREE_VIEW (imexd->select_profile));
gtk_tree_selection_select_path (profile_sel, path); //should call profile_changed
}
return FALSE;
}
return TRUE;
}
gboolean
profile_changed (GtkTreeSelection* sel, gpointer data)
{
GncABSelectImExDlg* imexd = (GncABSelectImExDlg*)data;
GtkTreeIter iter;
GtkTreeModel* model;
gtk_widget_set_sensitive (imexd->ok_button, FALSE);
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
gtk_widget_set_sensitive (imexd->ok_button, TRUE);
return FALSE;
}
return TRUE;
}
gboolean
gnc_ab_select_imex_dlg_run (GncABSelectImExDlg* imexd)
{
int response = gtk_dialog_run (GTK_DIALOG (imexd->dialog));
return response == GTK_RESPONSE_OK ? TRUE : FALSE;
}
static char*
tree_view_get_name (GtkTreeView *tv)
{
GtkTreeSelection* sel = gtk_tree_view_get_selection (tv);
GtkTreeIter iter;
GtkTreeModel* model;
if (sel && gtk_tree_selection_get_selected (sel, &model, &iter))
{
char* name;
gtk_tree_model_get(model, &iter, 0, &name, -1);
return name;
}
return NULL;
}
char*
gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg* imexd)
{
return tree_view_get_name (GTK_TREE_VIEW (imexd->select_imexporter));
}
char*
gnc_ab_select_imex_dlg_get_profile_name (GncABSelectImExDlg* imexd)
{
return tree_view_get_name (GTK_TREE_VIEW (imexd->select_profile));
}

View File

@ -0,0 +1,87 @@
/*
* dialog-ab-select-imexporter.h --
*
* 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
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
/**
* @addtogroup Import_Export
* @{
* @addtogroup AqBanking
* @{
* @file dialog-ab-select-imexporter.h
* @brief Dialog to select AQBanking importer/exporter and format profile.
* @author Copyright (C) 2022 John Ralls <jralls@ceridwen.us>
*/
#ifndef DIALOG_AB_SELECT_IMEXPORTER_H
#define DIALOG_AB_SELECT_IMEXPORTER_H
#include "gnc-ab-utils.h"
#include <gtk/gtk.h>
#include <aqbanking/banking.h>
typedef struct _GncABSelectImExDlg GncABSelectImExDlg;
G_BEGIN_DECLS
/**
* Create an AQBanking importer/exporter selection dialog.
* @param parent A widget to center the dialog over.
* @param abi The AQBanking instance to query.
* @return a GncABSelectImExDlg.
*/
GncABSelectImExDlg* gnc_ab_select_imex_dlg_new (GtkWidget* parent,
AB_BANKING* abi);
/**
* Destroy an AQBanking importer/exporter selection dialog.
* @param imexd the dialog.
*/
void gnc_ab_select_imex_dlg_destroy (GncABSelectImExDlg* imexd);
/**
* Run an AQBanking importer/exporter selection dialog.
* @param imexd the dialog.
* @return A GTK_RESPONSE status.
*/
int gnc_ab_select_imex_dlg_run (GncABSelectImExDlg* imexd);
/**
* Get the selected importer/exporter name
* @param imexd the dialog with the selection
* @return the selected importer/exporter name, free with g_free.
*/
char*
gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg* imexd);
/**
* Get the selected file format profile name
* @param imexd the dialog with the selection
* @return the selected format profile name, free with g_free.
*/
char*
gnc_ab_select_imex_dlg_get_profile_name (GncABSelectImExDlg* imexd);
G_END_DECLS
#endif //DIALOG_AB_SELECT_IMEXPORTER_H
/**
* @}
* @}
*/

View File

@ -1643,4 +1643,189 @@
<action-widget response="-8">exec_now_button</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="imexporter-list">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="profile-list">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="aqbanking-select-imexporter-dialog">
<property name="can-focus">False</property>
<property name="border-width">5</property>
<property name="title" translatable="yes">Select File Importer/Exporter</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="imex-cancelbutton">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="imex-okbutton">
<property name="label" translatable="yes">_OK</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">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">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="selector-box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="border-width">5</property>
<property name="orientation">horizontal</property>
<property name="spacing">18</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="min-content-height">300</property>
<child>
<object class="GtkTreeView" id="imexporter-sel">
<property name="model">imexporter-list</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="GtkTreeViewColumn" id="imexporter-name">
<property name="title" translatable="yes">Name</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="imexporter-descr">
<property name="title" translatable="yes">Description</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child internal-child="selection">
<object class="GtkTreeSelection" id="imex-selection">
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="min-content-height">300</property>
<child>
<object class="GtkTreeView" id="profile-sel">
<property name="model">profile-list</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<!-- Request the maximum width for the profile
list so that it doesn't change the dialog
width when an imexporter with long
descriptions is selected. -->
<property name="width-request">400</property>
<child>
<object class="GtkTreeViewColumn" id="profile-name">
<property name="title" translatable="yes">Name</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="profile-descr">
<property name="title" translatable="yes">Description</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child internal-child="selection">
<object class="GtkTreeSelection" id="prof-selection">
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">imex-cancelbutton</action-widget>
<action-widget response="-5">imex-okbutton</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -1212,3 +1212,55 @@ gnc_ab_trans_templ_list_new_from_ref_accounts (GNC_AB_ACCOUNT_SPEC *ab_acc)
return retval;
}
static int
ab_node_pair_compare (AB_Node_Pair* left, AB_Node_Pair* right)
{
return left ? (right ? g_strcmp0 (left->name, right->name) : -1) :
(right ? 1 : 0);
}
GList*
gnc_ab_imexporter_list (AB_BANKING* api)
{
GList* desc_list = NULL;
GWEN_PLUGIN_DESCRIPTION_LIST2 *il =
AB_Banking_GetImExporterDescrs (api);
GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *ilit;
g_return_val_if_fail (il, NULL);
ilit = GWEN_PluginDescription_List2_First(il);
for (GWEN_PLUGIN_DESCRIPTION *pd =
GWEN_PluginDescription_List2Iterator_Data(ilit);
pd;
pd = GWEN_PluginDescription_List2Iterator_Next(ilit))
{
AB_Node_Pair *node = NULL;
GWEN_BUFFER *tbuf = GWEN_Buffer_new(0, 256, 0, 1);
node = g_slice_new (AB_Node_Pair);
node->name = g_strdup(GWEN_PluginDescription_GetName(pd));
node->descr = g_strdup(GWEN_PluginDescription_GetShortDescr(pd));
desc_list = g_list_prepend (desc_list, node);
}
GWEN_PluginDescription_List2_free(il);
return g_list_sort (desc_list, (GCompareFunc)ab_node_pair_compare);
}
GList*
gnc_ab_imexporter_profile_list (AB_BANKING* api, const char* importer_name)
{
GList* prof_list = NULL;
GWEN_DB_NODE* db = AB_Banking_GetImExporterProfiles(api, importer_name);
g_return_val_if_fail (db, NULL);
for (GWEN_DB_NODE *profile = GWEN_DB_GetFirstGroup(db); profile;
profile = GWEN_DB_GetNextGroup(profile))
{
AB_Node_Pair *node = g_slice_new(AB_Node_Pair);
if (!profile) continue;
node->name = g_strdup(GWEN_DB_GetCharValue(profile, "name", 0, NULL));
node->descr = g_strdup(GWEN_DB_GetCharValue(profile, "shortDescr", 0, NULL));
prof_list = g_list_prepend (prof_list, node);
}
return g_list_sort (prof_list, (GCompareFunc)ab_node_pair_compare);
}

View File

@ -67,6 +67,12 @@ G_BEGIN_DECLS
#define GNC_PREF_USE_TRANSACTION_TXT "use-ns-transaction-text"
#define GNC_PREF_VERBOSE_DEBUG "verbose-debug"
typedef struct
{
char* name;
char* descr;
} AB_Node_Pair;
typedef struct _GncABImExContextImport GncABImExContextImport;
#define AWAIT_BALANCES 1 << 1
@ -285,6 +291,22 @@ gchar* gnc_ab_create_online_id (const gchar *bankcode, const gchar *accountnumbe
GList*
gnc_ab_trans_templ_list_new_from_ref_accounts (GNC_AB_ACCOUNT_SPEC *ab_acc);
/**
* Retrieve the available AQBanking importers.
* @param abi The AQBanking instance.
* @return a GList<AB_Node_Pair> containing importer names and descriptions.
*/
GList* gnc_ab_imexporter_list (AB_BANKING* abi);
/**
* Retrieve the available format templates for an AQBanking importer.
* @param api the AQBanking instance.
* @param importer_name The importer's name.
* @return a GList<AB_Node_Pair> containing format template names and descriptions.
*/
GList* gnc_ab_imexporter_profile_list (AB_BANKING* abi,
const char* importer_name);
G_END_DECLS
/** @} */

View File

@ -28,6 +28,7 @@
* @author Copyright (C) 2006 Florian Steinel
* @author Copyright (C) 2006 Christian Stimming
* @author Copyright (C) 2008 Andreas Koehler <andi5.py@gmx.net>
* @author Copyright (C) 2022 John Ralls <jralls@ceridwen.us>
*/
#include <config.h>
@ -44,10 +45,12 @@
#include "gnc-ab-utils.h"
# include <gwenhywfar/syncio_file.h>
# include <gwenhywfar/syncio_buffered.h>
#include <gwenhywfar/syncio_file.h>
#include <gwenhywfar/syncio_buffered.h>
#include <gwenhywfar/gui.h>
typedef GWEN_SYNCIO GWEN_IO_LAYER;
#include "dialog-ab-select-imexporter.h"
#include "dialog-ab-trans.h"
#include "dialog-utils.h"
#include "gnc-file.h"
@ -276,3 +279,48 @@ gnc_file_aqbanking_import(GtkWindow *parent,
AB_ImExporterContext_free(context);
gnc_AB_BANKING_fini(api);
}
void
gnc_file_aqbanking_import_dialog (GtkWindow *parent)
{
AB_BANKING* api = gnc_AB_BANKING_new ();
GncABSelectImExDlg* imexd =
gnc_ab_select_imex_dlg_new (GTK_WIDGET (parent), api);
char *imexporter, *profile;
AB_IMEXPORTER_CONTEXT* ctx = NULL;
if (!imexd)
{
PERR ("Failed to create select imex dialog.");
gnc_AB_BANKING_fini(api);
return;
}
if (!gnc_ab_select_imex_dlg_run (imexd))
{
gnc_ab_select_imex_dlg_destroy (imexd);
return;
}
imexporter = gnc_ab_select_imex_dlg_get_imexporter_name (imexd);
profile = gnc_ab_select_imex_dlg_get_profile_name (imexd);
if (imexporter && profile)
{
ctx = named_import_get_context (parent, api, imexporter, profile);
gnc_ab_select_imex_dlg_destroy (imexd);
if (ctx)
{
GncABImExContextImport* ieci = NULL;
ieci = gnc_ab_import_context (ctx, 0, FALSE, api, GTK_WIDGET(parent));
g_free(ieci);
AB_ImExporterContext_free(ctx);
}
g_free (imexporter);
g_free (profile);
}
gnc_AB_BANKING_fini(api);
}

View File

@ -28,6 +28,7 @@
* @brief DTAUS import module interface
* @author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
* @author Copyright (C) 2008 Andreas Koehler <andi5.py@gmx.net>
* @author Copyright (C) 2022 John Ralls <jralls@ceridwen.us>
*/
#ifndef GNC_FILE_AQB_IMPORT_H
@ -62,6 +63,14 @@ void gnc_file_aqbanking_import (GtkWindow *parent,
const gchar *aqbanking_formatname,
gboolean exec_as_aqbanking_jobs);
/**
* Import files via AQBanking's Import Dialog. This permits importing
* any file format that Aqbanking supports.
* @param parent A GtkWindow for setting the import dialog transient for.
*/
void gnc_file_aqbanking_import_dialog (GtkWindow *parent);
G_END_DECLS
/** @} */

View File

@ -7,10 +7,7 @@
<menuitem name="FileMt942Import" action="Mt942ImportAction"/>
<menuitem name="FileDtausImport" action="DtausImportAction"/>
<menuitem name="FileDtausImportsend" action="DtausImportSendAction"/>
<!-- When CsvImport works:
<menuitem name="FileCsvImport" action="CsvImportAction"/>
<menuitem name="FileCsvImportsend" action="CsvImportSendAction"/>
-->
<menuitem name="FileAQBImport" action="AQBankingImportAction"/>
</placeholder>
</menu>
</menu>

View File

@ -79,6 +79,7 @@ static void gnc_plugin_ab_cmd_mt940_import(GtkAction *action, GncMainWindowActio
static void gnc_plugin_ab_cmd_mt942_import(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_dtaus_import(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_dtaus_importsend(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_aqb_import(GtkAction *action, GncMainWindowActionData *data);
#define PLUGIN_ACTIONS_NAME "gnc-plugin-aqbanking-actions"
#define PLUGIN_UI_FILENAME "gnc-plugin-aqbanking-ui.xml"
@ -153,19 +154,16 @@ static GtkActionEntry gnc_plugin_actions [] =
N_("Import a traditional german DTAUS file into GnuCash."),
G_CALLBACK(gnc_plugin_ab_cmd_dtaus_import)
},
/* #ifdef CSV_IMPORT_FUNCTIONAL */
/* { "CsvImportAction", "go-previous", N_("Import _CSV"), NULL, */
/* N_("Import a CSV file into GnuCash"), */
/* G_CALLBACK(gnc_plugin_ab_cmd_csv_import) }, */
/* { "CsvImportSendAction", "go-previous", N_("Import CSV and s_end..."), NULL, */
/* N_("Import a CSV file into GnuCash and send the transfers online through Online Banking"), */
/* G_CALLBACK(gnc_plugin_ab_cmd_csv_importsend) }, */
/* #endif */
{
"DtausImportSendAction", "go-previous", N_("Import DTAUS and _send..."), NULL,
N_("Import a DTAUS file into GnuCash and transmit its orders by Online Banking."),
G_CALLBACK(gnc_plugin_ab_cmd_dtaus_importsend)
},
{
"AQBankingImportAction", "go-previous", N_("Import using AQBanking"),
NULL, N_("Import into GnuCash any file format supported by AQBanking."),
G_CALLBACK(gnc_plugin_ab_cmd_aqb_import)
},
};
static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
@ -705,6 +703,15 @@ gnc_plugin_ab_cmd_dtaus_importsend(GtkAction *action,
g_free(format);
}
static void
gnc_plugin_ab_cmd_aqb_import(GtkAction *action,
GncMainWindowActionData *data)
{
gnc_main_window = data->window;
gnc_file_aqbanking_import_dialog (GTK_WINDOW (gnc_main_window));
}
/************************************************************
* Plugin Bootstrapping *
************************************************************/

View File

@ -303,6 +303,7 @@ gnucash/import-export/aqb/assistant-ab-initial.glade
gnucash/import-export/aqb/dialog-ab-daterange.c
gnucash/import-export/aqb/dialog-ab.glade
gnucash/import-export/aqb/dialog-ab-pref.glade
gnucash/import-export/aqb/dialog-ab-select-imexporter.c
gnucash/import-export/aqb/dialog-ab-trans.c
gnucash/import-export/aqb/gnc-ab-getbalance.c
gnucash/import-export/aqb/gnc-ab-gettrans.c