gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Mar 17 16:17:00 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/207b105b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/372a36ee (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4cc766b0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/898f9a6e (commit)



commit 207b105b9cd86225d7d9b1d5952a0cf63b41f211
Merge: 898f9a6e59 372a36eeb9
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Mar 17 13:09:36 2023 -0700

    Merge Brian Rater's '798570' into maint.


commit 372a36eeb92605628cf52652be7110dbf52c6e54
Author: BLR <blrnh94 at gmail.com>
Date:   Fri Mar 17 09:13:47 2023 -0400

    798570 Budget totals for income, expenses and remaining to budget incorrect when increasing the number of periods.

diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index b69baa7112..789841b86a 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -1547,11 +1547,13 @@ The function will step through to only display the columns that are set
 void
 gnc_budget_view_refresh (GncBudgetView *budget_view)
 {
-	// Column identifiers
-	const gint GNC_BUDGET_VIEW_CODE_COL = 1;
-	const gint GNC_BUDGET_VIEW_DESC_COL = 2;
-	const gint GNC_BUDGET_VIEW_START_PERIODS_COL = 3;
-	// The Totals column will be after the periods columns.
+    // Column identifiers
+    enum {
+        code_column         = 1,
+        description_column  = 2,
+        startPeriods_column = 3
+        // The Totals column will be after the periods columns.
+    };
 
     GncBudgetViewPrivate *priv;
     gint num_periods;
@@ -1595,13 +1597,13 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
     // set visibility of the account code columns
     code_col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW(priv->tree_view), "account-code");
     gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
-    code_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), GNC_BUDGET_VIEW_CODE_COL);
+    code_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), code_column);
     gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
 
     // set visibility of the account description columns
     desc_col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW(priv->tree_view), "description");
     gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
-    desc_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), GNC_BUDGET_VIEW_DESC_COL);
+    desc_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), description_column);
     gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
 
     /* If we're creating new columns to be appended to already existing
@@ -1614,7 +1616,7 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
         gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->tree_view), col);
         priv->total_col = NULL;
         col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view),
-        		GNC_BUDGET_VIEW_START_PERIODS_COL + num_periods_visible);
+        	startPeriods_column + num_periods_visible);
         gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->totals_tree_view), col);
     }
 

commit 4cc766b07a4c5a886f632f44eac9ec19778ec467
Author: BLR <blrnh94 at gmail.com>
Date:   Tue Mar 14 13:52:06 2023 -0400

    budget totals for one period would be wrong when increasing the number of periods.

diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 9089640976..b69baa7112 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -1547,6 +1547,12 @@ The function will step through to only display the columns that are set
 void
 gnc_budget_view_refresh (GncBudgetView *budget_view)
 {
+	// Column identifiers
+	const gint GNC_BUDGET_VIEW_CODE_COL = 1;
+	const gint GNC_BUDGET_VIEW_DESC_COL = 2;
+	const gint GNC_BUDGET_VIEW_START_PERIODS_COL = 3;
+	// The Totals column will be after the periods columns.
+
     GncBudgetViewPrivate *priv;
     gint num_periods;
     gint num_periods_visible;
@@ -1589,13 +1595,13 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
     // set visibility of the account code columns
     code_col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW(priv->tree_view), "account-code");
     gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
-    code_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), 1);
+    code_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), GNC_BUDGET_VIEW_CODE_COL);
     gtk_tree_view_column_set_visible (code_col, priv->show_account_code);
 
     // set visibility of the account description columns
     desc_col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW(priv->tree_view), "description");
     gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
-    desc_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), 2);
+    desc_col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), GNC_BUDGET_VIEW_DESC_COL);
     gtk_tree_view_column_set_visible (desc_col, priv->show_account_desc);
 
     /* If we're creating new columns to be appended to already existing
@@ -1607,7 +1613,8 @@ gnc_budget_view_refresh (GncBudgetView *budget_view)
         col = priv->total_col;
         gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->tree_view), col);
         priv->total_col = NULL;
-        col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view), num_periods_visible + 1);
+        col = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->totals_tree_view),
+        		GNC_BUDGET_VIEW_START_PERIODS_COL + num_periods_visible);
         gtk_tree_view_remove_column (GTK_TREE_VIEW(priv->totals_tree_view), col);
     }
 



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



More information about the gnucash-changes mailing list