Commit 11fa0925 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added action_data_get_context() and macro return_if_no_context().

2004-05-11  Michael Natterer  <mitch@gimp.org>

	* app/actions/actions.[ch]: added action_data_get_context() and
	macro return_if_no_context().

	* app/actions/brushes-actions.c
	* app/actions/buffers-actions.c
	* app/actions/buffers-commands.c
	* app/actions/data-commands.c
	* app/actions/fonts-actions.c
	* app/actions/fonts-commands.c
	* app/actions/gradients-actions.c
	* app/actions/images-actions.c
	* app/actions/images-commands.c
	* app/actions/palettes-actions.c
	* app/actions/patterns-actions.c
	* app/actions/templates-actions.c
	* app/actions/templates-commands.[ch]
	* app/actions/tools-actions.c
	* app/actions/tools-commands.c: moved lots of code from widgets/
	to the resp. action callbacks.

	* app/widgets/gimpeditor.[ch]: added gimp_editor_add_action_button()
	which creates a GtkButton connected to the resp. action.

	* app/widgets/gimpdatafactoryview.[ch]: added "action_group"
	parameters so we can distinguish brushes, patterns etc. actions.

	* app/widgets/gimpimageview.[ch]
	* app/widgets/gimpbrushfactoryview.c
	* app/widgets/gimpbufferview.c
	* app/widgets/gimpfontview.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimppatternfactoryview.c
	* app/widgets/gimptemplateview.[ch]
	* app/widgets/gimptoolview.c: removed tons of GtkButton::clicked()
	callbacks and use gimp_editor_add_action_button() instead
	of simply _add_button().

	* app/gui/dialogs-constructors.c
	* app/gui/gradient-select.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c: changed accordingly.
