[gimp] app: add gimp_drawable_has_filters()



commit bf6c3cb4ba16813ea660ffd04dbe5aa761cad1cd
Author: Michael Natterer <mitch gimp org>
Date:   Sat Aug 5 15:37:12 2017 +0200

    app: add gimp_drawable_has_filters()
    
    which returns TRUE if the drawable has any visible filter.

 app/core/gimpdrawable-filters.c |   20 ++++++++++++++++++++
 app/core/gimpdrawable-filters.h |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpdrawable-filters.c b/app/core/gimpdrawable-filters.c
index 3779d07..8c7ee14 100644
--- a/app/core/gimpdrawable-filters.c
+++ b/app/core/gimpdrawable-filters.c
@@ -48,6 +48,26 @@ gimp_drawable_get_filters (GimpDrawable *drawable)
   return drawable->private->filter_stack;
 }
 
+gboolean
+gimp_drawable_has_filters (GimpDrawable *drawable)
+{
+  GList *list;
+
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
+
+  for (list = GIMP_LIST (drawable->private->filter_stack)->queue->head;
+       list;
+       list = g_list_next (list))
+    {
+      GimpFilter *filter = list->data;
+
+      if (gimp_filter_is_visible (filter))
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
 void
 gimp_drawable_add_filter (GimpDrawable *drawable,
                           GimpFilter   *filter)
diff --git a/app/core/gimpdrawable-filters.h b/app/core/gimpdrawable-filters.h
index 870f020..7a2e722 100644
--- a/app/core/gimpdrawable-filters.h
+++ b/app/core/gimpdrawable-filters.h
@@ -23,6 +23,8 @@
 
 GimpContainer * gimp_drawable_get_filters   (GimpDrawable *drawable);
 
+gboolean        gimp_drawable_has_filters   (GimpDrawable *drawable);
+
 void            gimp_drawable_add_filter    (GimpDrawable *drawable,
                                              GimpFilter   *filter);
 void            gimp_drawable_remove_filter (GimpDrawable *drawable,


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