Commit 927ce61c authored by Michael Natterer's avatar Michael Natterer 😴

app: use a data delete dialog in the tool options' preset delete menu

parent 920d1a42
......@@ -42,6 +42,8 @@
#include "widgets/gimptooloptionseditor.h"
#include "widgets/gimpuimanager.h"
#include "dialogs/data-delete-dialog.h"
#include "tool-options-commands.h"
#include "gimp-intl.h"
......@@ -145,12 +147,15 @@ tool_options_delete_preset_cmd_callback (GtkAction *action,
preset = (GimpToolPreset *)
gimp_container_get_child_by_index (tool_info->presets, value);
if (preset)
if (preset &&
gimp_data_is_deletable (GIMP_DATA (preset)))
GimpDataFactory *preset_factory = context->gimp->tool_preset_factory;
GimpDataFactory *factory = context->gimp->tool_preset_factory;
GtkWidget *dialog;
gimp_container_remove (gimp_data_factory_get_container (preset_factory),
GIMP_OBJECT (preset));
dialog = data_delete_dialog_new (factory, GIMP_DATA (preset), NULL,
GTK_WIDGET (editor));
gtk_widget_show (dialog);
......@@ -68,7 +68,7 @@ data_delete_dialog_new (GimpDataFactory *factory,
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (GIMP_IS_DATA (data), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
delete_data = g_slice_new0 (DataDeleteDialog);
......@@ -150,7 +150,7 @@ data_delete_dialog_response (GtkWidget *dialog,
if (new_active)
gimp_context_set_by_type (delete_data->context,
gimp_container_get_children_type (gimp_data_factory_get_container (factory)),
gimp_container_get_children_type (container),
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