[gimp] app: remove the "exclude" paameter from gimp_image_item_list_get_list()



commit 3d7af8a184e06f2766f5584a22b46cc4bd7d7569
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jun 28 23:48:47 2015 +0200

    app: remove the "exclude" paameter from gimp_image_item_list_get_list()
    
    and from gimp_image_item_list_filter(). After the fixes for bug 735906
    it's no longer needed, and it was harmful.

 app/core/gimpimage-item-list.c    |   19 +++++--------------
 app/core/gimpimage-item-list.h    |    4 +---
 app/core/gimpimage-resize.c       |    2 +-
 app/core/gimpimage.c              |    4 ++--
 app/core/gimpitem-linked.c        |   25 ++++++++++++-------------
 app/tools/gimpeditselectiontool.c |   28 ++++++++++++----------------
 6 files changed, 33 insertions(+), 49 deletions(-)
---
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index cd31d6a..918c651 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -153,18 +153,16 @@ gimp_image_item_list_transform (GimpImage              *image,
 /**
  * gimp_image_item_list_get_list:
  * @image:   An @image.
- * @exclude: An item to exclude.
  * @type:    Which type of items to return.
  * @set:     Set the returned items are part of.
  *
  * This function returns a #GList of #GimpItem<!-- -->s for which the
  * @type and @set criterions match.
  *
- * Return value: The list of items, excluding @exclude.
+ * Return value: The list of items.
  **/
 GList *
 gimp_image_item_list_get_list (const GimpImage  *image,
-                               const GimpItem   *exclude,
                                GimpItemTypeMask  type,
                                GimpItemSet       set)
 {
@@ -173,7 +171,6 @@ gimp_image_item_list_get_list (const GimpImage  *image,
   GList *return_list = NULL;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
-  g_return_val_if_fail (exclude == NULL || GIMP_IS_ITEM (exclude), NULL);
 
   if (type & GIMP_ITEM_TYPE_LAYERS)
     {
@@ -183,7 +180,7 @@ gimp_image_item_list_get_list (const GimpImage  *image,
         {
           GimpItem *item = list->data;
 
-          if (item != exclude && gimp_item_is_in_set (item, set))
+          if (gimp_item_is_in_set (item, set))
             return_list = g_list_prepend (return_list, item);
         }
 
@@ -198,7 +195,7 @@ gimp_image_item_list_get_list (const GimpImage  *image,
         {
           GimpItem *item = list->data;
 
-          if (item != exclude && gimp_item_is_in_set (item, set))
+          if (gimp_item_is_in_set (item, set))
             return_list = g_list_prepend (return_list, item);
         }
 
@@ -213,7 +210,7 @@ gimp_image_item_list_get_list (const GimpImage  *image,
         {
           GimpItem *item = list->data;
 
-          if (item != exclude && gimp_item_is_in_set (item, set))
+          if (gimp_item_is_in_set (item, set))
             return_list = g_list_prepend (return_list, item);
         }
 
@@ -246,19 +243,13 @@ gimp_image_item_list_remove_children (GList          *list,
 }
 
 GList *
-gimp_image_item_list_filter (const GimpItem *exclude,
-                             GList          *list)
+gimp_image_item_list_filter (GList *list)
 {
   GList *l;
 
-  g_return_val_if_fail (exclude == NULL || GIMP_IS_ITEM (exclude), NULL);
-
   if (! list)
     return NULL;
 
-  if (exclude)
-    list = gimp_image_item_list_remove_children (list, exclude);
-
   for (l = list; l; l = g_list_next (l))
     {
       GimpItem *item = l->data;
diff --git a/app/core/gimpimage-item-list.h b/app/core/gimpimage-item-list.h
index 85d52ec..7ebc832 100644
--- a/app/core/gimpimage-item-list.h
+++ b/app/core/gimpimage-item-list.h
@@ -47,12 +47,10 @@ void    gimp_image_item_list_transform (GimpImage              *image,
                                         GimpProgress           *progress);
 
 GList * gimp_image_item_list_get_list  (const GimpImage        *image,
-                                        const GimpItem         *exclude,
                                         GimpItemTypeMask        type,
                                         GimpItemSet             set);
 
-GList * gimp_image_item_list_filter    (const GimpItem         *exclude,
-                                        GList                  *list);
+GList * gimp_image_item_list_filter    (GList                  *list);
 
 
 #endif /* __GIMP_IMAGE_ITEM_LIST_H__ */
diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c
index 91aa38d..a7c83e7 100644
--- a/app/core/gimpimage-resize.c
+++ b/app/core/gimpimage-resize.c
@@ -89,7 +89,7 @@ gimp_image_resize_with_layers (GimpImage    *image,
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_RESIZE,
                                C_("undo-type", "Resize Image"));
 
-  resize_layers = gimp_image_item_list_get_list (image, NULL,
+  resize_layers = gimp_image_item_list_get_list (image,
                                                  GIMP_ITEM_TYPE_LAYERS,
                                                  layer_set);
 
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 19fa26b..bc71db7 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1706,12 +1706,12 @@ gimp_image_estimate_memsize (const GimpImage   *image,
   current_size   = gimp_object_get_memsize (GIMP_OBJECT (image), NULL);
 
   /*  the part of the image's memsize that scales linearly with the image  */
-  drawables = gimp_image_item_list_get_list (image, NULL,
+  drawables = gimp_image_item_list_get_list (image,
                                              GIMP_ITEM_TYPE_LAYERS |
                                              GIMP_ITEM_TYPE_CHANNELS,
                                              GIMP_ITEM_SET_ALL);
 
-  gimp_image_item_list_filter (NULL, drawables);
+  gimp_image_item_list_filter (drawables);
 
   drawables = g_list_prepend (drawables, gimp_image_get_mask (image));
 
diff --git a/app/core/gimpitem-linked.c b/app/core/gimpitem-linked.c
index 0a3fc03..f3191ee 100644
--- a/app/core/gimpitem-linked.c
+++ b/app/core/gimpitem-linked.c
@@ -47,11 +47,11 @@ gimp_item_linked_is_locked (const GimpItem *item)
   g_return_val_if_fail (gimp_item_get_linked (item) == TRUE, FALSE);
   g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
 
-  list = gimp_image_item_list_get_list (gimp_item_get_image (item), item,
+  list = gimp_image_item_list_get_list (gimp_item_get_image (item),
                                         GIMP_ITEM_TYPE_ALL,
                                         GIMP_ITEM_SET_LINKED);
 
-  list = gimp_image_item_list_filter (item, list);
+  list = gimp_image_item_list_filter (list);
 
   for (l = list; l && ! locked; l = g_list_next (l))
     {
@@ -89,11 +89,11 @@ gimp_item_linked_translate (GimpItem *item,
 
   image = gimp_item_get_image (item);
 
-  items = gimp_image_item_list_get_list (image, NULL,
+  items = gimp_image_item_list_get_list (image,
                                          GIMP_ITEM_TYPE_ALL,
                                          GIMP_ITEM_SET_LINKED);
 
-  items = gimp_image_item_list_filter (NULL, items);
+  items = gimp_image_item_list_filter (items);
 
   gimp_image_item_list_translate (gimp_item_get_image (item), items,
                                   offset_x, offset_y, push_undo);
@@ -118,10 +118,10 @@ gimp_item_linked_flip (GimpItem            *item,
 
   image = gimp_item_get_image (item);
 
-  items = gimp_image_item_list_get_list (image, NULL,
+  items = gimp_image_item_list_get_list (image,
                                          GIMP_ITEM_TYPE_ALL,
                                          GIMP_ITEM_SET_LINKED);
-  items = gimp_image_item_list_filter (NULL, items);
+  items = gimp_image_item_list_filter (items);
 
   gimp_image_item_list_flip (image, items, context,
                              flip_type, axis, clip_result);
@@ -148,16 +148,16 @@ gimp_item_linked_rotate (GimpItem         *item,
 
   image = gimp_item_get_image (item);
 
-  items = gimp_image_item_list_get_list (image, NULL,
+  items = gimp_image_item_list_get_list (image,
                                          GIMP_ITEM_TYPE_LAYERS |
                                          GIMP_ITEM_TYPE_VECTORS,
                                          GIMP_ITEM_SET_LINKED);
-  items = gimp_image_item_list_filter (NULL, items);
+  items = gimp_image_item_list_filter (items);
 
-  channels = gimp_image_item_list_get_list (image, NULL,
+  channels = gimp_image_item_list_get_list (image,
                                             GIMP_ITEM_TYPE_CHANNELS,
                                             GIMP_ITEM_SET_LINKED);
-  channels = gimp_image_item_list_filter (NULL, channels);
+  channels = gimp_image_item_list_filter (channels);
 
   if (items && channels)
     gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
@@ -195,11 +195,10 @@ gimp_item_linked_transform (GimpItem               *item,
 
   image = gimp_item_get_image (item);
 
-  items = gimp_image_item_list_get_list (image, NULL,
+  items = gimp_image_item_list_get_list (image,
                                          GIMP_ITEM_TYPE_ALL,
                                          GIMP_ITEM_SET_LINKED);
-
-  items = gimp_image_item_list_filter (NULL, items);
+  items = gimp_image_item_list_filter (items);
 
   gimp_image_item_list_transform (image, items, context,
                                   matrix, direction,
diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c
index 5f25991..3992058 100644
--- a/app/tools/gimpeditselectiontool.c
+++ b/app/tools/gimpeditselectiontool.c
@@ -336,11 +336,10 @@ gimp_edit_selection_tool_start (GimpTool          *parent_tool,
             GList *linked;
             GList *list;
 
-            linked = gimp_image_item_list_get_list (image, NULL,
+            linked = gimp_image_item_list_get_list (image,
                                                     GIMP_ITEM_TYPE_LAYERS,
                                                     GIMP_ITEM_SET_LINKED);
-
-            linked = gimp_image_item_list_filter (NULL, linked);
+            linked = gimp_image_item_list_filter (linked);
 
             for (list = linked; list; list = g_list_next (list))
               {
@@ -377,11 +376,10 @@ gimp_edit_selection_tool_start (GimpTool          *parent_tool,
               GList *linked;
               GList *list;
 
-              linked = gimp_image_item_list_get_list (image, NULL,
+              linked = gimp_image_item_list_get_list (image,
                                                       GIMP_ITEM_TYPE_VECTORS,
                                                       GIMP_ITEM_SET_LINKED);
-
-              linked = gimp_image_item_list_filter (NULL, linked);
+              linked = gimp_image_item_list_filter (linked);
 
               for (list = linked; list; list = g_list_next (list))
                 {
@@ -425,19 +423,19 @@ gimp_edit_selection_tool_start (GimpTool          *parent_tool,
         case GIMP_TRANSLATE_MODE_LAYER:
         case GIMP_TRANSLATE_MODE_VECTORS:
           edit_select->live_items =
-            gimp_image_item_list_get_list (image, NULL,
+            gimp_image_item_list_get_list (image,
                                            GIMP_ITEM_TYPE_LAYERS |
                                            GIMP_ITEM_TYPE_VECTORS,
                                            GIMP_ITEM_SET_LINKED);
           edit_select->live_items =
-            gimp_image_item_list_filter (NULL, edit_select->live_items);
+            gimp_image_item_list_filter (edit_select->live_items);
 
           edit_select->delayed_items =
-            gimp_image_item_list_get_list (image, NULL,
+            gimp_image_item_list_get_list (image,
                                            GIMP_ITEM_TYPE_CHANNELS,
                                            GIMP_ITEM_SET_LINKED);
           edit_select->delayed_items =
-            gimp_image_item_list_filter (NULL, edit_select->delayed_items);
+            gimp_image_item_list_filter (edit_select->delayed_items);
           break;
 
         default:
@@ -823,11 +821,10 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
             GList *linked;
             GList *list;
 
-            linked = gimp_image_item_list_get_list (image, NULL,
+            linked = gimp_image_item_list_get_list (image,
                                                     GIMP_ITEM_TYPE_LAYERS,
                                                     GIMP_ITEM_SET_LINKED);
-
-            linked = gimp_image_item_list_filter (NULL, linked);
+            linked = gimp_image_item_list_filter (linked);
 
             for (list = linked; list; list = g_list_next (list))
               {
@@ -868,11 +865,10 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
             GList *linked;
             GList *list;
 
-            linked = gimp_image_item_list_get_list (image, NULL,
+            linked = gimp_image_item_list_get_list (image,
                                                     GIMP_ITEM_TYPE_VECTORS,
                                                     GIMP_ITEM_SET_LINKED);
-
-            linked = gimp_image_item_list_filter (NULL, linked);
+            linked = gimp_image_item_list_filter (linked);
 
             for (list = linked; list; list = g_list_next (list))
               {


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