From ae3886b9875a48a726627a9bec437702ffc8e7c7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 7 Jan 2013 14:52:31 -0800 Subject: [PATCH] Make Cancel work in dive planner dialog With this a partially planned dive is indeed thrown away when hitting Cancel. Signed-off-by: Dirk Hohndel --- planner.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/planner.c b/planner.c index b02363f06..52066d673 100644 --- a/planner.c +++ b/planner.c @@ -732,6 +732,14 @@ void input_plan() gtk_widget_show_all(planner); if (gtk_dialog_run(GTK_DIALOG(planner)) == GTK_RESPONSE_ACCEPT) { plan(&diveplan, &cache_data, &planned_dive); + } else { + if (planned_dive) { + /* we have added a dive during the dynamic construction + * in the dialog; get rid of it */ + delete_single_dive(dive_table.nr - 1); + report_dives(FALSE, FALSE); + planned_dive = NULL; + } } gtk_widget_destroy(planner); }