]> git.tdb.fi Git - ext/subsurface.git/blobdiff - statistics.c
moved zoomed_plot to display.h
[ext/subsurface.git] / statistics.c
index 19105653c2aa1ad8014cfa095dd86bf524f940fc..b9d2c3b95d19c57f96b2a353e274d9bb4304c301 100644 (file)
@@ -142,25 +142,22 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive)
        }
 }
 
-void process_selected_dives(GList *selected_dives, GtkTreeModel *model)
+/* make sure we skip the selected summary entries */
+void process_selected_dives(void)
 {
-       struct dive *dp;
-       unsigned int i;
-       GtkTreeIter iter;
-       GtkTreePath *path;
+       struct dive *dive;
+       unsigned int i, nr;
 
        memset(&stats_selection, 0, sizeof(stats_selection));
-       stats_selection.selection_size = amount_selected;
-
-       for (i = 0; i < amount_selected; ++i) {
-               GValue value = {0, };
-               path = g_list_nth_data(selected_dives, i);
-               if (gtk_tree_model_get_iter(model, &iter, path)) {
-                       gtk_tree_model_get_value(model, &iter, 0, &value);
-                       dp = get_dive(g_value_get_int(&value));
+
+       nr = 0;
+       for_each_dive(i, dive) {
+               if (dive->selected) {
+                       process_dive(dive, &stats_selection);
+                       nr++;
                }
-               process_dive(dp, &stats_selection);
        }
+       stats_selection.selection_size = nr;
 }
 
 static void set_label(GtkWidget *w, const char *fmt, ...)
@@ -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) {