summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-10-23 18:39:45 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-24 10:32:25 -0700
commit117008a0077c852ce028a37b18013e612da9ecbd (patch)
treeb2e5a9ae6530a23657719798eb2927e8b6b64c68 /divelist.c
parentb9649f06fe5ffd63a8c9f130c8440fa0c4c50417 (diff)
downloadsubsurface-117008a0077c852ce028a37b18013e612da9ecbd.tar.gz
Added confirmation dialog when deleting dives and trips
divelist.c: Show a "Yes/No" confirmation dialog when performing delete/remove operations for dives and trips. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c
index 3e1e94dbf..c1e240d36 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1812,6 +1812,22 @@ void remove_trip(GtkTreePath *trippath, gboolean force_no_trip)
void remove_trip_cb(GtkWidget *menuitem, GtkTreePath *trippath)
{
+ int success;
+ GtkWidget *dialog;
+
+ dialog = gtk_dialog_new_with_buttons(_("Remove Trip"),
+ GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ gtk_widget_show_all(dialog);
+ success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
+ gtk_widget_destroy(dialog);
+ if (!success)
+ return;
+
remove_trip(trippath, TRUE);
mark_divelist_changed(TRUE);
}
@@ -1920,6 +1936,29 @@ static void delete_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path)
gboolean divetrip_needs_update = FALSE;
dive_trip_t *divetrip_to_update = NULL;
struct dive *dive;
+ int success;
+ GtkWidget *dialog;
+ char *dialog_title;
+
+ if (!amount_selected)
+ return;
+ if (amount_selected == 1)
+ dialog_title = _("Delete dive");
+ else
+ dialog_title = _("Delete dives");
+
+ dialog = gtk_dialog_new_with_buttons(dialog_title,
+ GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ gtk_widget_show_all(dialog);
+ success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
+ gtk_widget_destroy(dialog);
+ if (!success)
+ return;
remember_tree_state();
/* walk the dive list in chronological order */
@@ -1980,6 +2019,21 @@ static void delete_dive_cb(GtkWidget *menuitem, GtkTreePath *path)
int idx;
struct dive *dive;
GtkTreeIter iter;
+ int success;
+ GtkWidget *dialog;
+
+ dialog = gtk_dialog_new_with_buttons(_("Delete dive"),
+ GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ gtk_widget_show_all(dialog);
+ success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
+ gtk_widget_destroy(dialog);
+ if (!success)
+ return;
remember_tree_state();
if (!gtk_tree_model_get_iter(MODEL(dive_list), &iter, path))