summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-11-25 20:06:54 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-26 09:30:27 -0800
commitffa3fd551c2571060b5f41b7dedad3e714e33311 (patch)
treedaaeb39832dcff1721f741b5d85c0514ec705464 /dive.h
parent85f0749c854b014d6f8759426fa981eb9418ca18 (diff)
downloadsubsurface-ffa3fd551c2571060b5f41b7dedad3e714e33311.tar.gz
Clarify (and fix) dive trip auto-generation
This makes the dive trip auto-generation a separate pass from the showing of the dive trips, which makes things much more understandable. It simplifies the code a lot too, because it's much more natural to generate the automatic trip data by walking the dives from oldest to newest (while the tree model wants to walk the other way). It gets rid of the most annoying part of using the gtk tree model for dive trip management, but some still remains. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/dive.h b/dive.h
index 18a48c94e..b8614bcb3 100644
--- a/dive.h
+++ b/dive.h
@@ -280,8 +280,12 @@ typedef struct dive_trip {
struct dive *dives;
int nrdives;
int expanded:1, selected:1;
+ struct dive_trip *next;
} dive_trip_t;
+/* List of dive trips (sorted by date) */
+extern dive_trip_t *dive_trip_list;
+
struct dive {
int number;
tripflag_t tripflag;
@@ -346,7 +350,6 @@ static inline int rel_mbar_to_depth(int mbar, struct dive *dive)
* be able to edit a dive without unintended side effects */
extern struct dive edit_dive;
-extern GList *dive_trip_list;
extern gboolean autogroup;
/* random threashold: three days without diving -> new trip
* this works very well for people who usually dive as part of a trip and don't
@@ -356,8 +359,6 @@ extern gboolean autogroup;
#define UNGROUPED_DIVE(_dive) ((_dive)->tripflag == NO_TRIP)
#define DIVE_IN_TRIP(_dive) ((_dive)->tripflag == IN_TRIP || (_dive)->tripflag == ASSIGNED_TRIP)
#define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE)
-#define NEXT_TRIP(_entry) ((_entry) ? g_list_next(_entry) : (dive_trip_list))
-#define PREV_TRIP(_entry) ((_entry) ? g_list_previous(_entry) : g_list_last(dive_trip_list))
#define DIVE_TRIP(_trip) ((dive_trip_t *)(_trip)->data)
#define DIVE_FITS_TRIP(_dive, _dive_trip) ((_dive_trip)->when - TRIP_THRESHOLD <= (_dive)->when)