Use gimp_item_is_content_locked() instead of gimp_item_get_lock_content()
Use the new API whenever we want to determine the item's effective lock state (whether we can write to the item's content or not). Use gimp_item_get_lock_content() only in code that actually deals with *this* item's locked state, which is only the PDB wrappers and GUI to modify the flag on the item itself.
This commit is contained in:
@ -191,7 +191,7 @@ drawable_actions_update (GimpActionGroup *group,
|
||||
linked = gimp_item_get_linked (item);
|
||||
locked = gimp_item_get_lock_content (item);
|
||||
can_lock = gimp_item_can_lock_content (item);
|
||||
writable = ! locked;
|
||||
writable = ! gimp_item_is_content_locked (item);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
children = TRUE;
|
||||
|
@ -274,7 +274,7 @@ edit_actions_update (GimpActionGroup *group,
|
||||
|
||||
if (drawable)
|
||||
{
|
||||
writable = ! gimp_item_get_lock_content (GIMP_ITEM (drawable));
|
||||
writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
children = TRUE;
|
||||
|
@ -526,7 +526,7 @@ layers_actions_update (GimpActionGroup *group,
|
||||
lock_alpha = gimp_layer_get_lock_alpha (layer);
|
||||
can_lock_alpha = gimp_layer_can_lock_alpha (layer);
|
||||
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
|
||||
writable = ! gimp_item_get_lock_content (GIMP_ITEM (layer));
|
||||
writable = ! gimp_item_is_content_locked (GIMP_ITEM (layer));
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
|
||||
children = TRUE;
|
||||
@ -546,10 +546,10 @@ layers_actions_update (GimpActionGroup *group,
|
||||
{
|
||||
if (gimp_item_get_visible (next_visible->data))
|
||||
{
|
||||
/* next_visible is actually next_visible and
|
||||
* writable not group
|
||||
/* "next_visible" is actually "next_visible" and
|
||||
* "writable" and "not group"
|
||||
*/
|
||||
if (gimp_item_get_lock_content (next_visible->data) ||
|
||||
if (gimp_item_is_content_locked (next_visible->data) ||
|
||||
gimp_viewable_get_children (next_visible->data))
|
||||
next_visible = NULL;
|
||||
|
||||
|
@ -146,7 +146,7 @@ select_actions_update (GimpActionGroup *group,
|
||||
|
||||
if (drawable)
|
||||
{
|
||||
writable = ! gimp_item_get_lock_content (GIMP_ITEM (drawable));
|
||||
writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||
children = TRUE;
|
||||
|
@ -274,7 +274,7 @@ vectors_actions_update (GimpActionGroup *group,
|
||||
linked = gimp_item_get_linked (item);
|
||||
locked = gimp_item_get_lock_content (item);
|
||||
can_lock = gimp_item_can_lock_content (item);
|
||||
writable = ! locked;
|
||||
writable = ! gimp_item_is_content_locked (item);
|
||||
|
||||
vectors_list = gimp_item_get_container_iter (item);
|
||||
|
||||
|
@ -280,7 +280,7 @@ gimp_image_item_list_filter (const GimpItem *exclude,
|
||||
|
||||
l = g_list_next (l);
|
||||
|
||||
if (gimp_item_get_lock_content (item))
|
||||
if (gimp_item_is_content_locked (item))
|
||||
list = g_list_remove (list, item);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ gimp_image_merge_down (GimpImage *image,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (layer)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (layer)))
|
||||
{
|
||||
g_set_error_literal (error, 0, 0,
|
||||
_("The layer to merge down to is locked."));
|
||||
|
@ -375,7 +375,7 @@ gimp_display_shell_dnd_bucket_fill (GimpDisplayShell *shell,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
@ -470,7 +470,7 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
|
@ -362,7 +362,7 @@ gimp_pdb_item_is_writable (GimpItem *item,
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (gimp_item_get_lock_content (item))
|
||||
if (gimp_item_is_content_locked (item))
|
||||
{
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
|
||||
_("Item '%s' (%d) cannot be modified because its "
|
||||
|
@ -174,7 +174,7 @@ gimp_blend_tool_initialize (GimpTool *tool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
@ -364,7 +364,7 @@ gimp_blend_tool_cursor_update (GimpTool *tool,
|
||||
|
||||
if (gimp_drawable_is_indexed (drawable) ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ gimp_bucket_fill_tool_initialize (GimpTool *tool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
@ -253,7 +253,7 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
|
||||
|
||||
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
||||
! gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
! gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
switch (options->fill_mode)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (layer)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (layer)))
|
||||
{
|
||||
gimp_tool_message_literal (tool, tool->display,
|
||||
_("The active layer's pixels are locked."));
|
||||
|
@ -276,7 +276,7 @@ gimp_image_map_tool_initialize (GimpTool *tool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
|
@ -281,7 +281,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
gimp_tool_message_literal (tool, display,
|
||||
_("The active layer's pixels are locked."));
|
||||
@ -541,7 +541,7 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
|
||||
|
||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
|
||||
gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
toggle_modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
|
@ -343,7 +343,7 @@ gimp_transform_tool_initialize (GimpTool *tool,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("The active layer's pixels are locked."));
|
||||
@ -759,7 +759,7 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
|
||||
|
||||
case GIMP_TRANSFORM_TYPE_LAYER:
|
||||
drawable = gimp_image_get_active_drawable (display->image);
|
||||
if (gimp_item_get_lock_content (GIMP_ITEM (drawable)))
|
||||
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
|
||||
modifier = GIMP_CURSOR_MODIFIER_BAD;
|
||||
break;
|
||||
|
||||
@ -1211,7 +1211,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gimp_item_get_lock_content (active_item))
|
||||
if (gimp_item_is_content_locked (active_item))
|
||||
{
|
||||
gimp_tool_message_literal (tool, display, locked_message);
|
||||
gimp_transform_tool_halt (tr_tool);
|
||||
|
@ -216,7 +216,7 @@ gimp_drawable_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
||||
src_type == GIMP_DND_TYPE_PATTERN)
|
||||
{
|
||||
if (! dest_viewable ||
|
||||
gimp_item_get_lock_content (GIMP_ITEM (dest_viewable)) ||
|
||||
gimp_item_is_content_locked (GIMP_ITEM (dest_viewable)) ||
|
||||
gimp_viewable_get_children (GIMP_VIEWABLE (dest_viewable)))
|
||||
return FALSE;
|
||||
|
||||
|
Reference in New Issue
Block a user