[gimp] app: remove one more gimp_image_get_active_drawable().



commit 6716d06aa157e6707cac92ae8638ff61af24509a
Author: Jehan <jehan girinstud io>
Date:   Tue Oct 18 22:36:24 2022 +0200

    app: remove one more gimp_image_get_active_drawable().
    
    Actions "vectors-fill*" and "vectors-stroke*" require a single drawable to paint
    to. So action logic is unchange. I only replace gimp_image_get_active_drawable()
    by gimp_image_get_selected_drawables() and counting the drawables.

 app/actions/vectors-actions.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c
index f133598208..49f8341458 100644
--- a/app/actions/vectors-actions.c
+++ b/app/actions/vectors-actions.c
@@ -361,7 +361,6 @@ vectors_actions_update (GimpActionGroup *group,
   GList        *selected_vectors   = NULL;
   gint          n_selected_vectors = 0;
 
-  GimpDrawable *drawable      = NULL;
   gint          n_vectors     = 0;
   gboolean      mask_empty    = TRUE;
   gboolean      dr_writable   = FALSE;
@@ -372,6 +371,7 @@ vectors_actions_update (GimpActionGroup *group,
 
   if (image)
     {
+      GList *drawables;
       GList *iter;
 
       n_vectors  = gimp_image_get_n_vectors (image);
@@ -401,15 +401,17 @@ vectors_actions_update (GimpActionGroup *group,
             break;
         }
 
-      drawable = gimp_image_get_active_drawable (image);
+      drawables = gimp_image_get_selected_drawables (image);
 
-      if (drawable)
+      if (g_list_length (drawables) == 1)
         {
-          dr_writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawable), NULL);
+          dr_writable = ! gimp_item_is_content_locked (GIMP_ITEM (drawables->data), NULL);
 
-          if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+          if (gimp_viewable_get_children (GIMP_VIEWABLE (drawables->data)))
             dr_children = TRUE;
         }
+
+      g_list_free (drawables);
     }
 
 #define SET_SENSITIVE(action,condition) \


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