Redo the delete dive code

The existing code (both my first single dive delete and then Lubomir's
multi dive delete code) had way too many issues and was just painfully
inefficient.

This new code takes a radically different approach and mostly ignores the
Gtk tree model (as that gets recreated after a delete, anyway) and instead
is linear time on the number of dives in the list. It does do its best to
maintain the existing selection and the expand state of tree model (the
latter isn't possible if we have switched to the list model).

Many thanks to "Lubomir I. Ivanov" <neolit123@gmail.com> for his work on
this - this commit actually contains a few lines out of one of the patches
that he wrote.

Reported-by: "Lubomir I. Ivanov" <neolit123@gmail.com>
Tested-by: "Lubomir I. Ivanov" <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-09-28 15:16:31 -07:00
parent bd3df859bc
commit 7f5ecb5bb7
2 changed files with 110 additions and 102 deletions

1
dive.h
View file

@ -246,6 +246,7 @@ typedef struct dive_trip {
timestamp_t when_from_file;
char *location;
char *notes;
int expanded:1, selected:1;
} dive_trip_t;
struct dive {