Commit 5732088b authored by Michael Natterer's avatar Michael Natterer 😴

pdb: replace gimppdb-utils' "writable" boolean by a bitmask

called GimpPDBItemModify that currently has one member
GIMP_PDB_ITEM_CONTENT, in order to be prepared for adding
the "lock position" feature from bug 674160.
parent 0b35f6a0
......@@ -71,7 +71,8 @@ brightness_contrast_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GObject *config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
......@@ -120,7 +121,8 @@ levels_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
(gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
(! gimp_drawable_is_gray (drawable) ||
......@@ -167,7 +169,8 @@ levels_auto_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
gimp_drawable_levels_stretch (drawable, progress);
......@@ -195,7 +198,8 @@ levels_stretch_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
gimp_drawable_levels_stretch (drawable, progress);
......@@ -225,7 +229,8 @@ posterize_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG,
......@@ -261,7 +266,8 @@ desaturate_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
gimp_drawable_is_rgb (drawable))
{
......@@ -300,7 +306,8 @@ desaturate_full_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
gimp_drawable_is_rgb (drawable))
{
......@@ -339,7 +346,8 @@ equalize_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) ||
! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
success = FALSE;
......@@ -366,7 +374,8 @@ invert_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
gimp_drawable_apply_operation_by_name (drawable, progress,
......@@ -403,7 +412,8 @@ curves_spline_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
! (num_points & 1) &&
(gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
......@@ -449,7 +459,8 @@ curves_explicit_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
(num_bytes == 256) &&
(gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
......@@ -499,7 +510,8 @@ color_balance_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
......@@ -548,7 +560,8 @@ colorize_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
! gimp_drawable_is_gray (drawable))
{
......@@ -600,7 +613,7 @@ histogram_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error) ||
if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error) ||
gimp_drawable_is_indexed (drawable) ||
(! gimp_drawable_has_alpha (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA) ||
......@@ -668,7 +681,8 @@ hue_saturation_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GObject *config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
......@@ -714,7 +728,8 @@ threshold_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GObject *config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
......
......@@ -433,7 +433,7 @@ drawable_mask_bounds_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2);
else
success = FALSE;
......@@ -475,7 +475,7 @@ drawable_mask_intersect_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable),
&x, &y, &width, &height);
else
......@@ -514,7 +514,8 @@ drawable_merge_shadow_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
const gchar *undo_desc = _("Plug-In");
......@@ -672,7 +673,8 @@ drawable_set_pixel_invoker (GimpProcedure *procedure,
format = gimp_babl_compat_u8_format (format);
}
if (gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error) &&
if (gimp_pdb_item_is_modifyable (GIMP_ITEM (drawable),
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
x_coord < gimp_item_get_width (GIMP_ITEM (drawable)) &&
y_coord < gimp_item_get_height (GIMP_ITEM (drawable)) &&
......@@ -707,7 +709,8 @@ drawable_fill_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_writable (GIMP_ITEM (drawable), error) &&
if (gimp_pdb_item_is_modifyable (GIMP_ITEM (drawable),
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
else
......@@ -741,7 +744,8 @@ drawable_offset_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
gimp_drawable_offset (drawable, context, wrap_around, fill_type,
offset_x, offset_y);
......@@ -933,7 +937,7 @@ drawable_foreground_extract_invoker (GimpProcedure *procedure,
if (success)
{
/*
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
gimp_drawable_foreground_extract (drawable, mode, mask, progress);
else
success = FALSE;
......
......@@ -73,7 +73,8 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -141,7 +142,8 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -225,7 +227,8 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -325,7 +328,8 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -419,7 +423,8 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -507,7 +512,8 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -580,7 +586,8 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -668,7 +675,8 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -764,7 +772,8 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) && x0 < x1 && y0 < y1);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -849,7 +858,8 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) && x0 < x1 && y0 < y1);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -938,7 +948,8 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -1019,7 +1030,8 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -1118,7 +1130,8 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -1210,7 +1223,8 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -1314,7 +1328,8 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......@@ -1414,7 +1429,8 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
{
gint x, y, width, height;
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error);
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
......
......@@ -68,7 +68,8 @@ edit_cut_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -114,7 +115,7 @@ edit_copy_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GError *my_error = NULL;
......@@ -201,7 +202,8 @@ edit_paste_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp->global_buffer &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
......@@ -276,7 +278,8 @@ edit_named_cut_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -329,7 +332,7 @@ edit_named_copy_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GError *my_error = NULL;
......@@ -432,7 +435,8 @@ edit_named_paste_invoker (GimpProcedure *procedure,
GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
if (buffer &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
......@@ -508,7 +512,8 @@ edit_clear_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -540,7 +545,8 @@ edit_fill_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -586,7 +592,8 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -665,7 +672,8 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -756,7 +764,8 @@ edit_blend_invoker (GimpProcedure *procedure,
if (success)
{
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
......@@ -809,7 +818,8 @@ edit_stroke_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
......@@ -850,10 +860,12 @@ edit_stroke_vectors_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
gimp_pdb_item_is_attached (GIMP_ITEM (vectors),
gimp_item_get_image (GIMP_ITEM (drawable)), FALSE, error))
gimp_item_get_image (GIMP_ITEM (drawable)),
0, error))
{
GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
......
......@@ -159,7 +159,8 @@ floating_sel_attach_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
floating_sel_attach (layer, drawable);
else
......
......@@ -338,10 +338,10 @@ gimp_pdb_get_paint_info (Gimp *gimp,
}
gboolean
gimp_pdb_item_is_attached (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error)
gimp_pdb_item_is_attached (GimpItem *item,
GimpImage *image,
GimpPDBItemModify modify,
GError **error)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
......@@ -367,23 +367,20 @@ gimp_pdb_item_is_attached (GimpItem *item,
return FALSE;
}
if (writable)
return gimp_pdb_item_is_writable (item, error);
return TRUE;
return gimp_pdb_item_is_modifyable (item, modify, error);
}
gboolean
gimp_pdb_item_is_in_tree (GimpItem *item,
GimpImage *image,
gboolean writable,
GError **error)
gimp_pdb_item_is_in_tree (GimpItem *item,
GimpImage *image,
GimpPDBItemModify modify,
GError **error)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (! gimp_pdb_item_is_attached (item, image, writable, error))
if (! gimp_pdb_item_is_attached (item, image, modify, error))
return FALSE;
if (! gimp_item_get_tree (item))
......@@ -484,13 +481,14 @@ gimp_pdb_item_is_floating (GimpItem *item,
}
gboolean
gimp_pdb_item_is_writable (GimpItem *item,
GError **error)
gimp_pdb_item_is_modifyable (GimpItem *item,
GimpPDBItemModify modify,
GError **error)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (gimp_item_is_content_locked (item))
if ((modify & GIMP_PDB_ITEM_CONTENT) && gimp_item_is_content_locked (item))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Item '%s' (%d) cannot be modified because its "
......@@ -544,9 +542,9 @@ gimp_pdb_item_is_not_group (GimpItem *item,
}
gboolean
gimp_pdb_layer_is_text_layer (GimpLayer *layer,
gboolean writable,
GError **error)
gimp_pdb_layer_is_text_layer (GimpLayer *layer,
GimpPDBItemModify modify,
GError **error)
{
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
......@@ -562,7 +560,7 @@ gimp_pdb_layer_is_text_layer (GimpLayer *layer,
return FALSE;
}
return gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, writable, error);
return gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, modify, error);
}
static const gchar *
......@@ -670,10 +668,10 @@ gimp_pdb_image_is_not_precision (GimpImage *image,
}
GimpStroke *
gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_ID,
gboolean writable,
GError **error)
gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_ID,
GimpPDBItemModify modify,
GError **error)
{
GimpStroke *stroke = NULL;
......@@ -683,7 +681,8 @@ gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
if (! gimp_pdb_item_is_not_group (GIMP_ITEM (vectors), error))
return NULL;
if (! writable || gimp_pdb_item_is_writable (GIMP_ITEM (vectors), error))
if (! modify || gimp_pdb_item_is_modifyable (GIMP_ITEM (vectors),
modify, error))
{
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_ID);
......
......@@ -54,11 +54,11 @@ GimpPaintInfo * gimp_pdb_get_paint_info (Gimp *gimp,
gboolean gimp_pdb_item_is_attached (GimpItem *item,
GimpImage *image,
gboolean writable,
GimpPDBItemModify modify,
GError **error);
gboolean gimp_pdb_item_is_in_tree (GimpItem *item,
GimpImage *image,
gboolean writable,
GimpPDBItemModify modify,
GError **error);
gboolean gimp_pdb_item_is_in_same_tree (GimpItem *item,
GimpItem *item2,
......@@ -70,7 +70,8 @@ gboolean gimp_pdb_item_is_not_ancestor (GimpItem *item,
gboolean gimp_pdb_item_is_floating (GimpItem *item,
GimpImage *dest_image,
GError **error);
gboolean gimp_pdb_item_is_writable (GimpItem *item,
gboolean gimp_pdb_item_is_modifyable (GimpItem *item,
GimpPDBItemModify modify,
GError **error);
gboolean gimp_pdb_item_is_group (GimpItem *item,
GError **error);
......@@ -78,7 +79,7 @@ gboolean gimp_pdb_item_is_not_group (GimpItem *item,
GError **error);
gboolean gimp_pdb_layer_is_text_layer (GimpLayer *layer,
gboolean writable,
GimpPDBItemModify modify,
GError **error);
gboolean gimp_pdb_image_is_base_type (GimpImage *image,
......@@ -97,7 +98,7 @@ gboolean gimp_pdb_image_is_not_precision (GimpImage *image,
GimpStroke * gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_ID,
gboolean writable,
GimpPDBItemModify modify,
GError **error);
......
......@@ -1040,7 +1040,7 @@ image_insert_layer_invoker (GimpProcedure *procedure,
gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
error) &&
(parent == NULL ||
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, FALSE, error) &&
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
{
if (position == -1 && parent == NULL)
......@@ -1076,7 +1076,7 @@ image_remove_layer_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, 0, error))
gimp_image_remove_layer (image, layer, TRUE, NULL);
else
success = FALSE;
......@@ -1143,7 +1143,7 @@ image_insert_channel_invoker (GimpProcedure *procedure,
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error) &&
(parent == NULL ||
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, FALSE, error) &&
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
{
if (position == -1 && parent == NULL)
......@@ -1179,7 +1179,7 @@ image_remove_channel_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, 0, error))
gimp_image_remove_channel (image, channel, TRUE, NULL);
else
success = FALSE;
......@@ -1246,7 +1246,7 @@ image_insert_vectors_invoker (GimpProcedure *procedure,
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error) &&
(parent == NULL ||
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, FALSE, error) &&
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
{
if (position == -1 && parent == NULL)
......@@ -1282,7 +1282,7 @@ image_remove_vectors_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, 0, error))
gimp_image_remove_vectors (image, vectors, TRUE, NULL);
else
success = FALSE;
......@@ -1311,7 +1311,7 @@ image_get_item_position_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
if (gimp_pdb_item_is_in_tree (item, image, 0, error))
position = gimp_item_get_index (item);
else