Author: abrander
Date: 2009-08-05 17:59:43 +0200 (Wed, 05 Aug 2009)
New Revision: 2604

Modified:
   trunk/librawstudio/rs-filter.c
   trunk/librawstudio/rs-filter.h
Log:
Added rs_filter_get_recursive().

Modified: trunk/librawstudio/rs-filter.c
===================================================================
--- trunk/librawstudio/rs-filter.c      2009-08-05 15:50:28 UTC (rev 2603)
+++ trunk/librawstudio/rs-filter.c      2009-08-05 15:59:43 UTC (rev 2604)
@@ -342,6 +342,44 @@
 }
 
 /**
+ * Get a GObject property from a RSFilter chain recursively
+ * @param filter A RSFilter
+ * @param ... Pairs of property names and a return pointers followed by NULL
+ */
+void
+rs_filter_get_recursive(RSFilter *filter, ...)
+{
+       va_list ap;
+       gchar *property_name;
+       gpointer property_ret;
+       RSFilter *current_filter;
+
+       g_assert(RS_IS_FILTER(filter));
+
+       va_start(ap, filter);
+
+       /* Loop through all properties */
+       while ((property_name = va_arg(ap, gchar *)))
+       {
+               property_ret = va_arg(ap, gpointer);
+
+               g_assert(property_ret != NULL);
+
+               current_filter = filter;
+               /* Iterate through all filter previous to filter */
+               do {
+                       if 
(g_object_class_find_property(G_OBJECT_GET_CLASS(current_filter), 
property_name))
+                       {
+                               g_object_get(current_filter, property_name, 
property_ret, NULL);
+                               break;
+                       }
+               } while (RS_IS_FILTER(current_filter = 
current_filter->previous));
+       }
+
+       va_end(ap);
+}
+
+/**
  * Set enabled state of a RSFilter
  * @param filter A RSFilter
  * @param enabled TRUE to enable filter, FALSE to disable

Modified: trunk/librawstudio/rs-filter.h
===================================================================
--- trunk/librawstudio/rs-filter.h      2009-08-05 15:50:28 UTC (rev 2603)
+++ trunk/librawstudio/rs-filter.h      2009-08-05 15:59:43 UTC (rev 2604)
@@ -166,6 +166,13 @@
 extern gint rs_filter_get_height(RSFilter *filter);
 
 /**
+ * Get a GObject property from a RSFilter chain recursively
+ * @param filter A RSFilter
+ * @param ... Pairs of property names and a return pointers followed by NULL
+ */
+extern void rs_filter_get_recursive(RSFilter *filter, ...);
+
+/**
  * Set enabled state of a RSFilter
  * @param filter A RSFilter
  * @param enabled TRUE to enable filter, FALSE to disable


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to