[gimp] app: remove a gimp_image_get_active_drawable() in select actions.



commit 74b4951e5039ec5e187f4bf62b1f4f7a708d91fa
Author: Jehan <jehan girinstud io>
Date:   Wed Oct 19 15:09:38 2022 +0200

    app: remove a gimp_image_get_active_drawable() in select actions.
    
    The action "select-float" should probably only work for a single selected
    drawable anyway since a floating selection can only be stacked on one drawable
    at a time.

 app/actions/select-actions.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c
index 38ac3fcd79..eb33dd588d 100644
--- a/app/actions/select-actions.c
+++ b/app/actions/select-actions.c
@@ -152,11 +152,8 @@ select_actions_update (GimpActionGroup *group,
                        gpointer         data)
 {
   GimpImage    *image    = action_data_get_image (data);
-  GimpDrawable *drawable = NULL;
   gboolean      fs       = FALSE;
   gboolean      sel      = FALSE;
-  gboolean      writable = FALSE;
-  gboolean      children = FALSE;
 
   GList        *drawables    = NULL;
   GList        *iter;
@@ -165,7 +162,6 @@ select_actions_update (GimpActionGroup *group,
 
   if (image)
     {
-      drawable = gimp_image_get_active_drawable (image);
       drawables = gimp_image_get_selected_drawables (image);
 
       for (iter = drawables; iter; iter = iter->next)
@@ -180,14 +176,6 @@ select_actions_update (GimpActionGroup *group,
             break;
         }
 
-      if (drawable)
-        {
-          writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL);
-
-          if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
-            children = TRUE;
-        }
-
       fs  = (gimp_image_get_floating_selection (image) != NULL);
       sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
     }
@@ -198,7 +186,9 @@ select_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("select-all",    image);
   SET_SENSITIVE ("select-none",   image && sel);
   SET_SENSITIVE ("select-invert", image);
-  SET_SENSITIVE ("select-float",  writable && !children && sel);
+  SET_SENSITIVE ("select-float",  g_list_length (drawables) == 1 && sel                 &&
+                                  ! gimp_item_is_content_locked (drawables->data, NULL) &&
+                                  ! gimp_viewable_get_children (drawables->data));
 
   SET_SENSITIVE ("select-feather", image && sel);
   SET_SENSITIVE ("select-sharpen", image && sel);


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