[gegl] gegl: add gegl_operation_find_property



commit d1529ce2dbd2fe7da0ac648710891ca7cb4d0cf0
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Jan 20 16:52:42 2017 +0100

    gegl: add gegl_operation_find_property

 gegl/gegl-operations-util.h     |   11 +++++++++++
 gegl/operation/gegl-operation.c |   19 +++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-operations-util.h b/gegl/gegl-operations-util.h
index 2eac131..5571037 100644
--- a/gegl/gegl-operations-util.h
+++ b/gegl/gegl-operations-util.h
@@ -79,6 +79,17 @@ GParamSpec** gegl_operation_list_properties (const gchar   *operation_type,
 
 
 /**
+ * gegl_operation_find_property::
+ * @operation_type: the name of the operation type we want to locate a property on.
+ * @property_name: the name of the property we seek.
+ *
+ * Return value: The paramspec of the matching property - or NULL if there as
+ * no match.
+ */
+GParamSpec * gegl_operation_find_property (const gchar *operation_type,
+                                           const gchar *property_name);
+
+/**
  * gegl_operation_get_property_key:
  * @operation_type: the name of the operation type we want to query to property keys for.
  * @property_name: the property to query a key for.
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index ede7314..bf8cb2b 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -439,6 +439,25 @@ gegl_operation_list_properties (const gchar *operation_type,
   return pspecs;
 }
 
+GParamSpec *
+gegl_operation_find_property (const gchar *operation_type,
+                              const gchar *property_name)
+{
+  GParamSpec *ret = NULL;
+  GType         type;
+  GObjectClass *klass;
+
+  type = gegl_operation_gtype_from_name (operation_type);
+  if (!type)
+    return NULL;
+
+  klass  = g_type_class_ref (type);
+  ret = g_object_class_find_property (klass, property_name);
+  g_type_class_unref (klass);
+
+  return ret;
+}
+
 GeglNode *
 gegl_operation_detect (GeglOperation *operation,
                        gint           x,


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