r15769 - gnucash/branches/2.0 - Implement some initial gnc_component_manager registering for the hbci dialogs. Partially fixes bug#409324.
Derek Atkins
warlord at cvs.gnucash.org
Fri Mar 30 17:57:08 EDT 2007
Author: warlord
Date: 2007-03-30 17:57:07 -0400 (Fri, 30 Mar 2007)
New Revision: 15769
Trac: http://svn.gnucash.org/trac/changeset/15769
Modified:
gnucash/branches/2.0/
gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c
gnucash/branches/2.0/src/import-export/hbci/hbci-interaction.c
Log:
Implement some initial gnc_component_manager registering for the hbci dialogs. Partially fixes bug#409324.
Merge from r15707.
Note that part of this changeset required manual merging so please verify.
Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14353
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14354
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
Modified: gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c 2007-03-30 21:56:51 UTC (rev 15768)
+++ gnucash/branches/2.0/src/import-export/hbci/druid-hbci-initial.c 2007-03-30 21:57:07 UTC (rev 15769)
@@ -44,12 +44,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 */
struct _hbciinitialinfo
@@ -118,6 +120,8 @@
{
if (info == NULL) return;
+ gnc_unregister_gui_component_by_data(DRUID_HBCI_IMPORT_CM_CLASS, info);
+
reset_initial_info (info);
/* if (info->interactor)
@@ -290,8 +294,7 @@
static void
-on_cancel (GnomeDruid *gnomedruid,
- gpointer user_data)
+cm_close_handler(gpointer user_data)
{
HBCIInitialInfo *info = user_data;
@@ -302,6 +305,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)
@@ -645,6 +655,7 @@
HBCIInitialInfo *info;
GladeXML *xml;
GtkWidget *page;
+ gint component_id;
info = g_new0 (HBCIInitialInfo, 1);
@@ -683,6 +694,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/branches/2.0/src/import-export/hbci/hbci-interaction.c
===================================================================
--- gnucash/branches/2.0/src/import-export/hbci/hbci-interaction.c 2007-03-30 21:56:51 UTC (rev 15768)
+++ gnucash/branches/2.0/src/import-export/hbci/hbci-interaction.c 2007-03-30 21:57:07 UTC (rev 15769)
@@ -40,18 +40,25 @@
#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"
+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;
@@ -69,6 +76,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;
@@ -88,6 +100,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);
@@ -788,8 +802,38 @@
while (g_main_context_iteration(context, FALSE));
}
-GWEN_INHERIT(AB_BANKING, GNCInteractor)
+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