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>
This commit is contained in:
Linus Torvalds 2013-02-19 12:54:58 -08:00 committed by Dirk Hohndel
parent 62193fd4f7
commit aa6b164a3e

View file

@ -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));
}