mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Implement some initial gnc_component_manager registering for the hbci dialogs. Partially fixes bug#409324.
BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15707 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e46aceda72
commit
8613e066de
@ -48,12 +48,14 @@
|
|||||||
#include "gnc-html.h"
|
#include "gnc-html.h"
|
||||||
//#include "import-account-matcher.h"
|
//#include "import-account-matcher.h"
|
||||||
#include "gnc-component-manager.h"
|
#include "gnc-component-manager.h"
|
||||||
|
#include "gnc-session.h"
|
||||||
|
|
||||||
#include <aqbanking/banking.h>
|
#include <aqbanking/banking.h>
|
||||||
#include <aqbanking/version.h>
|
#include <aqbanking/version.h>
|
||||||
#include <gwenhywfar/stringlist.h>
|
#include <gwenhywfar/stringlist.h>
|
||||||
#include <gwenhywfar/version.h>
|
#include <gwenhywfar/version.h>
|
||||||
|
|
||||||
|
#define DRUID_HBCI_IMPORT_CM_CLASS "druid-hbci-import"
|
||||||
/* #define DEFAULT_HBCI_VERSION 201 */
|
/* #define DEFAULT_HBCI_VERSION 201 */
|
||||||
|
|
||||||
enum account_list_cols {
|
enum account_list_cols {
|
||||||
@ -112,6 +114,8 @@ delete_initial_druid (HBCIInitialInfo *info)
|
|||||||
{
|
{
|
||||||
if (info == NULL) return;
|
if (info == NULL) return;
|
||||||
|
|
||||||
|
gnc_unregister_gui_component_by_data(DRUID_HBCI_IMPORT_CM_CLASS, info);
|
||||||
|
|
||||||
reset_initial_info (info);
|
reset_initial_info (info);
|
||||||
|
|
||||||
/* if (info->interactor)
|
/* if (info->interactor)
|
||||||
@ -279,8 +283,7 @@ static gboolean banking_has_accounts(AB_BANKING *banking)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_cancel (GnomeDruid *gnomedruid,
|
cm_close_handler(gpointer user_data)
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
HBCIInitialInfo *info = user_data;
|
HBCIInitialInfo *info = user_data;
|
||||||
|
|
||||||
@ -290,6 +293,13 @@ on_cancel (GnomeDruid *gnomedruid,
|
|||||||
delete_initial_druid(info);
|
delete_initial_druid(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_cancel (GnomeDruid *gnomedruid,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
cm_close_handler(user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_finish (GnomeDruidPage *gnomedruidpage,
|
on_finish (GnomeDruidPage *gnomedruidpage,
|
||||||
gpointer arg1,
|
gpointer arg1,
|
||||||
@ -650,6 +660,7 @@ void gnc_hbci_initial_druid (void)
|
|||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
gint component_id;
|
||||||
|
|
||||||
info = g_new0 (HBCIInitialInfo, 1);
|
info = g_new0 (HBCIInitialInfo, 1);
|
||||||
|
|
||||||
@ -719,6 +730,10 @@ void gnc_hbci_initial_druid (void)
|
|||||||
G_CALLBACK (on_accountlist_prepare), info);
|
G_CALLBACK (on_accountlist_prepare), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component_id = gnc_register_gui_component(DRUID_HBCI_IMPORT_CM_CLASS,
|
||||||
|
NULL, cm_close_handler,
|
||||||
|
info);
|
||||||
|
gnc_gui_component_set_session(component_id, gnc_get_current_session());
|
||||||
|
|
||||||
/*g_signal_connect (dialog, "destroy",*/
|
/*g_signal_connect (dialog, "destroy",*/
|
||||||
/* G_CALLBACK(gnc_hierarchy_destroy_cb), NULL);*/
|
/* G_CALLBACK(gnc_hierarchy_destroy_cb), NULL);*/
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include "gnc-ui-util.h"
|
#include "gnc-ui-util.h"
|
||||||
#include "gnc-ui.h"
|
#include "gnc-ui.h"
|
||||||
#include "gnc-gconf-utils.h"
|
#include "gnc-gconf-utils.h"
|
||||||
|
#include "gnc-component-manager.h"
|
||||||
|
#include "gnc-session.h"
|
||||||
|
|
||||||
#include "dialog-pass.h"
|
#include "dialog-pass.h"
|
||||||
#include "gnc-hbci-utils.h"
|
#include "gnc-hbci-utils.h"
|
||||||
@ -70,13 +72,16 @@
|
|||||||
GWEN_INHERIT(AB_BANKING, GNCInteractor)
|
GWEN_INHERIT(AB_BANKING, GNCInteractor)
|
||||||
|
|
||||||
#define GCONF_SECTION_CONNECTION GCONF_SECTION "/connection_dialog"
|
#define GCONF_SECTION_CONNECTION GCONF_SECTION "/connection_dialog"
|
||||||
|
#define DIALOG_HBCILOG_CM_CLASS "dialog-hbcilog"
|
||||||
|
|
||||||
gchar *gnc__extractText(const char *text);
|
gchar *gnc__extractText(const char *text);
|
||||||
|
static void cm_close_handler(gpointer user_data);
|
||||||
|
|
||||||
/** Adds the interactor and progressmonitor classes to the api. */
|
/** Adds the interactor and progressmonitor classes to the api. */
|
||||||
GNCInteractor *gnc_AB_BANKING_interactors (AB_BANKING *api, GtkWidget *parent)
|
GNCInteractor *gnc_AB_BANKING_interactors (AB_BANKING *api, GtkWidget *parent)
|
||||||
{
|
{
|
||||||
GNCInteractor *data;
|
GNCInteractor *data;
|
||||||
|
gint component_id;
|
||||||
|
|
||||||
data = g_new0 (GNCInteractor, 1);
|
data = g_new0 (GNCInteractor, 1);
|
||||||
data->parent = parent;
|
data->parent = parent;
|
||||||
@ -94,6 +99,11 @@ GNCInteractor *gnc_AB_BANKING_interactors (AB_BANKING *api, GtkWidget *parent)
|
|||||||
data->showbox_hash = g_hash_table_new(NULL, NULL);
|
data->showbox_hash = g_hash_table_new(NULL, NULL);
|
||||||
data->min_loglevel = AB_Banking_LogLevelVerbous;
|
data->min_loglevel = AB_Banking_LogLevelVerbous;
|
||||||
|
|
||||||
|
component_id = gnc_register_gui_component(DIALOG_HBCILOG_CM_CLASS,
|
||||||
|
NULL, cm_close_handler,
|
||||||
|
data);
|
||||||
|
gnc_gui_component_set_session(component_id, gnc_get_current_session());
|
||||||
|
|
||||||
/* set HBCI_Interactor */
|
/* set HBCI_Interactor */
|
||||||
gnc_hbci_add_callbacks(api, data);
|
gnc_hbci_add_callbacks(api, data);
|
||||||
return data;
|
return data;
|
||||||
@ -113,6 +123,8 @@ void GNCInteractor_delete(GNCInteractor *data)
|
|||||||
gtk_widget_destroy (data->dialog);
|
gtk_widget_destroy (data->dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnc_unregister_gui_component_by_data(DIALOG_HBCILOG_CM_CLASS, data);
|
||||||
|
|
||||||
data->dialog = NULL;
|
data->dialog = NULL;
|
||||||
|
|
||||||
g_hash_table_destroy(data->showbox_hash);
|
g_hash_table_destroy(data->showbox_hash);
|
||||||
@ -824,6 +836,37 @@ on_button_clicked (GtkButton *button,
|
|||||||
while (g_main_context_iteration(context, FALSE));
|
while (g_main_context_iteration(context, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cm_close_handler(gpointer user_data)
|
||||||
|
{
|
||||||
|
GNCInteractor *data = user_data;
|
||||||
|
|
||||||
|
GNCInteractor_setAborted(data);
|
||||||
|
/* Notes about correctly handling this ComponentManager close event:
|
||||||
|
We can't actually close the dialog here because AqBanking might
|
||||||
|
still be running and expecting the GNCInteractor object to exist
|
||||||
|
(and it doesn't offer any handlers for aborting from here). This
|
||||||
|
is not per se a problem with gnucash objects because as soon as
|
||||||
|
AqBanking received the SetAborted signal, it will abort and not
|
||||||
|
deliver any actual results, which means the gnc-hbci module will
|
||||||
|
not continue any operation.
|
||||||
|
|
||||||
|
However, the dialog and the AB_BANKING object will still be
|
||||||
|
around. It is unclear whether this is 1. correct or 2. wrong:
|
||||||
|
1. It might be correct because a user might still want to see the
|
||||||
|
log messages in the window until he manually closes the
|
||||||
|
GNCInteractor. 2. It might be wrong because once we've received
|
||||||
|
the close event, nobody wants to see the GNCInteractor log
|
||||||
|
messages anyway. To implement the behaviour #2, we should add a
|
||||||
|
new flag in GNCInteractor that is being queried in
|
||||||
|
gnc_AB_BANKING_execute() right after AB_Banking_ExecuteQueue()
|
||||||
|
has finished, and if it is activated from the cm_close_handler,
|
||||||
|
gnc_AB_BANKING_execute should immediately delete the AB_BANKING
|
||||||
|
object (which will also delete the GNCInteractor object) and
|
||||||
|
abort.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Constructor
|
* Constructor
|
||||||
|
Loading…
Reference in New Issue
Block a user