r16104 - gnucash/trunk/src/report/report-gnome - Improve gui component handling of report plugin pages.
Andreas Köhler
andi5 at cvs.gnucash.org
Sat May 19 19:19:58 EDT 2007
Author: andi5
Date: 2007-05-19 19:19:56 -0400 (Sat, 19 May 2007)
New Revision: 16104
Trac: http://svn.gnucash.org/trac/changeset/16104
Modified:
gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Improve gui component handling of report plugin pages.
Let them be closed on session shutdown by setting the session. Call
gnc_main_window_close_page in close handler. Unregister the component
in _destroy_widget and move _destroy into it.
Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2007-05-19 23:19:51 UTC (rev 16103)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2007-05-19 23:19:56 UTC (rev 16104)
@@ -57,6 +57,7 @@
#include "gnc-plugin.h"
#include "gnc-plugin-page-report.h"
#include "gnc-report.h"
+#include "gnc-session.h"
#include "gnc-ui-util.h"
#include "gnc-ui.h"
#include "gnc-window.h"
@@ -85,6 +86,7 @@
{
/// The report-id
int reportId;
+ gint component_manager_id;
/// The report which this Page is satisifying
SCM cur_report;
@@ -334,8 +336,11 @@
gtk_container_add(GTK_CONTAINER(priv->container),
gnc_html_get_widget(priv->html));
- gnc_register_gui_component( WINDOW_REPORT_CM_CLASS, NULL,
- close_handler, priv );
+ priv->component_manager_id =
+ gnc_register_gui_component(WINDOW_REPORT_CM_CLASS, NULL,
+ close_handler, page);
+ gnc_gui_component_set_session(priv->component_manager_id,
+ gnc_get_current_session());
gnc_html_set_urltype_cb(priv->html, gnc_plugin_page_report_check_urltype);
gnc_html_set_load_cb(priv->html, gnc_plugin_page_report_load_cb, report);
@@ -643,6 +648,13 @@
PINFO("destroy widget");
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
+
+ if (priv->component_manager_id) {
+ gnc_unregister_gui_component(priv->component_manager_id);
+ priv->component_manager_id = 0;
+ }
+
+ gnc_plugin_page_report_destroy(priv);
gnc_report_remove_by_id(priv->reportId);
}
@@ -902,8 +914,6 @@
SCM set_editor = scm_c_eval_string("gnc:report-set-editor-widget!");
SCM edited, editor;
- gnc_unregister_gui_component_by_data (WINDOW_REPORT_CM_CLASS, priv);
-
/* close any open editors */
for (edited = scm_list_copy(priv->edited_reports); !SCM_NULLP(edited);
edited = SCM_CDR(edited)) {
@@ -1125,9 +1135,9 @@
static void
close_handler (gpointer user_data)
{
- GncPluginPageReportPrivate *priv = user_data;
+ GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
DEBUG("in close handler\n");
- gnc_plugin_page_report_destroy (priv);
+ gnc_main_window_close_page (plugin_page);
}
static void
More information about the gnucash-changes
mailing list