summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-11-13 15:41:05 -0200
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-11-13 15:41:05 -0200
commitede70c03b0cff83f1d740204127fe594b8c378ec (patch)
tree7738fcbafd66a252e84a717da04af8881ab83bd7 /divelist.c
parentf967d6fb26321d07bd61769ae3c793f97b203b94 (diff)
parent97a1dd68306de17aa73be092d2bcf174e8158f62 (diff)
downloadsubsurface-ede70c03b0cff83f1d740204127fe594b8c378ec.tar.gz
Merge branch 'forlinus' of git://github.com/dirkhh/subsurface
* 'forlinus' of git://github.com/dirkhh/subsurface: Make sure SAC and OTU get recalculated after cylinder info was changed
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c
index eb8f23143..bf853ec0e 100644
--- a/divelist.c
+++ b/divelist.c
@@ -335,6 +335,14 @@ static int calculate_sac(struct dive *dive)
return sac * 1000;
}
+void update_cylinder_related_info(struct dive *dive)
+{
+ if(dive != NULL) {
+ dive->sac = calculate_sac(dive);
+ dive->otu = calculate_otu(dive);
+ }
+}
+
static void get_string(char **str, const char *s)
{
int len;
@@ -452,8 +460,7 @@ static void fill_dive_list(void)
for (i = 0; i < dive_table.nr; i++) {
struct dive *dive = dive_table.dives[i];
- dive->otu = calculate_otu(dive);
- dive->sac = calculate_sac(dive);
+ update_cylinder_related_info(dive);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
DIVE_INDEX, i,