[gimp] app: get rid of last remnants of single-layer logics in edit-actions.



commit 5eec3e345714685943c7ec3a9b601af216e3ed3b
Author: Jehan <jehan girinstud io>
Date:   Fri Jul 31 21:06:10 2020 +0200

    app: get rid of last remnants of single-layer logics in edit-actions.
    
    edit-cut and edit-named-* implementations were already multi-layer
    aware. Making them sensitive appropriately was the only missing part.

 app/actions/edit-actions.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index da50ef1210..59ee225fc0 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -287,12 +287,9 @@ edit_actions_update (GimpActionGroup *group,
 {
   GimpImage    *image        = action_data_get_image (data);
   GimpDisplay  *display      = action_data_get_display (data);
-  GimpDrawable *drawable     = NULL;
   GList        *drawables    = NULL;
   gchar        *undo_name    = NULL;
   gchar        *redo_name    = NULL;
-  gboolean      writable     = FALSE;
-  gboolean      children     = FALSE;
   gboolean      undo_enabled = FALSE;
 
   gboolean      have_no_groups = FALSE; /* At least 1 selected layer is not a group.         */
@@ -303,7 +300,6 @@ edit_actions_update (GimpActionGroup *group,
       GList *iter;
 
       drawables = gimp_image_get_selected_drawables (image);
-      drawable = gimp_image_get_active_drawable (image);
 
       for (iter = drawables; iter; iter = iter->next)
         {
@@ -317,14 +313,6 @@ edit_actions_update (GimpActionGroup *group,
             break;
         }
 
-      if (drawable)
-        {
-          writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable));
-
-          if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
-            children = TRUE;
-        }
-
       undo_enabled = gimp_image_undo_is_enabled (image);
 
       if (undo_enabled)
@@ -374,7 +362,7 @@ edit_actions_update (GimpActionGroup *group,
   g_free (undo_name);
   g_free (redo_name);
 
-  SET_SENSITIVE ("edit-cut",                         writable && !children);
+  SET_SENSITIVE ("edit-cut",                         have_writable && have_no_groups);
   SET_SENSITIVE ("edit-copy",                        drawables);
   SET_SENSITIVE ("edit-copy-visible",                image);
   /*             "edit-paste" is always active */
@@ -384,9 +372,9 @@ edit_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("edit-paste-as-new-layer",          image);
   SET_SENSITIVE ("edit-paste-as-new-layer-in-place", image);
 
-  SET_SENSITIVE ("edit-named-cut",          writable && !children);
-  SET_SENSITIVE ("edit-named-copy",         drawable);
-  SET_SENSITIVE ("edit-named-copy-visible", drawable);
+  SET_SENSITIVE ("edit-named-cut",          have_writable && have_no_groups);
+  SET_SENSITIVE ("edit-named-copy",         drawables);
+  SET_SENSITIVE ("edit-named-copy-visible", drawables);
   /*             "edit-named-paste" is always active */
 
   SET_SENSITIVE ("edit-clear",              have_writable && have_no_groups);


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