gnucash master: Multiple changes pushed

git repository hosting gjanssens at code.gnucash.org
Wed Feb 1 15:46:21 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/d503f343 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/996b6047 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d9d5f074 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/334fafc4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6a5a850b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/eac79875 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/02adf447 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5a144699 (commit)
	from  https://github.com/Gnucash/gnucash/commit/420f40ed (commit)



commit d503f3438eaf57c1db587b15dd072308fa919ec6
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 21:46:01 2017 +0100

    Drop callback that reloads report when a report tab is selected
    
    This has the unwanted side-effect of misaligning the chart
    legends (due to some internal bug in webkit). Resizing the window
    properly redraws the chart afterwards, but leaving the page and
    returning reloads the page again, hitting the bug again. This
    prevents multiple report tabs open at once to show a correct chart.
    Each resize of the window to correct one chart will trigger a
    misaligned legend on all other charts the next time you look at them.
    
    The disadvantage of removing this code is that reports loaded
    automatically when gnucash opens are not sized properly. (All but
    the one in the very last tab of the book being opened, that is).
    However these pages can be corrected by manually reloading them
    once. That's annoying but at least allows for correctly displayed reports.
    
    A proper solution must be found for this of course.

diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index 3ea2baa..51cf815 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -120,9 +120,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;
 
@@ -158,7 +155,6 @@ 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_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);
@@ -426,9 +422,6 @@ 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 (G_OBJECT (page), "selected",
-                      G_CALLBACK (gnc_plugin_page_report_selected_cb), report);
-
     gtk_widget_show_all( GTK_WIDGET(priv->container) );
 
     LEAVE("container %p", priv->container);
@@ -661,23 +654,24 @@ 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.
+    // prevent closing this page while loading...
+    priv->reloading = TRUE;
+
     // this sets the window for the progressbar
     gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
 
     // this sets the minimum size of the progressbar to that allocated
     gnc_plugin_page_report_set_progressbar( page, TRUE );
 
+    /* Now queue the fact that we need to reload this report */
     gnc_html_reload( priv->html, TRUE ); //reload by rebuild
 
     gnc_plugin_page_report_set_progressbar( page, FALSE );
 
     // this resets the window for the progressbar to NULL
     gnc_window_set_progressbar_window( NULL );
+
+    priv->reloading = FALSE;
 }
 
 /* FIXME: This function does... nothing.  */
@@ -709,32 +703,6 @@ gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node,
 #endif
 }
 
