[gimp] Use gimp_item_is_content_locked() instead of gimp_item_get_lock_content()



commit 02903d6970d5148b185daa53d387d912e96ef260
Author: Michael Natterer <mitch gimp org>
Date:   Sat Aug 29 15:27:04 2009 +0200

    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.

 app/actions/drawable-actions.c     |    2 +-
 app/actions/edit-actions.c         |    2 +-
 app/actions/layers-actions.c       |    8 ++++----
 app/actions/select-actions.c       |    2 +-
 app/actions/vectors-actions.c      |    2 +-
 app/core/gimpimage-item-list.c     |    2 +-
 app/core/gimpimage-merge.c         |    2 +-
 app/display/gimpdisplayshell-dnd.c |    4 ++--
 app/pdb/gimppdb-utils.c            |    2 +-
 app/tools/gimpblendtool.c          |    4 ++--
 app/tools/gimpbucketfilltool.c     |    4 ++--
 app/tools/gimpcroptool.c           |    2 +-
 app/tools/gimpimagemaptool.c       |    2 +-
 app/tools/gimppainttool.c          |    4 ++--
 app/tools/gimptransformtool.c      |    6 +++---
 app/widgets/gimpdrawabletreeview.c |    2 +-
 16 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index 9e34d8c..fc6bd52 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -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;
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index 9a407fe..d6ca39e 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -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;
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 576c1ea..7050de8 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -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;
 
diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c
index 0b5f02a..04198f6 100644
--- a/app/actions/select-actions.c
+++ b/app/actions/select-actions.c
@@ -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;
diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c
index beebd82..2d86f9b 100644
--- a/app/actions/vectors-actions.c
+++ b/app/actions/vectors-actions.c
@@ -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);
 
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index 5262ede..d588533 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -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);
         }
     }
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 609c64a..6fd3c1e 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -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."));
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 251a7ca..b3066fa 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -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,
diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c
index 4b4a495..10c2c6b 100644
--- a/app/pdb/gimppdb-utils.c
+++ b/app/pdb/gimppdb-utils.c
@@ -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 "
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 36d7fef..237dc0f 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -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;
     }
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index 99cb8be..8e28460 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -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)
             {
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index b2092e7..d1b8124 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -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."));
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index ec21982..31633b1 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -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."));
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index e576d36..c4a399b 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -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;
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 6fbe30f..fe980d8 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -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);
diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c
index d405d26..74c1a89 100644
--- a/app/widgets/gimpdrawabletreeview.c
+++ b/app/widgets/gimpdrawabletreeview.c
@@ -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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]