Bug 721306 - Account hierarchy column widths are reset when restarting a second time without changing the widths

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23741 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2014-01-22 10:56:54 +00:00
parent 24660782f0
commit 6d46b9f7b3

View File

@ -391,8 +391,9 @@ gnc_tree_view_destroy (GtkObject *object)
} }
key = g_strjoin ("_", name, STATE_KEY_SUFF_WIDTH, NULL); key = g_strjoin ("_", name, STATE_KEY_SUFF_WIDTH, NULL);
if (gtk_tree_view_column_get_fixed_width (column) if (g_object_get_data (G_OBJECT(column), "default-width") &&
!= gtk_tree_view_column_get_width (column)) (GPOINTER_TO_INT((g_object_get_data (G_OBJECT(column), "default-width")))
!= gtk_tree_view_column_get_width (column)))
{ {
g_key_file_set_integer (state_file, priv->state_section, key, g_key_file_set_integer (state_file, priv->state_section, key,
gtk_tree_view_column_get_width (column)); gtk_tree_view_column_get_width (column));
@ -1643,6 +1644,13 @@ gnc_tree_view_column_properties (GncTreeView *view,
"sizing", GTK_TREE_VIEW_COLUMN_FIXED, "sizing", GTK_TREE_VIEW_COLUMN_FIXED,
"fixed-width", width, "fixed-width", width,
NULL); NULL);
/* Save the initially calculated preferred width for later
* comparison to the actual width when saving state. Can't
* use the "fixed-width" property for that because it changes
* when the user resizes the column.
*/
g_object_set_data (G_OBJECT(column),
"default-width", GINT_TO_POINTER (width));
} }
s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view)); s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));