]> git.sur5r.net Git - glabels/commitdiff
Added confirmation dialog to custom template delete button.
authorJim Evins <evins@snaught.com>
Sun, 21 Nov 2010 14:57:13 +0000 (09:57 -0500)
committerJim Evins <evins@snaught.com>
Sun, 21 Nov 2010 14:57:13 +0000 (09:57 -0500)
src/media-select.c

index af71d97252e7ebce8f5dde39106f21e14a4ef4f9..ded93194ed6e95696fe9895eb602b81e71d2024d 100644 (file)
@@ -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);
         }