parent e53a7cb4
2004-05-11 Michael Natterer <mitch@gimp.org>
* app/actions/actions.[ch]: added action_data_get_context() and
macro return_if_no_context().
* app/actions/brushes-actions.c
* app/actions/buffers-actions.c
* app/actions/buffers-commands.c
* app/actions/data-commands.c
* app/actions/fonts-actions.c
* app/actions/fonts-commands.c
* app/actions/gradients-actions.c
* app/actions/images-actions.c
* app/actions/images-commands.c
* app/actions/palettes-actions.c
* app/actions/patterns-actions.c
* app/actions/templates-actions.c
* app/actions/templates-commands.[ch]
* app/actions/tools-actions.c
* app/actions/tools-commands.c: moved lots of code from widgets/
to the resp. action callbacks.
* app/widgets/gimpeditor.[ch]: added gimp_editor_add_action_button()
which creates a GtkButton connected to the resp. action.
* app/widgets/gimpdatafactoryview.[ch]: added "action_group"
parameters so we can distinguish brushes, patterns etc. actions.
* app/widgets/gimpimageview.[ch]
* app/widgets/gimpbrushfactoryview.c
* app/widgets/gimpbufferview.c
* app/widgets/gimpfontview.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimppatternfactoryview.c
* app/widgets/gimptemplateview.[ch]
* app/widgets/gimptoolview.c: removed tons of GtkButton::clicked()
callbacks and use gimp_editor_add_action_button() instead
of simply _add_button().
* app/gui/dialogs-constructors.c
* app/gui/gradient-select.c
* app/gui/palette-select.c
* app/gui/pattern-select.c: changed accordingly.
2004-05-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainercombobox.c: correctly get the default
......
......@@ -29,6 +29,8 @@
#include "core/gimpimage.h"
#include "widgets/gimpactionfactory.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpimageeditor.h"
#include "widgets/gimpitemtreeview.h"
......@@ -234,6 +236,26 @@ action_data_get_gimp (gpointer data)
return NULL;
}
GimpContext *
action_data_get_context (gpointer data)
{
if (! data)
return NULL;
if (GIMP_IS_DISPLAY (data))
return gimp_get_user_context (((GimpDisplay *) data)->gimage->gimp);
else if (GIMP_IS_DISPLAY_SHELL (data))
return gimp_get_user_context (((GimpDisplayShell *) data)->gdisp->gimage->gimp);
else if (GIMP_IS_CONTAINER_VIEW (data))
return gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data))
return gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
else if (GIMP_IS_DOCK (data))
return ((GimpDock *) data)->context;
return NULL;
}
GimpImage *
action_data_get_image (gpointer data)
{
......
......@@ -27,6 +27,7 @@ void actions_init (Gimp *gimp);
void actions_exit (Gimp *gimp);
Gimp * action_data_get_gimp (gpointer data);
GimpContext * action_data_get_context (gpointer data);
GimpImage * action_data_get_image (gpointer data);
GimpDisplay * action_data_get_display (gpointer data);
GtkWidget * action_data_get_widget (gpointer data);
......@@ -37,6 +38,11 @@ GtkWidget * action_data_get_widget (gpointer data);
if (! gimp) \
return
#define return_if_no_context(context,data) \
context = action_data_get_context (data); \
if (! context) \
return
#define return_if_no_image(gimage,data) \
gimage = action_data_get_image (data); \
if (! gimage) \
......
......@@ -28,11 +28,10 @@
#include "core/gimpdata.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "brushes-actions.h"
#include "data-commands.h"
......@@ -45,27 +44,32 @@ static GimpActionEntry brushes_actions[] =
GIMP_HELP_BRUSH_DIALOG },
{ "brushes-edit", GIMP_STOCK_EDIT,
N_("_Edit Brush..."), NULL, NULL,
N_("_Edit Brush..."), NULL,
N_("Edit brush"),
G_CALLBACK (data_edit_data_cmd_callback),
GIMP_HELP_BRUSH_EDIT },
{ "brushes-new", GTK_STOCK_NEW,
N_("/New Brush"), "", NULL,
N_("New Brush"), "",
N_("New brush"),
G_CALLBACK (data_new_data_cmd_callback),
GIMP_HELP_BRUSH_NEW },
{ "brushes-duplicate", GIMP_STOCK_DUPLICATE,
N_("/D_uplicate Brush"), NULL, NULL,
N_("D_uplicate Brush"), NULL,
N_("Duplicate brush"),
G_CALLBACK (data_duplicate_data_cmd_callback),
GIMP_HELP_BRUSH_DUPLICATE },
{ "brushes-delete", GTK_STOCK_DELETE,
N_("_Delete Brush"), "", NULL,
N_("_Delete Brush"), "",
N_("Delete brush"),
G_CALLBACK (data_delete_data_cmd_callback),
GIMP_HELP_BRUSH_DELETE },
{ "brushes-refresh", GTK_STOCK_REFRESH,
N_("_Refresh Brushes"), "", NULL,
N_("_Refresh Brushes"), "",
N_("Refresh brushes"),
G_CALLBACK (data_refresh_data_cmd_callback),
GIMP_HELP_BRUSH_REFRESH }
};
......@@ -83,28 +87,26 @@ void
brushes_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContainerEditor *editor;
GimpContext *context;
GimpBrush *brush;
GimpData *data = NULL;
GimpContext *context;
GimpBrush *brush = NULL;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (user_data);
context = gimp_container_view_get_context (editor->view);
context = action_data_get_context (user_data);
brush = gimp_context_get_brush (context);
if (context)
{
brush = gimp_context_get_brush (context);
if (brush)
data = GIMP_DATA (brush);
if (brush)
data = GIMP_DATA (brush);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("brushes-edit",
brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("brushes-duplicate",
brush && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("brushes-delete",
brush && data->deletable);
SET_SENSITIVE ("brushes-edit", brush);
SET_SENSITIVE ("brushes-duplicate", brush && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("brushes-delete", brush && data->deletable);
#undef SET_SENSITIVE
}
......@@ -27,10 +27,9 @@
#include "core/gimpcontext.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "buffers-actions.h"
#include "buffers-commands.h"
......@@ -43,22 +42,26 @@ static GimpActionEntry buffers_actions[] =
GIMP_HELP_BUFFER_DIALOG },
{ "buffers-paste", GTK_STOCK_PASTE,
N_("_Paste Buffer"), "", NULL,
N_("_Paste Buffer"), "",
N_("Paste the selected buffer"),
G_CALLBACK (buffers_paste_buffer_cmd_callback),
GIMP_HELP_BUFFER_PASTE },
{ "buffers-paste-into", GIMP_STOCK_PASTE_INTO,
N_("Paste Buffer _Into"), NULL, NULL,
N_("Paste Buffer _Into"), NULL,
N_("Paste the selected buffer into the selection"),
G_CALLBACK (buffers_paste_buffer_into_cmd_callback),
GIMP_HELP_BUFFER_PASTE_INTO },
{ "buffers-paste-as-new", GIMP_STOCK_PASTE_AS_NEW,
N_("Paste Buffer as _New"), NULL, NULL,
N_("Paste Buffer as _New"), NULL,
N_("Paste the selected buffer as new image"),
G_CALLBACK (buffers_paste_buffer_as_new_cmd_callback),
GIMP_HELP_BUFFER_PASTE_AS_NEW },
{ "buffers-delete", GTK_STOCK_DELETE,
N_("_Delete Buffer"), "", NULL,
N_("_Delete Buffer"), "",
N_("Delete the selected buffer"),
G_CALLBACK (buffers_delete_buffer_cmd_callback),
GIMP_HELP_BUFFER_DELETE }
};
......@@ -76,14 +79,13 @@ void
buffers_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContainerEditor *editor;
GimpContext *context;
GimpBuffer *buffer;
GimpContext *context;
GimpBuffer *buffer = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
context = gimp_container_view_get_context (editor->view);
context = action_data_get_context (data);
buffer = gimp_context_get_buffer (context);
if (context)
buffer = gimp_context_get_buffer (context);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
......
......@@ -22,7 +22,17 @@
#include "actions-types.h"
#include "core/gimp-edit.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpbufferview.h"
#include "widgets/gimpcontainerview.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
#include "buffers-commands.h"
......@@ -31,38 +41,106 @@
/* public functionss */
static void
buffers_paste (GimpBufferView *view,
gboolean paste_into)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
GimpContainer *container;
GimpContext *context;
GimpBuffer *buffer;
container = gimp_container_view_get_container (editor->view);
context = gimp_container_view_get_context (editor->view);
buffer = gimp_context_get_buffer (context);
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
{
GimpDisplay *gdisp = gimp_context_get_display (context);
GimpImage *gimage = NULL;
gint x = -1;
gint y = -1;
gint width = -1;
gint height = -1;
if (gdisp)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_display_shell_untransform_viewport (shell,
&x, &y, &width, &height);
gimage = gdisp->gimage;
}
else
{
gimage = gimp_context_get_image (context);
}
if (gimage)
{
gimp_edit_paste (gimage, gimp_image_active_drawable (gimage),
buffer, paste_into, x, y, width, height);
gimp_image_flush (gimage);
}
}
}
void
buffers_paste_buffer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_button));
buffers_paste (GIMP_BUFFER_VIEW (data), FALSE);
}
void
buffers_paste_buffer_into_cmd_callback (GtkAction *action,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_into_button));
buffers_paste (GIMP_BUFFER_VIEW (data), TRUE);
}
void
buffers_paste_buffer_as_new_cmd_callback (GtkAction *action,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContainer *container;
GimpContext *context;
GimpBuffer *buffer;
container = gimp_container_view_get_container (editor->view);
context = gimp_container_view_get_context (editor->view);
buffer = gimp_context_get_buffer (context);
gtk_button_clicked (GTK_BUTTON (view->paste_as_new_button));
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
{
GimpImage *gimage = gimp_context_get_image (context);
if (gimage)
gimp_edit_paste_as_new (gimage->gimp, gimage, buffer);
}
}
void
buffers_delete_buffer_cmd_callback (GtkAction *action,
gpointer data)
{
GimpBufferView *view = GIMP_BUFFER_VIEW (data);
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContainer *container;
GimpContext *context;
GimpBuffer *buffer;
container = gimp_container_view_get_container (editor->view);
context = gimp_container_view_get_context (editor->view);
buffer = gimp_context_get_buffer (context);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
{
gimp_container_remove (container, GIMP_OBJECT (buffer));
}
}
......@@ -20,61 +20,198 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "core/gimpdatafactory.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "actions.h"
#include "data-commands.h"
#include "gimp-intl.h"
void
data_edit_data_cmd_callback (GtkAction *action,
gpointer user_data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
GimpContext *context;
GimpData *data;
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
data = (GimpData *)
gimp_context_get_by_type (context,
view->factory->container->children_type);
if (view->data_edit_func && data &&
gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
view->data_edit_func (data, GTK_WIDGET (view));
}
}
void
data_new_data_cmd_callback (GtkAction *action,
gpointer data)
gpointer user_data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
if (view->factory->data_new_func)
{
GimpContext *context;
GimpData *data;
context =
gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
if (GTK_WIDGET_SENSITIVE (view->new_button))
gtk_button_clicked (GTK_BUTTON (view->new_button));
data = gimp_data_factory_data_new (view->factory, _("Untitled"));
if (data)
{
gimp_context_set_by_type (context,
view->factory->container->children_type,
GIMP_OBJECT (data));
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
}
}
void
data_duplicate_data_cmd_callback (GtkAction *action,
gpointer data)
gpointer user_data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
GimpContext *context;
GimpData *data;
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
data = (GimpData *)
gimp_context_get_by_type (context,
view->factory->container->children_type);
if (GTK_WIDGET_SENSITIVE (view->duplicate_button))
gtk_button_clicked (GTK_BUTTON (view->duplicate_button));
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
GimpData *new_data;
new_data = gimp_data_factory_data_duplicate (view->factory, data);
if (new_data)
{
gimp_context_set_by_type (context,
view->factory->container->children_type,
GIMP_OBJECT (new_data));
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
}
}
void
data_edit_data_cmd_callback (GtkAction *action,
gpointer data)
typedef struct _GimpDataDeleteData GimpDataDeleteData;
struct _GimpDataDeleteData
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
GimpDataFactory *factory;
GimpData *data;
};
static void
data_delete_callback (GtkWidget *widget,
gboolean delete,
gpointer data)
{
GimpDataDeleteData *delete_data = data;
if (gimp_container_have (delete_data->factory->container,
GIMP_OBJECT (delete_data->data)))
{
g_object_ref (delete_data->data);
if (GTK_WIDGET_SENSITIVE (view->edit_button))
gtk_button_clicked (GTK_BUTTON (view->edit_button));
gimp_container_remove (delete_data->factory->container,
GIMP_OBJECT (delete_data->data));
if (delete_data->data->filename)
{
GError *error = NULL;
if (! gimp_data_delete_from_disk (delete_data->data, &error))
{
g_message (error->message);
g_clear_error (&error);
}
}
g_object_unref (delete_data->data);
}
}
void
data_delete_data_cmd_callback (GtkAction *action,
gpointer data)
gpointer user_data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
GimpContext *context;
GimpData *data;
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
data = (GimpData *)
gimp_context_get_by_type (context,
view->factory->container->children_type);
if (data && data->deletable && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
GimpDataDeleteData *delete_data;
GtkWidget *dialog;
gchar *str;
delete_data = g_new0 (GimpDataDeleteData, 1);
delete_data->factory = view->factory;
delete_data->data = data;
str = g_strdup_printf (_("Are you sure you want to delete '%s' "
"from the list and from disk?"),
GIMP_OBJECT (data)->name);
dialog = gimp_query_boolean_box (_("Delete Data Object"),
GTK_WIDGET (view),
gimp_standard_help_func, NULL,
GIMP_STOCK_QUESTION,
str,
GTK_STOCK_DELETE, GTK_STOCK_CANCEL,
G_OBJECT (data),
"disconnect",
data_delete_callback,
delete_data);
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, delete_data);
g_free (str);
if (GTK_WIDGET_SENSITIVE (view->delete_button))
gtk_button_clicked (GTK_BUTTON (view->delete_button));
gtk_widget_show (dialog);
}
}
void
data_refresh_data_cmd_callback (GtkAction *action,
gpointer data)
gpointer user_data)
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data);
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
if (GTK_WIDGET_SENSITIVE (view->refresh_button))
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
gimp_data_factory_data_save (view->factory);
gimp_data_factory_data_init (view->factory, FALSE);
}
......@@ -29,10 +29,9 @@
#include "text/gimpfont.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpfontview.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "fonts-actions.h"
#include "fonts-commands.h"
......@@ -45,7 +44,8 @@ static GimpActionEntry fonts_actions[] =
GIMP_HELP_FONT_DIALOG },
{ "fonts-refresh", GTK_STOCK_REFRESH,
N_("_Rescan Font List"), "", NULL,
N_("_Rescan Font List"), "",
N_("Rescan font list"),
G_CALLBACK (fonts_refresh_cmd_callback),
GIMP_HELP_FONT_REFRESH }
};
......@@ -63,14 +63,13 @@ void
fonts_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContainerEditor *editor;
GimpContext *context;
GimpFont *font;
GimpContext *context;
GimpFont *font = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
context = gimp_container_view_get_context (editor->view);
context = action_data_get_context (data);
font = gimp_context_get_font (context);
if (context)
font = gimp_context_get_font (context);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
......
......@@ -22,8 +22,13 @@
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "text/gimp-fonts.h"
#include "widgets/gimpfontview.h"
#include "actions.h"
#include "fonts-commands.h"
#include "gimp-intl.h"
......@@ -35,8 +40,8 @@ void
fonts_refresh_cmd_callback (GtkAction *action,
gpointer data)
{
GimpFontView *view = GIMP_FONT_VIEW (data);
GimpContext *context = action_data_get_context (data);
if (GTK_WIDGET_SENSITIVE (view->refresh_button))
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
if (context)
gimp_fonts_load (context->gimp);
}
......@@ -28,11 +28,9 @@
#include "core/gimpdata.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
#include "data-commands.h"
#include "gradients-actions.h"
#include "gradients-commands.h"
......@@ -90,30 +88,27 @@ void
gradients_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContainerEditor *editor;
GimpContext *context;
GimpGradient *gradient;
GimpData *data = NULL;
GimpContext *context;
GimpGradient *gradient = NULL;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (user_data);
context = gimp_container_view_get_context (editor->view);
context = action_data_get_context (user_data);
gradient = gimp_context_get_gradient (context);
if (context)
{
gradient = gimp_context_get_gradient (context);
if (gradient)
data = GIMP_DATA (gradient);
if (gradient)
data = GIMP_DATA (gradient);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("gradients-edit",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("gradients-duplicate",
gradient && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("gradients-save-as-pov",
gradient);
SET_SENSITIVE ("gradients-delete",