Bug 343647 - Keep scrolled report location

If you have a large report and have scrolled down to the bottom and
decide to tab to a different page and come back the report is back at
the top. This was due to reloading the report before focusing so change
this so it only loads once, if the report needs refreshing then there
is the reload toolbar button.
This commit is contained in:
Robert Fewell 2020-11-28 14:10:29 +00:00
parent 72d742e29b
commit 161ab691d6

View File

@ -124,6 +124,7 @@ typedef struct GncPluginPageReportPrivate
/* The page is in the process of reloading the html */ /* The page is in the process of reloading the html */
gboolean reloading; gboolean reloading;
gboolean loaded;
/// the gnc_html abstraction this PluginPage contains /// the gnc_html abstraction this PluginPage contains
// gnc_html *html; // gnc_html *html;
@ -255,7 +256,8 @@ gnc_plugin_page_report_focus_widget (GncPluginPage *report_plugin_page)
{ {
GtkWidget *widget = gnc_html_get_webview (priv->html); GtkWidget *widget = gnc_html_get_webview (priv->html);
gnc_plugin_page_report_load_uri (report_plugin_page); if (!priv->loaded) // so we only do the load once
gnc_plugin_page_report_load_uri (report_plugin_page);
if (GTK_IS_WIDGET(widget)) if (GTK_IS_WIDGET(widget))
{ {
@ -384,6 +386,8 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
gnc_html_show_url(priv->html, type, url_location, url_label, 0); gnc_html_show_url(priv->html, type, url_location, url_label, 0);
g_free(url_location); g_free(url_location);
priv->loaded = TRUE;
gnc_plugin_page_report_set_progressbar( page, FALSE ); gnc_plugin_page_report_set_progressbar( page, FALSE );
// this resets the window for the progressbar to NULL // this resets the window for the progressbar to NULL
@ -460,6 +464,7 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page )
// priv->html = gnc_html_new( topLvl ); // priv->html = gnc_html_new( topLvl );
priv->html = gnc_html_factory_create_html(); priv->html = gnc_html_factory_create_html();
gnc_html_set_parent( priv->html, topLvl ); gnc_html_set_parent( priv->html, topLvl );
priv->loaded = FALSE;
gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html), gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html),
gnc_plugin_page_report_history_destroy_cb, gnc_plugin_page_report_history_destroy_cb,