gnucash maint: [gnc-budget-view] initialize totals_col_list in reverse

Christopher Lam clam at code.gnucash.org
Wed Sep 22 09:09:20 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/94f6d11e (commit)
	from  https://github.com/Gnucash/gnucash/commit/c0736a1a (commit)



commit 94f6d11e3d067fba855dce83429decd2264039f2
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Sep 22 20:21:13 2021 +0800

    [gnc-budget-view] initialize totals_col_list in reverse
    
    b2b879211 had modified totals_cols_list from g_list_append to
    g_list_prepend and g_list_reverse. this assumed that it was already
    initialized in reverse. this commit fixes it to ensure
    gnc_budget_view_refresh is processing the reversed totals_col_list.

diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 58575115e..0516ff054 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -1581,7 +1581,7 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
     num_periods = gnc_budget_get_num_periods (priv->budget);
 
     col_list = priv->period_col_list;
-    totals_col_list = priv->totals_col_list;
+    totals_col_list = g_list_reverse (priv->totals_col_list);
     num_periods_visible = g_list_length (col_list);
 
     /* Hide any unneeded extra columns */
@@ -1592,9 +1592,9 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
         col_list = g_list_delete_link (col_list, g_list_last (col_list));
         num_periods_visible = g_list_length (col_list);
 
-        col = GTK_TREE_VIEW_COLUMN((g_list_last (totals_col_list))->data);
+        col = GTK_TREE_VIEW_COLUMN(totals_col_list->data);
         gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->totals_tree_view), col);
-        totals_col_list = g_list_delete_link (totals_col_list, g_list_last (totals_col_list));
+        totals_col_list = g_list_delete_link (totals_col_list, totals_col_list);
     }
 
     gnc_tree_view_configure_columns (GNC_TREE_VIEW(priv->tree_view));



Summary of changes:
 gnucash/gnome/gnc-budget-view.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list