gnucash maint: Bug 762901 [PATCH] Fix saving Account Treeview sort order.

Geert Janssens gjanssens at
Sun Sep 4 11:42:20 EDT 2016

Updated	 via (commit)
	from (commit)

commit 1684539263a802eb50ede9d30770c84e321b92a6
Author: Robert Fewell <14uBobIT at>
Date:   Wed Aug 3 13:52:34 2016 +0100

    Bug 762901 [PATCH] Fix saving Account Treeview sort order.
    The default treeview sort order when created is the name column which
    happens to be column 0. When saving the sort order, column 0 is checked
    to see if it is the sort column and if it is the sort order is not saved
    Changed to check for the column not being 'name' and then save the order

diff --git a/src/gnome-utils/gnc-tree-view.c b/src/gnome-utils/gnc-tree-view.c
index d63bc06..a45fc03 100644
--- a/src/gnome-utils/gnc-tree-view.c
+++ b/src/gnome-utils/gnc-tree-view.c
@@ -1104,10 +1104,8 @@ void gnc_tree_view_save_state (GncTreeView *view)
         gchar *sort_order = gnc_tree_view_get_sort_order (view);
         gchar **col_order = gnc_tree_view_get_column_order (view, &num_cols);
-        /* Default sort column is the first column */
-        if (sort_column &&
-                (gnc_tree_view_find_column_by_name (view, sort_column) !=
-                        gtk_tree_view_get_column (GTK_TREE_VIEW (view), 0)))
+        /* Default sort column is the name column */
+        if (sort_column && (g_strcmp0 (sort_column, "name") != 0))
             g_key_file_set_string (state_file, priv->state_section, STATE_KEY_SORT_COLUMN, sort_column);
         else if (g_key_file_has_key (state_file, priv->state_section, STATE_KEY_SORT_COLUMN, NULL))
             g_key_file_remove_key (state_file, priv->state_section, STATE_KEY_SORT_COLUMN, NULL);

Summary of changes:
 src/gnome-utils/gnc-tree-view.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

More information about the gnucash-changes mailing list