[gimp] Make the lock actions insensitive according to the new can_lock functions



commit af794539d8a17cf4e5494c504008e5e57788c80f
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 23 19:44:15 2009 +0200

    Make the lock actions insensitive according to the new can_lock functions

 app/actions/drawable-actions.c |    4 +++-
 app/actions/layers-actions.c   |   40 +++++++++++++++++++++-------------------
 app/actions/vectors-actions.c  |    4 +++-
 3 files changed, 27 insertions(+), 21 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index 9da91d4..4e8a0e6 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -163,6 +163,7 @@ drawable_actions_update (GimpActionGroup *group,
   gboolean      visible    = FALSE;
   gboolean      linked     = FALSE;
   gboolean      locked     = FALSE;
+  gboolean      can_lock   = FALSE;
   gboolean      writable   = FALSE;
 
   image = action_data_get_image (data);
@@ -188,6 +189,7 @@ drawable_actions_update (GimpActionGroup *group,
           visible  = gimp_item_get_visible (item);
           linked   = gimp_item_get_linked (item);
           locked   = gimp_item_get_lock_content (item);
+          can_lock = gimp_item_can_lock_content (item);
           writable = ! locked;
         }
     }
@@ -204,7 +206,7 @@ drawable_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("drawable-visible",      drawable);
   SET_SENSITIVE ("drawable-linked",       drawable);
-  SET_SENSITIVE ("drawable-lock-content", drawable);
+  SET_SENSITIVE ("drawable-lock-content", can_lock);
 
   SET_ACTIVE ("drawable-visible",      visible);
   SET_ACTIVE ("drawable-linked",       linked);
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 29e9ab5..c1ba256 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -491,20 +491,21 @@ void
 layers_actions_update (GimpActionGroup *group,
                        gpointer         data)
 {
-  GimpImage     *image        = action_data_get_image (data);
-  GimpLayer     *layer        = NULL;
-  GimpLayerMask *mask         = NULL;     /*  layer mask             */
-  gboolean       fs           = FALSE;    /*  floating sel           */
-  gboolean       ac           = FALSE;    /*  active channel         */
-  gboolean       sel          = FALSE;
-  gboolean       alpha        = FALSE;    /*  alpha channel present  */
-  gboolean       indexed      = FALSE;    /*  is indexed             */
-  gboolean       lock_alpha   = FALSE;
-  gboolean       text_layer   = FALSE;
-  gboolean       writable     = FALSE;
-  GList         *next         = NULL;
-  GList         *next_visible = NULL;
-  GList         *prev         = NULL;
+  GimpImage     *image          = action_data_get_image (data);
+  GimpLayer     *layer          = NULL;
+  GimpLayerMask *mask           = NULL;     /*  layer mask             */
+  gboolean       fs             = FALSE;    /*  floating sel           */
+  gboolean       ac             = FALSE;    /*  active channel         */
+  gboolean       sel            = FALSE;
+  gboolean       alpha          = FALSE;    /*  alpha channel present  */
+  gboolean       indexed        = FALSE;    /*  is indexed             */
+  gboolean       lock_alpha     = FALSE;
+  gboolean       can_lock_alpha = FALSE;
+  gboolean       text_layer     = FALSE;
+  gboolean       writable       = FALSE;
+  GList         *next           = NULL;
+  GList         *next_visible   = NULL;
+  GList         *prev           = NULL;
 
   if (image)
     {
@@ -520,10 +521,11 @@ layers_actions_update (GimpActionGroup *group,
           GList *layer_list;
           GList *list;
 
-          mask       = gimp_layer_get_mask (layer);
-          lock_alpha = gimp_layer_get_lock_alpha (layer);
-          alpha      = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
-          writable   = ! gimp_item_get_lock_content (GIMP_ITEM (layer));
+          mask           = gimp_layer_get_mask (layer);
+          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));
 
           layer_list = gimp_item_get_container_iter (GIMP_ITEM (layer));
 
@@ -596,7 +598,7 @@ layers_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("layers-alpha-add",       writable && !fs && !alpha);
   SET_SENSITIVE ("layers-alpha-remove",    writable && !fs &&  alpha);
 
-  SET_SENSITIVE ("layers-lock-alpha", layer);
+  SET_SENSITIVE ("layers-lock-alpha", can_lock_alpha);
   SET_ACTIVE    ("layers-lock-alpha", lock_alpha);
 
   SET_SENSITIVE ("layers-mask-add",    layer    && !fs && !ac && !mask);
diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c
index 1be0a0f..beebd82 100644
--- a/app/actions/vectors-actions.c
+++ b/app/actions/vectors-actions.c
@@ -251,6 +251,7 @@ vectors_actions_update (GimpActionGroup *group,
   gboolean     visible    = FALSE;
   gboolean     linked     = FALSE;
   gboolean     locked     = FALSE;
+  gboolean     can_lock   = FALSE;
   gboolean     writable   = FALSE;
   GList       *next       = NULL;
   GList       *prev       = NULL;
@@ -272,6 +273,7 @@ vectors_actions_update (GimpActionGroup *group,
           visible  = gimp_item_get_visible (item);
           linked   = gimp_item_get_linked (item);
           locked   = gimp_item_get_lock_content (item);
+          can_lock = gimp_item_can_lock_content (item);
           writable = ! locked;
 
           vectors_list = gimp_item_get_container_iter (item);
@@ -312,7 +314,7 @@ vectors_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("vectors-visible",      vectors);
   SET_SENSITIVE ("vectors-linked",       vectors);
-  SET_SENSITIVE ("vectors-lock-content", vectors);
+  SET_SENSITIVE ("vectors-lock-content", can_lock);
 
   SET_ACTIVE ("vectors-visible",      visible);
   SET_ACTIVE ("vectors-linked",       linked);



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