diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-08 11:28:13 +1100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-08 11:46:06 +1100 |
commit | b18c34373f2c5e90e1d311f28e5a9ae12c6d1be3 (patch) | |
tree | 0b5deba866715b4afb2f8312abeca17f997190ed /divelist.c | |
parent | e53a7d87ec44a5d8f072753e11f51f3a496f5b27 (diff) | |
download | subsurface-b18c34373f2c5e90e1d311f28e5a9ae12c6d1be3.tar.gz |
Properly de-select dives in collapsed trips that are unselected
We had the logic for the "select" case, but not for the "deselect" case. Ugh.
Reported-by: Dirk Hohndel <dirk@hohndel.org>
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.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c index e50039110..7dfe76328 100644 --- a/divelist.c +++ b/divelist.c @@ -2700,9 +2700,21 @@ static gboolean modify_selection_cb(GtkTreeSelection *selection, GtkTreeModel *m gtk_tree_model_get_iter(model, &iter, path); gtk_tree_model_get(model, &iter, DIVE_INDEX, &idx, DIVE_DATE, &when, -1); if (idx < 0) { + int i; + struct dive *dive; dive_trip_t *trip = find_trip_by_time(when); - if (trip) - trip->selected = 0; + if (!trip) + return TRUE; + + trip->selected = 0; + /* If this is expanded, let the gtk selection happen for each dive under it */ + if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(dive_list.tree_view), path)) + return TRUE; + /* Otherwise, consider each dive under it deselected */ + for_each_dive(i, dive) { + if (dive->divetrip == trip) + deselect_dive(i); + } } else { deselect_dive(idx); } |