-/* 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 = GNC_PLUGIN_PAGE_REPORT(user_data);
-    GncPluginPageReportPrivate *priv;
-
-    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;
-    }
-
-    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 );
-    LEAVE( "reload forced" );
-    return;
-}
-
 // @param data is actually GncPluginPageReportPrivate
 static void
 gnc_plugin_page_report_refresh(gpointer data)
@@ -1368,13 +1336,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...
+    // prevent closing this page while loading...
     priv->reloading = TRUE;
     // this sets the window for the progressbar
     gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );

commit 996b6047fcefc84a850b72edb7372920835018d8
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 21:29:36 2017 +0100

    Revert "Add call back to track page size changes"
    
    This reverts commit 12994ca6e77cba58cf9de5a2f6b2b3f4323e77b3.
    
    Webkit takes care of this properly for newly opened reports. It
    somehow fails for reports that are automatically loaded when
    reopening gnucash. This needs additional investigation, but
    reloading the report when exposing the page has undesired
    side-effects which should be avoided.

diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index 0fe38c6..3ea2baa 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -130,9 +130,6 @@ typedef struct GncPluginPageReportPrivate
 //        gnc_html *html;
     GncHtml *html;
 
-    // keep the view size
-    gint view_width, view_height;
-
     /// the container the above HTML widget is in.
     GtkContainer *container;
 } GncPluginPageReportPrivate;
@@ -328,20 +325,6 @@ gnc_plugin_page_report_finalize (GObject *object)
 }
 
 static void
-gnc_plugin_page_report_view_size (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
-{
-    GncPluginPageReportPrivate *priv = user_data;
-
-    if ((allocation->width != priv->view_width)||(allocation->height != priv->view_height))
-    {
-        gnc_html_reload (priv->html, FALSE); //reload by view
-
-        priv->view_width = allocation->width;
-        priv->view_height = allocation->height;
-    }
-}
-
-static void
 gnc_plugin_page_report_set_progressbar (GncPluginPage *page, gboolean set)
 {
     GtkWidget *progressbar;
@@ -372,14 +355,6 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
     report = GNC_PLUGIN_PAGE_REPORT(page);
     priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
 
-    gtk_widget_get_allocation (GTK_WIDGET(gnc_html_get_widget(priv->html)), &allocation); 
-
-    priv->view_width = allocation.width;
-    priv->view_height = allocation.height;
-
-    g_signal_connect(GTK_WIDGET(gnc_html_get_widget(priv->html)), "size-allocate",
-                     G_CALLBACK(gnc_plugin_page_report_view_size), priv);
-
     id_name = g_strdup_printf("id=%d", priv->reportId );
     child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
     type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
@@ -426,9 +401,6 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page )
     priv->html = gnc_html_factory_create_html();
     gnc_html_set_parent( priv->html, topLvl );
 
-    priv->view_width = 0; // default
-    priv->view_height = 0; // default
-
     gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html),
                                          gnc_plugin_page_report_history_destroy_cb,
                                          (gpointer)priv);

commit d9d5f0745133046b6ab1b3ad37ba6a351fec97fe
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 21:21:45 2017 +0100

    Revert "Change report resizing when not in view"
    
    This reverts commit 74091fbcfab4e5d731bb6283c07c38ccc58326e1.
    
    Webkit takes care of this properly for newly opened reports. It
    somehow fails for reports that are automatically loaded when
    reopening gnucash. This needs additional investigation, but
    reloading the report when exposing the page has undesired
    side-effects which should be avoided.

diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index d09c74e..0fe38c6 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -120,6 +120,9 @@ 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;
 
@@ -130,9 +133,6 @@ 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;
@@ -334,7 +334,8 @@ gnc_plugin_page_report_view_size (GtkWidget *widget, GtkAllocation *allocation,
 
     if ((allocation->width != priv->view_width)||(allocation->height != priv->view_height))
     {
-        priv->need_reload = TRUE;
+        gnc_html_reload (priv->html, FALSE); //reload by view
+
         priv->view_width = allocation->width;
         priv->view_height = allocation->height;
     }
@@ -427,7 +428,6 @@ 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,
@@ -689,6 +689,11 @@ 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) );
 
@@ -749,8 +754,11 @@ gnc_plugin_page_report_selected_cb (GObject *object, gpointer user_data)
         LEAVE( "no reload needed" );
         return;
     }
+
     priv->need_reload = FALSE;
-    gnc_html_reload(priv->html, 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 );
     LEAVE( "reload forced" );
     return;
 }
@@ -1388,9 +1396,14 @@ 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 */
-    priv->reloading = TRUE;
 
+    // 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) );
 

commit 334fafc48d390b8741c4bdecd985c8aa6da43110
Merge: 6a5a850 02adf44
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 20:06:55 2017 +0100

    Merge branch 'maint'


commit 6a5a850b73c30a47ca4249eda60924e8fb62ca69
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 20:05:18 2017 +0100

    Log javascript console messages to the trace file

diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c
index aa2c3ea..785d90b 100644
--- a/src/html/gnc-html-webkit.c
+++ b/src/html/gnc-html-webkit.c
@@ -118,6 +118,17 @@ static void impl_webkit_cancel( GncHtml* self );
 static void impl_webkit_set_parent( GncHtml* self, GtkWindow* parent );
 static void impl_webkit_default_zoom_changed(gpointer prefs, gchar *pref, gpointer user_data);
 
+static gboolean
+webkit_console_msg_cb (GtkWidget*   web_view,
+                                    const gchar* message,
+                                    guint        line,
+                                    const gchar* source_id,
+                                    GncHtmlWebkit*  view)
+{
+    PWARN ("JS: %s (%u): %s", source_id, line, message);
+    return TRUE;
+}
+
 static void
 gnc_html_webkit_init( GncHtmlWebkit* self )
 {
@@ -173,6 +184,10 @@ gnc_html_webkit_init( GncHtmlWebkit* self )
                       G_CALLBACK(webkit_on_url_cb),
                       self );
 
