diff options
author | Øyvind Kolås <pippin@gimp.org> | 2012-03-29 17:56:47 +0100 |
---|---|---|
committer | Øyvind Kolås <pippin@gimp.org> | 2012-03-29 21:05:50 +0100 |
commit | 1b7ea4207c78d46d87598a0765f093412e1694fe (patch) | |
tree | 18aa0bca2066bc9f4e91eff1d2a2ca39e7c4f241 /tools | |
parent | 8048343ecd147b23c0b5033f53f4c22207cd509e (diff) |
operation: massive refactoring of how operation meta data is handled
Operations can now hold arbitrary string based key/value pairs, this
permits dynamically extending what is stored without needing to break
API/ABI, it also means we can encode things like gimp menu paths or
similar.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/operation_reference.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/operation_reference.c b/tools/operation_reference.c index 07611383..848fbec1 100644 --- a/tools/operation_reference.c +++ b/tools/operation_reference.c @@ -259,7 +259,8 @@ static void category_index (gpointer key, for (iter=operations, comma=FALSE;iter;iter = g_list_next (iter)) { GeglOperationClass *klass = iter->data; - if (strstr (klass->categories, "hidden")) + const char *categories = gegl_operation_class_get_key (klass, "categories"); + if (strstr (categories, "hidden")) continue; g_print ("%s<a href='#op_%s'>%s</a>\n", comma?"":"", klass->name, klass->name); comma = TRUE; @@ -280,7 +281,8 @@ static void category_menu_index (gpointer key, for (iter=operations;iter;iter = g_list_next (iter)) { GeglOperationClass *klass = iter->data; - if (strstr (klass->categories, "hidden")) + const char *categories = gegl_operation_class_get_key (klass, "categories"); + if (!categories || strstr (categories, "hidden")) continue; g_print ("<li><a href='#op_%s'>%s</a></li>\n", klass->name, klass->name); } @@ -303,8 +305,9 @@ main (gint argc, for (iter=operations;iter;iter = g_list_next (iter)) { GeglOperationClass *klass = iter->data; - const gchar *ptr = klass->categories; - while (*ptr) + const char *categoris = gegl_operation_class_get_key (klass, "categories"); + const gchar *ptr = categoris; + while (ptr && *ptr) { gchar category[64]=""; gint i=0; @@ -358,12 +361,14 @@ main (gint argc, for (iter=operations;iter;iter = g_list_next (iter)) { GeglOperationClass *klass = iter->data; - if (strstr (klass->categories, "hidden")) + const char *categoris = gegl_operation_class_get_key (klass, "categories"); + const char *description = gegl_operation_class_get_key (klass, "description"); + if (categoris && strstr (categoris, "hidden")) continue; g_print ("<tr>\n <td colspan='1'> </td>\n <td class='op_name' colspan='4'><a name='op_%s'>%s</a></td>\n</tr>\n", klass->name, klass->name); - if (klass->description) - g_print ("<tr>\n <td colspan='1'> </td>\n <td class='op_description' colspan='4'>%s</td>\n</tr>\n", klass->description); + if (description) + g_print ("<tr>\n <td colspan='1'> </td>\n <td class='op_description' colspan='4'>%s</td>\n</tr>\n", description); list_properties (G_OBJECT_CLASS_TYPE (klass), 2, TRUE); } g_print ("</table>\n"); |