[gimp] app: add gimp_gegl_node_get_key()



commit bed825ab3d301b5e58976af85c23bdbd7ea99de1
Author: Ell <ell_se yahoo com>
Date:   Fri Jan 17 12:01:57 2020 +0200

    app: add gimp_gegl_node_get_key()
    
    ... which gets an operation-class key for the operation associated
    with the node, if any.

 app/gegl/gimp-gegl-utils.c | 16 ++++++++++++++++
 app/gegl/gimp-gegl-utils.h | 45 ++++++++++++++++++++++++---------------------
 2 files changed, 40 insertions(+), 21 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index c2d5c15cbe..6bfed25ee8 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -170,6 +170,22 @@ gimp_gegl_node_is_area_filter_operation (GeglNode *node)
          GEGL_IS_OPERATION_META (operation);
 }
 
+const gchar *
+gimp_gegl_node_get_key (GeglNode    *node,
+                        const gchar *key)
+{
+  const gchar *operation_name;
+
+  g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
+
+  operation_name = gegl_node_get_operation (node);
+
+  if (operation_name)
+    return gegl_operation_get_key (operation_name, key);
+  else
+    return NULL;
+}
+
 const Babl *
 gimp_gegl_node_get_format (GeglNode    *node,
                            const gchar *pad_name)
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index a219736e18..5d19c0184f 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -22,35 +22,38 @@
 #define __GIMP_GEGL_UTILS_H__
 
 
-GType        gimp_gegl_get_op_enum_type              (const gchar         *operation,
-                                                      const gchar         *property);
+GType         gimp_gegl_get_op_enum_type              (const gchar         *operation,
+                                                       const gchar         *property);
 
-GeglColor  * gimp_gegl_color_new                     (const GimpRGB       *rgb,
-                                                      const Babl          *space);
+GeglColor   * gimp_gegl_color_new                     (const GimpRGB       *rgb,
+                                                       const Babl          *space);
 
-void         gimp_gegl_progress_connect              (GeglNode            *node,
-                                                      GimpProgress        *progress,
-                                                      const gchar         *text);
+void          gimp_gegl_progress_connect              (GeglNode            *node,
+                                                       GimpProgress        *progress,
+                                                       const gchar         *text);
 
-gboolean     gimp_gegl_node_is_source_operation      (GeglNode            *node);
-gboolean     gimp_gegl_node_is_point_operation       (GeglNode            *node);
-gboolean     gimp_gegl_node_is_area_filter_operation (GeglNode            *node);
+gboolean      gimp_gegl_node_is_source_operation      (GeglNode            *node);
+gboolean      gimp_gegl_node_is_point_operation       (GeglNode            *node);
+gboolean      gimp_gegl_node_is_area_filter_operation (GeglNode            *node);
 
-const Babl * gimp_gegl_node_get_format               (GeglNode            *node,
-                                                      const gchar         *pad_name);
+const gchar * gimp_gegl_node_get_key                  (GeglNode            *node,
+                                                      const gchar          *key);
 
-void         gimp_gegl_node_set_underlying_operation (GeglNode           *node,
-                                                      GeglNode           *operation);
-GeglNode   * gimp_gegl_node_get_underlying_operation (GeglNode           *node);
+const Babl  * gimp_gegl_node_get_format               (GeglNode            *node,
+                                                       const gchar         *pad_name);
 
-gboolean     gimp_gegl_param_spec_has_key            (GParamSpec          *pspec,
-                                                      const gchar         *key,
-                                                      const gchar         *value);
+void          gimp_gegl_node_set_underlying_operation (GeglNode           *node,
+                                                       GeglNode           *operation);
+GeglNode    * gimp_gegl_node_get_underlying_operation (GeglNode           *node);
 
-GeglBuffer * gimp_gegl_buffer_dup                    (GeglBuffer          *buffer);
+gboolean      gimp_gegl_param_spec_has_key            (GParamSpec          *pspec,
+                                                       const gchar         *key,
+                                                       const gchar         *value);
 
-gboolean     gimp_gegl_buffer_set_extent             (GeglBuffer          *buffer,
-                                                      const GeglRectangle *extent);
+GeglBuffer  * gimp_gegl_buffer_dup                    (GeglBuffer          *buffer);
+
+gboolean      gimp_gegl_buffer_set_extent             (GeglBuffer          *buffer,
+                                                       const GeglRectangle *extent);
 
 
 #endif /* __GIMP_GEGL_UTILS_H__ */


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