+    g_signal_connect( priv->web_view, "console-message",
+            G_CALLBACK(webkit_console_msg_cb),
+            self);
+
 #if 0
     g_signal_connect( priv->html, "set_base",
                       G_CALLBACK(gnc_html_set_base_cb),

commit eac79875649c9d56768837a78ed8ec089e0d6a8a
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Feb 1 20:04:11 2017 +0100

    Always use actual window size when calculating x-axis ticks for charts
    
    Previously the window size was only captured once and reused all the time.

diff --git a/src/report/report-system/html-barchart.scm b/src/report/report-system/html-barchart.scm
index 9284c31..79fafa2 100644
--- a/src/report/report-system/html-barchart.scm
+++ b/src/report/report-system/html-barchart.scm
@@ -511,15 +511,14 @@
             (push "$.jqplot.config.enablePlugins = true;\n")
             (push "$(document).ready(function() {
 var plot = $.jqplot('")(push chart-id)(push"', data, options);
-var int_chart_width = document.getElementById(\"")(push chart-id)(push"\").getElementsByClassName(\"jqplot-zoom-canvas\")[0].width;
-plot.axes.xaxis.ticks = getVisualTicks(int_chart_width);
+plot.axes.xaxis.ticks = getVisualTicks();
 plot.replot();
 var timer;
 $(window).resize(function () {
     clearTimeout(timer);
     timer = setTimeout(function () {
         plot.replot({resetAxes: true });
-        plot.axes.xaxis.ticks = getVisualTicks(int_chart_width);
+        plot.axes.xaxis.ticks = getVisualTicks();
         plot.replot();
     }, 100);
     });
@@ -534,7 +533,8 @@ function formatTooltip(str, seriesIndex, pointIndex) {
     return options.series[seriesIndex].label + '<br/>' + x + '<br/><b>' + y + '</b>';
 }
 
-function getVisualTicks(chart_width) {
+function getVisualTicks() {
+    var chart_width = document.getElementById(\"")(push chart-id)(push"\").getElementsByClassName(\"jqplot-zoom-canvas\")[0].width;
     var num_ticks = all_ticks.length;
     var label_width = 25;
     var num_labels = chart_width / label_width;

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

commit 5a144699b96685345ee36301482083dff305a09e
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Jan 30 22:12:25 2017 +0100

    Extend account color to all columns in the account hierarchy page

diff --git a/src/gnome-utils/gnc-tree-view-account.c b/src/gnome-utils/gnc-tree-view-account.c
index b8acd2a..495c0bd 100644
--- a/src/gnome-utils/gnc-tree-view-account.c
+++ b/src/gnome-utils/gnc-tree-view-account.c
@@ -678,6 +678,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
     GncTreeViewAccountPrivate *priv;
     GtkTreeViewColumn *tax_info_column, *acc_color_column;
     GtkCellRenderer *renderer;
+    GList *col_list = NULL, *node = NULL;
 
     ENTER(" ");
     /* Create our view */
@@ -721,14 +722,6 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
                                         GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                         sort_by_string);
 
-    renderer = gnc_tree_view_column_get_renderer(priv->name_column);
-
-    gtk_tree_view_column_set_cell_data_func(priv->name_column,
-                                            renderer,
-                                            acc_color_data_func,
-                                            GTK_TREE_VIEW(view),
-                                            NULL);
-
     gnc_tree_view_add_text_column(view, _("Type"), "type", NULL, sample_type,
                                   GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
                                   GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
@@ -870,17 +863,10 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
                                         GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                         NULL);
 
-    renderer = gnc_tree_view_column_get_renderer(acc_color_column);
-
     /* Add the full title to the object for menu creation */
     g_object_set_data_full(G_OBJECT(acc_color_column), REAL_TITLE,
                            g_strdup(_("Account Color")), g_free);
 
-    gtk_tree_view_column_set_cell_data_func(acc_color_column,
-                                            renderer,
-                                            acc_color_data_func,
-                                            GTK_TREE_VIEW(view),
-                                            NULL);
     priv->notes_column
         = gnc_tree_view_add_text_column(view, _("Notes"), "notes", NULL,
                                         "Sample account notes.",
@@ -911,6 +897,19 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
                                     sort_by_placeholder,
                                     gnc_tree_view_account_placeholder_toggled);
 
+    /* Add function to each column that optionally sets a background color for accounts */
+    col_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
+    for (node = col_list; node; node = node->next)
+    {
+        renderer = gnc_tree_view_column_get_renderer(node->data);
+        gtk_tree_view_column_set_cell_data_func(node->data,
+                renderer,
+                acc_color_data_func,
+                GTK_TREE_VIEW(view),
+                NULL);
+    }
+    g_list_free (col_list);
+
     /* Update column titles to use the currency name. */
     gtva_update_column_names(view);
 



Summary of changes:
 src/gnome-utils/gnc-tree-view-account.c          | 29 +++++------
 src/html/gnc-html-webkit.c                       | 18 ++++++-
 src/html/gnc-html.c                              | 14 -----
 src/report/report-gnome/gnc-plugin-page-report.c | 66 +++---------------------
 src/report/report-system/html-barchart.scm       |  8 +--
 5 files changed, 42 insertions(+), 93 deletions(-)



More information about the gnucash-changes mailing list