X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=blobdiff_plain;f=statistics.c;h=a53617337fa712b8864a3fdc4aee20bd8b7f9682;hp=7ff2bfd016e6dcdf727dd7f9bb7a37629925bf40;hb=HEAD;hpb=6fdeeb8c9f4dafe31aa51e785f535feb8a9df46e diff --git a/statistics.c b/statistics.c index 7ff2bfd..a536173 100644 --- a/statistics.c +++ b/statistics.c @@ -143,24 +143,21 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive) } /* make sure we skip the selected summary entries */ -void process_selected_dives(GList *selected_dives, int *selectiontracker, GtkTreeModel *model) +void process_selected_dives(void) { - struct dive *dp; - unsigned int i; - int idx; + struct dive *dive; + unsigned int i, nr; memset(&stats_selection, 0, sizeof(stats_selection)); - for (i = 0; i < amount_selected; ++i) { - idx = selectiontracker[i]; - if (idx > 0) { - dp = get_dive(idx); - if (dp) { - process_dive(dp, &stats_selection); - } + nr = 0; + for_each_dive(i, dive) { + if (dive->selected) { + process_dive(dive, &stats_selection); + nr++; } } - stats_selection.selection_size = amount_selected; + stats_selection.selection_size = nr; } static void set_label(GtkWidget *w, const char *fmt, ...) @@ -214,7 +211,7 @@ static void show_single_dive_stats(struct dive *dive) set_label(single_w.date, buf); set_label(single_w.dive_time, "%d min", (dive->duration.seconds + 30) / 60); if (prev_dive) - set_label(single_w.surf_intv, + set_label(single_w.surf_intv, get_time_string(dive->when - (prev_dive->when + prev_dive->duration.seconds), 4)); else set_label(single_w.surf_intv, "unknown"); @@ -274,10 +271,7 @@ static void show_total_dive_stats(struct dive *dive) const char *unit; stats_t *stats_ptr; - if (amount_selected < 2) - stats_ptr = &stats; - else - stats_ptr = &stats_selection; + stats_ptr = &stats_selection; set_label(stats_w.selection_size, "%d", stats_ptr->selection_size); if (stats_ptr->min_temp) {