[gegl] gegl: make enum value names to be human-readable, translatable strings
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: make enum value names to be human-readable, translatable strings
- Date: Sun, 25 May 2014 22:48:47 +0000 (UTC)
commit fac7113537b7ba46fee49199b3bc00101987d651
Author: Michael Natterer <mitch gimp org>
Date: Mon May 26 00:44:03 2014 +0200
gegl: make enum value names to be human-readable, translatable strings
Don't generate gegl-enums.c with glib-mkenums. Instead manually
maintain it and add the same translation logic as in gegl-op.h
gegl/Makefile.am | 18 ------------------
gegl/gegl-enums.h | 42 ++++++++++++++++++++++++++----------------
po/POTFILES.in | 1 +
3 files changed, 27 insertions(+), 34 deletions(-)
---
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index 19ca064..67c4529 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -170,21 +170,3 @@ endif # HAVE_VALA
EXTRA_DIST += gegl- GEGL_API_VERSION@.deps
endif # HAVE_INTROSPECTION
-
-#
-# rules to generate built sources
-#
-# setup autogeneration dependencies
-gen_sources = xgen-tec
-CLEANFILES += $(gen_sources)
-
-gegl-enums.c: $(srcdir)/gegl-enums.h
- glib-mkenums \
- --fhead "/* This is a generated file, do not edit directly */\n\n#include
\"config.h\"\n#include <glib-object.h>\n#include \"gegl-enums.h\"" \
- --fprod "\n/* enumerations from \"@filename \" */" \
- --vhead "GType\n enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0)
{\n static const G Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName
\", values);\n }\n return etype;\n}\n\n" \
- $(srcdir)/gegl-enums.h > xgen-tec \
- && cp xgen-tec $(@F) \
- && rm -f xgen-tec
diff --git a/gegl/gegl-enums.h b/gegl/gegl-enums.h
index 555cea9..c0470fc 100644
--- a/gegl/gegl-enums.h
+++ b/gegl/gegl-enums.h
@@ -17,13 +17,18 @@
*
*/
-/* This file hold public enum from GEGL. A proper registration for them is
- * generated automatically with glib-mkenums.
+/* This file holds public enums from GEGL
*
- * TODO: currently, description are not supported by glib-mkenums, and therefore
- * an often ugly name is generated, and i18n is not supported.
- * gimp-mkenums support these description, with a custom system to allow i18n,
- * so it could be a way to achieve this.
+ * !!!!!!!!!!!! NOTE !!!!!!!!!!!!!!
+ *
+ * Normally, gegl-enums.c file would be be generated my glib-mkenums,
+ * but we use the enum values' registered names for translatable,
+ * human readable labels for the GUI, so gegl-enums.c is maintained
+ * manually.
+ *
+ * DON'T FORGET TO UPDATE gegl-enums.c AFTER CHANGING THIS HEADER
+ *
+ * !!!!!!!!!!!! NOTE !!!!!!!!!!!!!!
*/
#ifndef __GEGL_ENUMS_H__
@@ -32,25 +37,30 @@
G_BEGIN_DECLS
typedef enum {
- GEGL_SAMPLER_NEAREST = 0, /*< desc="nearest" >*/
- GEGL_SAMPLER_LINEAR, /*< desc="linear" >*/
- GEGL_SAMPLER_CUBIC, /*< desc="cubic" >*/
- GEGL_SAMPLER_NOHALO, /*< desc="nohalo" >*/
- GEGL_SAMPLER_LOHALO /*< desc="lohalo" >*/
-} GeglSamplerType;
-GType gegl_sampler_type_get_type (void) G_GNUC_CONST;
-#define GEGL_TYPE_SAMPLER_TYPE (gegl_sampler_type_get_type())
-
-typedef enum {
GEGL_ABYSS_NONE,
GEGL_ABYSS_CLAMP,
GEGL_ABYSS_LOOP,
GEGL_ABYSS_BLACK,
GEGL_ABYSS_WHITE
} GeglAbyssPolicy;
+
GType gegl_abyss_policy_get_type (void) G_GNUC_CONST;
+
#define GEGL_TYPE_ABYSS_POLICY (gegl_abyss_policy_get_type())
+
+typedef enum {
+ GEGL_SAMPLER_NEAREST,
+ GEGL_SAMPLER_LINEAR,
+ GEGL_SAMPLER_CUBIC,
+ GEGL_SAMPLER_NOHALO,
+ GEGL_SAMPLER_LOHALO
+} GeglSamplerType;
+
+GType gegl_sampler_type_get_type (void) G_GNUC_CONST;
+
+#define GEGL_TYPE_SAMPLER_TYPE (gegl_sampler_type_get_type())
+
G_END_DECLS
#endif /* __GEGL_ENUMS_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6f7047a..d88997f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,7 @@
[encoding: UTF-8]
bin/gegl.c
bin/gegl-options.c
+gegl/gegl-enums.c
gegl/gegl-init.c
gegl/module/geglmodule.c
operations/common/alien-map.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]