From 972669d6363c163ed6d3b737cbd6b1bd534f3d7b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 20 Aug 2012 05:48:07 -0700 Subject: Rework dive selection logic This completely changes how we keep track of selected dives: instead of having an array listing the selection ("selectiontracker") or trusting the gtk selection information, just save the information about whether a dive is selected in the dive itself. That makes it trivial to keep track of the state of selection across group collapse/expand events, or when changing the tree view model. It also ends up simplifying the code and logic in other ways. HOWEVER, it does currently (re-)introduce an annoying oddity with gtk: if you collapse a dive trip that has individual selections, gtk will forget those selections ("out of sight, out of mind"), and when you do *new* selections, the old hidden ones remain. So there's some games required to make gtk do sane things. We may need to either explicitly drop selections when collapsing trips, or make sure the group entry gets selected when collapsing a group that has selections in it. Or something. There may be other issues introduced by this too. Signed-off-by: Linus Torvalds --- dive.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dive.h') diff --git a/dive.h b/dive.h index 41f427a2c..cc27ab861 100644 --- a/dive.h +++ b/dive.h @@ -236,6 +236,7 @@ struct event { struct dive { int number; + int selected; time_t when; char *location; char *notes; @@ -284,7 +285,6 @@ struct dive_table { extern struct dive_table dive_table; -extern int *selectiontracker; extern int selected_dive; #define current_dive (get_dive(selected_dive)) @@ -355,7 +355,7 @@ extern void evn_foreach(void (*callback)(const char *, int *, void *), void *dat extern int add_new_dive(struct dive *dive); extern int edit_dive_info(struct dive *dive); -extern int edit_multi_dive_info(int nr, int *indices); +extern int edit_multi_dive_info(int idx); extern void dive_list_update_dives(void); extern void flush_divelist(struct dive *dive); -- cgit v1.2.3-70-g09d2