summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-02-19 12:54:58 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-19 13:05:48 -0800
commitaa6b164a3e18cf186adbba8f441c85d712a08cf4 (patch)
treee77ab52fdc8d8b25bedb727240cf6c65debdf76f /divelist.c
parent62193fd4f760e9e2b65fc31fade0e147003c5c76 (diff)
downloadsubsurface-aa6b164a3e18cf186adbba8f441c85d712a08cf4.tar.gz
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@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/divelist.c b/divelist.c
index 0fac6ea39..9d5b0c910 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));
}