AUDIT: r15707 - gnucash/trunk/src/import-export/hbci - Implement some initial gnc_component_manager registering for the hbci dialogs. Partially fixes bug#409324.
Christian Stimming
cstim at cvs.gnucash.org
Sat Mar 10 17:16:11 EST 2007
Author: cstim
Date: 2007-03-10 17:16:11 -0500 (Sat, 10 Mar 2007)
New Revision: 15707
Trac: http://svn.gnucash.org/trac/changeset/15707
Modified:
gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
gnucash/trunk/src/import-export/hbci/hbci-interaction.c
Log:
Implement some initial gnc_component_manager registering for the hbci dialogs. Partially fixes bug#409324.
BP
Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c 2007-03-10 21:18:16 UTC (rev 15706)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c 2007-03-10 22:16:11 UTC (rev 15707)
@@ -48,12 +48,14 @@
#include "gnc-html.h"
//#include "import-account-matcher.h"
#include "gnc-component-manager.h"
+#include "gnc-session.h"
#include <aqbanking/banking.h>
#include <aqbanking/version.h>
#include <gwenhywfar/stringlist.h>
#include <gwenhywfar/version.h>
+#define DRUID_HBCI_IMPORT_CM_CLASS "druid-hbci-import"
/* #define DEFAULT_HBCI_VERSION 201 */
enum account_list_cols {
@@ -112,6 +114,8 @@
{
if (info == NULL) return;
+ gnc_unregister_gui_component_by_data(DRUID_HBCI_IMPORT_CM_CLASS, info);
+
reset_initial_info (info);
/* if (info->interactor)
@@ -279,8 +283,7 @@
static void
-on_cancel (GnomeDruid *gnomedruid,
- gpointer user_data)
+cm_close_handler(gpointer user_data)
{
HBCIInitialInfo *info = user_data;
@@ -291,6 +294,13 @@
}
static void
+on_cancel (GnomeDruid *gnomedruid,
+ gpointer user_data)
+{
+ cm_close_handler(user_data);
+}
+
+static void
on_finish (GnomeDruidPage *gnomedruidpage,
gpointer arg1,
gpointer user_data)
@@ -650,6 +660,7 @@
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
+ gint component_id;
info = g_new0 (HBCIInitialInfo, 1);
@@ -719,6 +730,10 @@
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_CALLBACK(gnc_hierarchy_destroy_cb), NULL);*/
Modified: gnucash/trunk/src/import-export/hbci/hbci-interaction.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/hbci-interaction.c 2007-03-10 21:18:16 UTC (rev 15706)
+++ gnucash/trunk/src/import-export/hbci/hbci-interaction.c 2007-03-10 22:16:11 UTC (rev 15707)
@@ -40,6 +40,8 @@
#include "gnc-ui-util.h"
#include "gnc-ui.h"
#include "gnc-gconf-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-session.h"
#include "dialog-pass.h"
#include "gnc-hbci-utils.h"
@@ -70,13 +72,16 @@
GWEN_INHERIT(AB_BANKING, GNCInteractor)
#define GCONF_SECTION_CONNECTION GCONF_SECTION "/connection_dialog"
+#define DIALOG_HBCILOG_CM_CLASS "dialog-hbcilog"
gchar *gnc__extractText(const char *text);
+static void cm_close_handler(gpointer user_data);
/** Adds the interactor and progressmonitor classes to the api. */
GNCInteractor *gnc_AB_BANKING_interactors (AB_BANKING *api, GtkWidget *parent)
{
GNCInteractor *data;
+ gint component_id;
data = g_new0 (GNCInteractor, 1);
data->parent = parent;
@@ -94,6 +99,11 @@
data->showbox_hash = g_hash_table_new(NULL, NULL);
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 */
gnc_hbci_add_callbacks(api, data);
return data;
@@ -113,6 +123,8 @@
gtk_widget_destroy (data->dialog);
}
+ gnc_unregister_gui_component_by_data(DIALOG_HBCILOG_CM_CLASS, data);
+
data->dialog = NULL;
g_hash_table_destroy(data->showbox_hash);
@@ -824,7 +836,38 @@
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
*/
More information about the gnucash-changes
mailing list