gnucash maint: Bug 777875 - Reports with charts are flickering in certain circumstances

git repository hosting gjanssens at code.gnucash.org
Wed Feb 1 13:18:31 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/02adf447 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5a144699 (commit)



commit 02adf447fd245486927f1fa6e8ec9c502d8b0c69
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 19:18:00 2017 +0100

    Bug 777875 - Reports with charts are flickering in certain circumstances
    
    This flickering was triggered by interference between scrollbar
    visibility changes and report reloading. Both should not happen
    at the same time.

diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c
index 56bfd3b..546ccb0 100644
--- a/src/html/gnc-html-webkit.c
+++ b/src/html/gnc-html-webkit.c
@@ -973,17 +973,16 @@ impl_webkit_show_url( GncHtml* self, URLType type,
 static void
 impl_webkit_reload( GncHtml* self, gboolean force_rebuild )
 {
-    gnc_html_history_node * n;
     GncHtmlWebkitPrivate* priv;
 
     g_return_if_fail( self != NULL );
     g_return_if_fail( GNC_IS_HTML_WEBKIT(self) );
 
     priv = GNC_HTML_WEBKIT_GET_PRIVATE(self);
-    n = gnc_html_history_get_current( priv->base.history );
 
     if ( force_rebuild )
     {
+        gnc_html_history_node *n = gnc_html_history_get_current( priv->base.history );
         if ( n != NULL )
             gnc_html_show_url( self, n->type, n->location, n->label, 0 );
     }
diff --git a/src/html/gnc-html.c b/src/html/gnc-html.c
index 13a2c98..730461e 100644
--- a/src/html/gnc-html.c
+++ b/src/html/gnc-html.c
@@ -95,17 +95,9 @@ gnc_html_class_init( GncHtmlClass* klass )
 }
 
 static void
-gnc_html_scroll_vis_cb( GtkWidget *widget, gpointer user_data )
-{
-    GncHtml* self = user_data;
-    gnc_html_reload( self, FALSE ); //reload by view
-}
-
-static void
 gnc_html_init( GncHtml* self )
 {
     GncHtmlPrivate* priv;
-    GtkWidget *vscroll, *hscroll;
     priv = self->priv = g_new0( GncHtmlPrivate, 1 );
 
     priv->container = gtk_scrolled_window_new( NULL, NULL );
@@ -113,12 +105,6 @@ gnc_html_init( GncHtml* self )
                                     GTK_POLICY_AUTOMATIC,
                                     GTK_POLICY_AUTOMATIC );
 
-    vscroll = GTK_WIDGET(gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(priv->container)));
-    hscroll = GTK_WIDGET(gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(priv->container)));
-
-    g_signal_connect(GTK_WIDGET(vscroll), "show", G_CALLBACK(gnc_html_scroll_vis_cb), self);
-    g_signal_connect(GTK_WIDGET(hscroll), "show", G_CALLBACK(gnc_html_scroll_vis_cb), self);
-
     priv->request_info = g_hash_table_new( g_str_hash, g_str_equal );
     priv->history = gnc_html_history_new();
 }
diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index 728ea2d..993248f 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -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 gboolean gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
+static void gnc_plugin_page_report_selected_cb(GObject *object, 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);
@@ -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 (G_OBJECT (page), "selected",
+                      G_CALLBACK (gnc_plugin_page_report_selected_cb), report);
 
     gtk_widget_show_all( GTK_WIDGET(priv->container) );
 
@@ -731,26 +731,27 @@ gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node,
 #endif
 }
 
-/* We got a draw event.  See if we need to reload the report */
-static gboolean
-gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+/* This page got selected by the user.  See if we need to reload the report.
+ * This may  be needed in case the window got resized while this page was not selected.*/
+static void
+gnc_plugin_page_report_selected_cb (GObject *object, gpointer user_data)
 {
-    GncPluginPageReport *page = user_data;
+    GncPluginPageReport *page = GNC_PLUGIN_PAGE_REPORT(user_data);
     GncPluginPageReportPrivate *priv;
 
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page), FALSE);
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page));
 
     priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page);
     ENTER( "report_draw" );
     if (!priv->need_reload)
     {
         LEAVE( "no reload needed" );
-        return FALSE;
+        return;
     }
     priv->need_reload = FALSE;
     gnc_html_reload(priv->html, FALSE);
     LEAVE( "reload forced" );
-    return FALSE;
+    return;
 }
 
 // @param data is actually GncPluginPageReportPrivate



Summary of changes:
 src/html/gnc-html-webkit.c                       |  3 +--
 src/html/gnc-html.c                              | 14 --------------
 src/report/report-gnome/gnc-plugin-page-report.c | 21 +++++++++++----------
 3 files changed, 12 insertions(+), 26 deletions(-)



More information about the gnucash-changes mailing list