diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index d756029324..728ea2d7f4 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -119,9 +119,6 @@ typedef struct GncPluginPageReportPrivate * the window is closed. */ SCM edited_reports; - /* This is set to mark the fact that we need to reload the html */ - gboolean need_reload; - /* The page is in the process of reloading the html */ gboolean reloading; @@ -132,6 +129,9 @@ typedef struct GncPluginPageReportPrivate // keep the view size gint view_width, view_height; + // This is set to mark that we need to reload the html + gboolean need_reload; + /// the container the above HTML widget is in. GtkContainer *container; } GncPluginPageReportPrivate; @@ -160,7 +160,7 @@ static int gnc_plugin_page_report_check_urltype(URLType t); static void gnc_plugin_page_report_load_cb(GncHtml * html, URLType type, const gchar * location, const gchar * label, gpointer data); -static void gnc_plugin_page_report_expose_event_cb(GtkWidget *unused, GdkEventExpose *unused1, gpointer data); +static gboolean gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); static void gnc_plugin_page_report_refresh (gpointer data); static void gnc_plugin_page_report_set_fwd_button(GncPluginPageReport * page, int enabled); static void gnc_plugin_page_report_set_back_button(GncPluginPageReport * page, int enabled); @@ -333,8 +333,7 @@ gnc_plugin_page_report_view_size (GtkWidget *widget, GtkAllocation *allocation, if ((allocation->width != priv->view_width)||(allocation->height != priv->view_height)) { - gnc_html_reload (priv->html, FALSE); //reload by view - + priv->need_reload = TRUE; priv->view_width = allocation->width; priv->view_height = allocation->height; } @@ -427,6 +426,7 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page ) priv->view_width = 0; // default priv->view_height = 0; // default + priv->need_reload = FALSE; gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html), gnc_plugin_page_report_history_destroy_cb, @@ -453,8 +453,8 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page ) /* load uri when view idle */ g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page); -// g_signal_connect(priv->container, "expose_event", -// G_CALLBACK(gnc_plugin_page_report_expose_event_cb), report); + g_signal_connect(priv->container, "expose-event", + G_CALLBACK(gnc_plugin_page_report_expose_event_cb), report); gtk_widget_show_all( GTK_WIDGET(priv->container) ); @@ -688,11 +688,6 @@ gnc_plugin_page_report_option_change_cb(gpointer data) /* it's probably already dirty, but make sure */ scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T); - /* Now queue the fact that we need to reload this report */ - priv->need_reload = TRUE; - // jsled: this doesn't seem to cause any effect. - gtk_widget_queue_draw( GTK_WIDGET(priv->container) ); - // jsled: this does. // this sets the window for the progressbar gnc_window_set_progressbar_window( GNC_WINDOW(page->window) ); @@ -737,27 +732,25 @@ gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node, } /* We got a draw event. See if we need to reload the report */ -static void -gnc_plugin_page_report_expose_event_cb(GtkWidget *unused, GdkEventExpose *unused1, gpointer data) +static gboolean +gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - GncPluginPageReport *page = data; + GncPluginPageReport *page = user_data; GncPluginPageReportPrivate *priv; - g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page)); + g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page), FALSE); priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page); ENTER( "report_draw" ); if (!priv->need_reload) { LEAVE( "no reload needed" ); - return; + return FALSE; } - priv->need_reload = FALSE; - gnc_window_set_progressbar_window( GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window) ); - gnc_html_reload (priv->html, FALSE); //reload by view - gnc_window_set_progressbar_window( NULL ); + gnc_html_reload(priv->html, FALSE); LEAVE( "reload forced" ); + return FALSE; } // @param data is actually GncPluginPageReportPrivate @@ -1386,14 +1379,9 @@ gnc_plugin_page_report_reload_cb( GtkAction *action, GncPluginPageReport *report dirty_report = scm_c_eval_string("gnc:report-set-dirty?!"); scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T); - priv->need_reload = TRUE; /* now queue the fact that we need to reload this report */ - - // this doens't seem to do anything... - gtk_widget_queue_draw( GTK_WIDGET(priv->container) ); - - // this does... priv->reloading = TRUE; + // this sets the window for the progressbar gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );