Hi,

Found a minor issue with column width in budget view. From the commit
message:

The width of the columns in the totals view should be equal to the width in
the account view. Before this change, the values in the total column in the
totals view would move off the view to the right when resizing the
left-most column.

Please see attached patch.

// Erik

-- 
Erik Johansson
Home Page: http://ejohansson.se/
PGP Key: http://ejohansson.se/erik.asc
From 2a5f816b95a2c2c1a91c98ea97ebd3433cf8e476 Mon Sep 17 00:00:00 2001
From: Erik Johansson <e...@ejohansson.se>
Date: Sun, 9 Mar 2014 21:57:36 +0100
Subject: [PATCH] Fix resizing of columns in budget view

The width of the columns in the totals view should be equal to the width in the
account view. Before this change, the values in the total column in the totals
view would move off the view to the right when resizing the left-most column.

Resizing the name column below two steps to the left:

| Name     | Period 1 | Period 2 | ... | Total |
| Foo      |        0 |        0 | ... |     0 |
------------------------------------------------
| Income   |        0 |        0 | ... |     0 |

Resulted in this layout:

| Name   | Period 1 | Period 2 | ... |   Total |
| Foo    |        0 |        0 | ... |       0 |
------------------------------------------------
| Income |        0 |        0 | ... |         0 |
---
 src/gnome/gnc-budget-view.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/gnome/gnc-budget-view.c b/src/gnome/gnc-budget-view.c
index 90c2010..268699b 100644
--- a/src/gnome/gnc-budget-view.c
+++ b/src/gnome/gnc-budget-view.c
@@ -369,6 +369,7 @@ gbv_create_widget(GncBudgetView *view)
 
     totals_title_col = gtk_tree_view_column_new_with_attributes("", gtk_cell_renderer_text_new(), "text", 0, NULL);
     gtk_tree_view_column_set_expand(totals_title_col, TRUE);
+    gtk_tree_view_column_set_sizing(totals_title_col, GTK_TREE_VIEW_COLUMN_FIXED);
     gtk_tree_view_append_column(totals_tree_view, totals_title_col);
 
     gtk_box_pack_end(GTK_BOX(inner_vbox), GTK_WIDGET(totals_tree_view), /*expand*/FALSE, /*fill*/TRUE, 0);
@@ -585,12 +586,7 @@ gbv_treeview_resized_cb(GtkWidget* widget, GtkAllocation* allocation, GncBudgetV
         {
             col_width = gtk_tree_view_column_get_width(tree_view_col);
             totals_view_col = gtk_tree_view_get_column(priv->totals_tree_view, j);
-            /* Don't set the width of the first column, which was set up
-             * in gbv_create_widget. It has a sizing of GROW_ONLY. */
-            if (gtk_tree_view_column_get_sizing(totals_view_col) == GTK_TREE_VIEW_COLUMN_FIXED)
-            {
-                gtk_tree_view_column_set_fixed_width(totals_view_col, col_width);
-            }
+            gtk_tree_view_column_set_fixed_width(totals_view_col, col_width);
             j++;
         }
     }
-- 
1.9.0

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to