Commit 3369fda4 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

ask confirmation before deleting a command/script

[bug #627475]
parent 52b34eb9
...@@ -446,12 +446,27 @@ static void ...@@ -446,12 +446,27 @@ static void
delete_script_cb (GtkButton *button, delete_script_cb (GtkButton *button,
DialogData *data) DialogData *data)
{ {
GtkWidget *d;
int result;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkTreeModel *model = GTK_TREE_MODEL (data->list_store); GtkTreeModel *model = GTK_TREE_MODEL (data->list_store);
GtkTreeIter iter; GtkTreeIter iter;
GthScript *script; GthScript *script;
GthScriptFile *script_file; GthScriptFile *script_file;
d = _gtk_message_dialog_new (GTK_WINDOW (data->dialog),
GTK_DIALOG_MODAL,
GTK_STOCK_DIALOG_QUESTION,
_("Are you sure you want to delete the selected command?"),
NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_DELETE, GTK_RESPONSE_OK,
NULL);
result = gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
if (result != GTK_RESPONSE_OK)
return;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->list_view)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->list_view));
if (! gtk_tree_selection_get_selected (selection, &model, &iter)) if (! gtk_tree_selection_get_selected (selection, &model, &iter))
return; return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment