[gegl] operation: Exclude compat_names in the output of gegl_list_operations



commit 9990ac5b4f176ac958eeca2313f6fcc21c2c2ab4
Author: Michael Henning <drawoc darkrefraction com>
Date:   Sun Sep 1 11:41:03 2013 -0400

    operation: Exclude compat_names in the output of gegl_list_operations

 gegl/gegl.h                      |    9 ++++++---
 gegl/operation/gegl-operation.c  |    4 ++--
 gegl/operation/gegl-operations.c |    5 +++--
 gegl/operation/gegl-operations.h |    3 ++-
 4 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gegl/gegl.h b/gegl/gegl.h
index e2605b7..7f65bb3 100644
--- a/gegl/gegl.h
+++ b/gegl/gegl.h
@@ -126,8 +126,10 @@ void           gegl_exit                 (void);
  * gegl_list_operations:
  * @n_operations_p: (out caller-allocates): return location for number of operations.
  *
- * Return value: (transfer container) (array length=n_operations_p): An alphabetically sorted array of 
available operation names. The
- * list should be freed with g_free after use.
+ * Return value: (transfer container) (array length=n_operations_p): An
+ * alphabetically sorted array of available operation names. This excludes any
+ * compat-name registered by operations. The list should be freed with g_free
+ * after use.
  * ---
  * gchar **operations;
  * guint   n_operations;
@@ -147,7 +149,8 @@ gchar        **gegl_list_operations         (guint *n_operations_p);
  * gegl_has_operation:
  * @operation_type: the name of the operation
  *
- * Return value: A boolean telling whether the operation is present or not.
+ * Return value: A boolean telling whether the operation is present or not. This
+ * also returns true for any compat-name registered by operations.
  */
 
 gboolean       gegl_has_operation           (const gchar *operation_type);
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index 03d51e5..3ff4212 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -669,14 +669,14 @@ gegl_operation_class_set_key (GeglOperationClass *klass,
       else
         {
           klass->name = key_value_dup;
-          gegl_operation_class_register_name (klass, key_value);
+          gegl_operation_class_register_name (klass, key_value, FALSE);
         }
     }
 
   if (!strcmp (key_name, "compat-name"))
     {
       klass->compat_name = key_value_dup;
-      gegl_operation_class_register_name (klass, key_value);
+      gegl_operation_class_register_name (klass, key_value, TRUE);
     }
 
   g_hash_table_insert (klass->keys, g_strdup (key_name),
diff --git a/gegl/operation/gegl-operations.c b/gegl/operation/gegl-operations.c
index 62047a8..195b634 100644
--- a/gegl/operation/gegl-operations.c
+++ b/gegl/operation/gegl-operations.c
@@ -41,7 +41,8 @@ G_LOCK_DEFINE_STATIC (gtype_hash);
 
 void
 gegl_operation_class_register_name (GeglOperationClass *klass,
-                                    const gchar        *name)
+                                    const gchar        *name,
+                                    const gboolean      is_compat)
 {
   GType this_type, check_type;
   this_type = G_TYPE_FROM_CLASS (klass);
@@ -58,7 +59,7 @@ gegl_operation_class_register_name (GeglOperationClass *klass,
     }
   g_hash_table_insert (gtype_hash, g_strdup (name), (gpointer) this_type);
 
-  if (!check_type)
+  if (!check_type && !is_compat)
     operations_list = g_slist_insert_sorted (operations_list, (gpointer) name,
                                              (GCompareFunc) strcmp);
 
diff --git a/gegl/operation/gegl-operations.h b/gegl/operation/gegl-operations.h
index 58c373a..dc9b5c3 100644
--- a/gegl/operation/gegl-operations.h
+++ b/gegl/operation/gegl-operations.h
@@ -31,6 +31,7 @@ void       gegl_operation_gtype_init        (void);
 void       gegl_operation_gtype_cleanup     (void);
 
 void       gegl_operation_class_register_name (GeglOperationClass *klass,
-                                               const gchar        *name);
+                                               const gchar        *name,
+                                               const gboolean      is_compat);
 
 #endif


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