summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-10 10:04:50 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-10 10:04:50 -0700
commit0a9ad49f0aaf45a4d89c4ed90ce2c5c6fab154d5 (patch)
treeed5475718a403e873e19fee9b6cebf780fbf8cd0 /info.c
parenta9055049f1486dd18c0b877452a6d5c3b9076fe3 (diff)
downloadsubsurface-0a9ad49f0aaf45a4d89c4ed90ce2c5c6fab154d5.tar.gz
Fix selection handling for invalid dives
This is the downside of having to track our own selection state. We now have a class of dives that potentially isn't known to Gtk as we aren't adding them to the TreeView. So we need to make sure that their selection state is consistent by deselecting them (either when they are marked as invalid OR when we change preferences to no longer show invalid dives). And because Gtk sends out another set of selection events when clearing the TreeView (not sure why), we also need to make sure that their selection state isn't reset to selected by mistake when the divelist is recreated. A bit of a pain, but it seems to work now and be consistent. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/info.c b/info.c
index 724c1dcfd..c5f918e9d 100644
--- a/info.c
+++ b/info.c
@@ -609,6 +609,13 @@ static void save_dive_info_changes(struct dive *dive, struct dive *master, struc
if (tags_shown && dive->dive_tags != master->dive_tags) {
changed = 1;
dive->dive_tags = master->dive_tags;
+ /* if a dive is selected and we aren't showing invalid dives and it is
+ * now marked as invalid we need to deselect it to keep the selection
+ * state consistent */
+ if (!prefs.display_invalid_dives && dive->selected && dive->dive_tags & DTAG_INVALID) {
+ dive->selected = 0;
+ amount_selected--;
+ }
}
if (changed) {
mark_divelist_changed(TRUE);