[gimp] app: use a data delete dialog in the tool options' preset delete menu
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: use a data delete dialog in the tool options' preset delete menu
- Date: Thu, 24 Mar 2011 20:56:01 +0000 (UTC)
commit 927ce61ce1be865783b7e7561921a7fa56f99fec
Author: Michael Natterer <mitch gimp org>
Date: Thu Mar 24 21:54:40 2011 +0100
app: use a data delete dialog in the tool options' preset delete menu
app/actions/tool-options-commands.c | 13 +++++++++----
app/dialogs/data-delete-dialog.c | 4 ++--
2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/tool-options-commands.c b/app/actions/tool-options-commands.c
index 340c86c..0d364e4 100644
--- a/app/actions/tool-options-commands.c
+++ b/app/actions/tool-options-commands.c
@@ -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);
}
}
diff --git a/app/dialogs/data-delete-dialog.c b/app/dialogs/data-delete-dialog.c
index f231fa6..2ad6b07 100644
--- a/app/dialogs/data-delete-dialog.c
+++ b/app/dialogs/data-delete-dialog.c
@@ -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),
new_active);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]