[PATCH] Remember non-expanded state in 'remember_tree_state()' too
Linus Torvalds
torvalds at linux-foundation.org
Tue Feb 19 13:03:31 PST 2013
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Tue, 19 Feb 2013 12:54:58 -0800
Subject: [PATCH] Remember non-expanded state in 'remember_tree_state()' too
The 'remember_tree_state()' thing is meant to remember if a dive trip is
expanded or not, but it missed the "or not" part. IOW, it never cleared
the expanded flag, it only ever set it.
As a result, if you were doing multiple operations on the divelist tree
(testing all the recent gtk-model removal, for example) the dive trips
would end up expanding more and more, even if you collapsed things by
hand in between operations.
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
This is not a new bug, but it has become more noticeable now that we have
more operations that rely on the whole
remember_tree_state()
.. do some operations on our data structures ..
dive_list_update_dives();
restore_tree_state();
dance. Because the "remember_tree_state()" would only ever *set* the
trip->expanded flag, never actually clear it.
divelist.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/divelist.c b/divelist.c
index 0fac6ea39d4c..9d5b0c9100f7 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1886,14 +1886,11 @@ void remember_tree_state()
GtkTreePath *path;
gtk_tree_model_get(TREEMODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
- if (idx >= 0)
+ trip = find_trip_by_idx(idx);
+ if (!trip)
continue;
path = gtk_tree_model_get_path(TREEMODEL(dive_list), &iter);
- if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(dive_list.tree_view), path)) {
- trip = find_trip_by_idx(idx);
- if (trip)
- trip->expanded = TRUE;
- }
+ trip->expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(dive_list.tree_view), path);
gtk_tree_path_free(path);
} while (gtk_tree_model_iter_next(TREEMODEL(dive_list), &iter));
}
--
1.8.1.3.556.gb3310b5
More information about the subsurface
mailing list