From 2391bd0de7d31abc0a3bb5bdf95ae6481e4275eb Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 21 Nov 2010 09:57:13 -0500 Subject: [PATCH] Added confirmation dialog to custom template delete button. --- src/media-select.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/media-select.c b/src/media-select.c index af71d972..ded93194 100644 --- a/src/media-select.c +++ b/src/media-select.c @@ -627,6 +627,9 @@ custom_delete_clicked_cb (GtkButton *button, GtkTreeIter iter; GtkTreeModel *model; gchar *name; + GtkWidget *window; + GtkWidget *dialog; + gint ret; this->priv->stop_signals = TRUE; @@ -637,8 +640,23 @@ custom_delete_clicked_cb (GtkButton *button, gtk_tree_selection_get_selected (selection, &model, &iter); gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1); - lgl_db_delete_template_by_name (name); - gl_mini_preview_pixbuf_cache_delete_by_name (name); + window = gtk_widget_get_toplevel (GTK_WIDGET (this)); + dialog = gtk_message_dialog_new (GTK_WINDOW (window), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Delete template \"%s\"?"), name); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("This action will permanently delete this template.")); + + ret = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + if ( ret == GTK_RESPONSE_YES ) + { + lgl_db_delete_template_by_name (name); + gl_mini_preview_pixbuf_cache_delete_by_name (name); + } g_free (name); } -- 2.39.5