[gegl/soc-2012-ville: 12/14] add links to example images in operations.html generation
- From: Ville Sokk <villesokk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2012-ville: 12/14] add links to example images in operations.html generation
- Date: Wed, 11 Jul 2012 09:37:58 +0000 (UTC)
commit 274fe960c475d335fb801c76d33eb67b47f82a58
Author: Ville Sokk <ville sokk gmail com>
Date: Wed Jul 11 12:28:46 2012 +0300
add links to example images in operations.html generation
tools/operation_reference.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/tools/operation_reference.c b/tools/operation_reference.c
index d9687a6..0225431 100644
--- a/tools/operation_reference.c
+++ b/tools/operation_reference.c
@@ -289,6 +289,23 @@ static void category_menu_index (gpointer key,
}
}
+/* convert operation name to path of example image */
+static gchar*
+operation_to_path (const gchar *op_name)
+{
+ gchar *cleaned = g_strdup (op_name);
+ gchar *filename, *output_path;
+
+ g_strdelimit (cleaned, ":", '-');
+ filename = g_strconcat (cleaned, ".png", NULL);
+ output_path = g_build_path (G_DIR_SEPARATOR_S, "images", "examples", filename, NULL);
+
+ g_free (cleaned);
+ g_free (filename);
+
+ return output_path;
+}
+
gint
main (gint argc,
gchar **argv)
@@ -364,12 +381,26 @@ main (gint argc,
GeglOperationClass *klass = iter->data;
const char *categoris = gegl_operation_class_get_key (klass, "categories");
const char *description = gegl_operation_class_get_key (klass, "description");
+ const char *name = gegl_operation_class_get_key (klass, "name");
+
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 (name)
+ {
+ char *image = operation_to_path (name);
+
+ if (g_file_test (image, G_FILE_TEST_EXISTS))
+ g_print ("<tr>\n <td colspan='1'> </td>\n <td colspan='4'><a href='%s'>Example image</a></td>\n</tr>\n", image);
+
+ g_free (image);
+ }
+
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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]