[gegl/gegl-0-2] gegl: do not generate gegl-enums.c



commit c0833baa71b3b28f06b6bc893a3e778d45f82c37
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun May 13 13:21:37 2018 +0200

    gegl: do not generate gegl-enums.c
    
    Fixing bug 796051

 gegl/.gitignore   |    1 -
 gegl/Makefile.am  |   11 -------
 gegl/gegl-enums.c |   82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 12 deletions(-)
---
diff --git a/gegl/.gitignore b/gegl/.gitignore
index c0f3159..0d31cdb 100644
--- a/gegl/.gitignore
+++ b/gegl/.gitignore
@@ -11,4 +11,3 @@
 /*.vapi
 /*.deps
 /*.metadata
-/gegl-enums.c
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index b5120ea..239ff84 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -156,14 +156,3 @@ endif # HAVE_INTROSPECTION
 # 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@, \"@valuenick@\", \"@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.c b/gegl/gegl-enums.c
new file mode 100644
index 0000000..deef013
--- /dev/null
+++ b/gegl/gegl-enums.c
@@ -0,0 +1,82 @@
+/* This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+#include <glib/gi18n-lib.h>
+
+#include "gegl-enums.h"
+
+
+GType
+gegl_abyss_policy_get_type (void)
+{
+  static GType etype = 0;
+
+  if (etype == 0)
+    {
+      static GEnumValue values[] = {
+        { GEGL_ABYSS_NONE,  N_("None"),  "none"  },
+        { GEGL_ABYSS_CLAMP, N_("Clamp"), "clamp" },
+        { GEGL_ABYSS_LOOP,  N_("Loop"),  "loop"  },
+        { GEGL_ABYSS_BLACK, N_("Black"), "black" },
+        { GEGL_ABYSS_WHITE, N_("White"), "white" },
+        // we do not really want this one introspected/translated,
+        // will this bite us?
+        //{ GEGL_BUFFER_NEAREST, N_("Nearest"), "nearest" },
+        { 0, NULL, NULL }
+      };
+      gint i;
+
+      for (i = 0; i < G_N_ELEMENTS (values); i++)
+        if (values[i].value_name)
+          values[i].value_name =
+            dgettext (GETTEXT_PACKAGE, values[i].value_name);
+
+      etype = g_enum_register_static ("GeglAbyssPolicy", values);
+    }
+
+  return etype;
+}
+
+GType
+gegl_sampler_type_get_type (void)
+{
+  static GType etype = 0;
+
+  if (etype == 0)
+    {
+      static GEnumValue values[] = {
+        { GEGL_SAMPLER_NEAREST, N_("Nearest"), "nearest" },
+        { GEGL_SAMPLER_LINEAR,  N_("Linear"),  "linear"  },
+        { GEGL_SAMPLER_CUBIC,   N_("Cubic"),   "cubic"   },
+        { GEGL_SAMPLER_NOHALO,  N_("NoHalo"),  "nohalo"  },
+        { GEGL_SAMPLER_LOHALO,  N_("LoHalo"),  "lohalo"  },
+        { 0, NULL, NULL }
+      };
+      gint i;
+
+      for (i = 0; i < G_N_ELEMENTS (values); i++)
+        if (values[i].value_name)
+          values[i].value_name =
+            dgettext (GETTEXT_PACKAGE, values[i].value_name);
+
+      etype = g_enum_register_static ("GeglSamplerType", values);
+    }
+
+  return etype;
+}


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