r23741 - gnucash/trunk/src/gnome-utils - Bug 721306 - Account hierarchy column widths are reset when restarting a second time without changing the widths

Geert Janssens gjanssens at code.gnucash.org
Wed Jan 22 05:56:54 EST 2014


Author: gjanssens
Date: 2014-01-22 05:56:54 -0500 (Wed, 22 Jan 2014)
New Revision: 23741
Trac: http://svn.gnucash.org/trac/changeset/23741

Modified:
   gnucash/trunk/src/gnome-utils/gnc-tree-view.c
Log:
Bug 721306 - Account hierarchy column widths are reset when restarting a second time without changing the widths

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view.c	2014-01-22 01:53:02 UTC (rev 23740)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view.c	2014-01-22 10:56:54 UTC (rev 23741)
@@ -391,8 +391,9 @@
             }
 
             key = g_strjoin ("_", name, STATE_KEY_SUFF_WIDTH, NULL);
-            if (gtk_tree_view_column_get_fixed_width (column)
-                    != gtk_tree_view_column_get_width (column))
+            if (g_object_get_data (G_OBJECT(column), "default-width") &&
+                (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,
                                         gtk_tree_view_column_get_width (column));
@@ -1643,6 +1644,13 @@
                      "sizing",      GTK_TREE_VIEW_COLUMN_FIXED,
                      "fixed-width", width,
                      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));



More information about the gnucash-changes mailing list