]> git.tdb.fi Git - ext/subsurface.git/blobdiff - info.c
Fix right click edit in Dive Notes area for multiple dives
[ext/subsurface.git] / info.c
diff --git a/info.c b/info.c
index 1c7b6a9ac7d57bf7f8fd73e134e91eb27eeee1b1..e9a08ca2a5c2f240d564dc9310e73e33126c684e 100644 (file)
--- a/info.c
+++ b/info.c
@@ -132,11 +132,12 @@ static int delete_dive_info(struct dive *dive)
 
 static void info_menu_edit_cb(GtkMenuItem *menuitem, gpointer user_data)
 {
-       edit_dive_info(current_dive);
+       edit_multi_dive_info(amount_selected, selectiontracker);
 }
 
 static void info_menu_delete_cb(GtkMenuItem *menuitem, gpointer user_data)
 {
+       /* this needs to delete all the selected dives as well, I guess? */
        delete_dive_info(current_dive);
 }
 
@@ -470,13 +471,18 @@ int edit_multi_dive_info(int nr, int *indices)
        success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
        if (success)
                for (i = 0; i < nr; i++) {
+                       int idx = indices[i];
+                       struct dive *n = get_dive(idx);
+
+                       if (!n)
+                               continue;
                        /* copy all "info" fields */
-                       save_dive_info_changes(get_dive(indices[i]), &info);
+                       save_dive_info_changes(n, &info);
                        /* copy the cylinders / weightsystems */
-                       update_equipment_data(get_dive(indices[i]), dive);
+                       update_equipment_data(n, dive);
                        /* this is extremely inefficient... it loops through all
                           dives to find the right one - but we KNOW the index already */
-                       flush_divelist(get_dive(indices[i]));
+                       flush_divelist(n);
                }
        gtk_widget_destroy(dialog);