summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-19 23:42:11 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-19 23:49:56 -0400
commitc804c4e02e0530889697fab524cba294a55ffeeb (patch)
tree6a6afb7d8a82a890cb4390cdeeda0658d3034d3a /info.c
parentbf83aa21046e7dfe63cb3bd13ea608067400967e (diff)
downloadsubsurface-c804c4e02e0530889697fab524cba294a55ffeeb.tar.gz
Partial rewrite of the dive trip code
This introduces a new data structure for dive trips - reuseing the struct dive just got way too messy. The dive_trip_t datastructure now allows the code to remember if the trip was auto generated or if its time stamp changed when dives where added to the trip during auto generation. The algorithm also distinguishes between dives that were intentionally added to a trip (either in an XML file or by adding them to trip in the UI) and dives that were added to trips via autogen. Saving dives that were added to trips via autogen makes that assignment "intentional". With this partial rewrite several of the oddities of the old code should be resolved - especially turning autogen on and off again should get the divelist back to the previous stage. Also, when dives are merged during file open or import we now try to pick the correct tripflag (instead of just ignoring the tripflag completely and resetting it to TF_NONE by mistake). Finally, the dive trip debugging code got more verbose and is trying harder to detect issues at the earliest time possible. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/info.c b/info.c
index ad482f11d..87e34f142 100644
--- a/info.c
+++ b/info.c
@@ -443,7 +443,7 @@ static void save_dive_info_changes(struct dive *dive, struct dive *master, struc
}
}
-static void dive_trip_widget(GtkWidget *box, struct dive *trip, struct dive_info *info)
+static void dive_trip_widget(GtkWidget *box, dive_trip_t *trip, struct dive_info *info)
{
GtkWidget *hbox, *label;
char buffer[80] = "Edit trip summary";
@@ -535,7 +535,7 @@ void update_equipment_data(struct dive *dive, struct dive *master)
memcpy(dive->weightsystem, master->weightsystem, WS_BYTES);
}
-gboolean edit_trip(struct dive *trip)
+gboolean edit_trip(dive_trip_t *trip)
{
GtkWidget *dialog, *vbox;
int success;
@@ -569,10 +569,8 @@ gboolean edit_trip(struct dive *trip)
if (old_text)
g_free(old_text);
}
- if (changed) {
+ if (changed)
mark_divelist_changed(TRUE);
- flush_divelist(trip);
- }
}
gtk_widget_destroy(dialog);
return changed;