From edaa9086a266b709db934db14ac931d736b81c97 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 17 Jul 2012 10:35:25 -0400 Subject: [PATCH] Use template files to generate GEnumClass types. --- addressbook/libebook/Makefile.am | 16 +++++---- addressbook/libebook/e-book-enumtypes.c.template | 38 +++++++++++++++++++++ addressbook/libebook/e-book-enumtypes.h.template | 27 +++++++++++++++ calendar/libecal/Makefile.am | 18 ++++++---- calendar/libecal/e-cal-enumtypes.c.template | 38 +++++++++++++++++++++ calendar/libecal/e-cal-enumtypes.h.template | 27 +++++++++++++++ camel/Makefile.am | 14 +++++--- camel/camel-enumtypes.c.template | 38 +++++++++++++++++++++ camel/camel-enumtypes.h.template | 27 +++++++++++++++ camel/glib-gen.mak | 43 ------------------------ glib-gen.mak | 43 ------------------------ libebackend/Makefile.am | 16 +++++---- libebackend/e-backend-enumtypes.c.template | 38 +++++++++++++++++++++ libebackend/e-backend-enumtypes.h.template | 27 +++++++++++++++ libedataserver/Makefile.am | 14 +++++--- libedataserver/e-source-enumtypes.c.template | 38 +++++++++++++++++++++ libedataserver/e-source-enumtypes.h.template | 27 +++++++++++++++ 17 files changed, 374 insertions(+), 115 deletions(-) create mode 100644 addressbook/libebook/e-book-enumtypes.c.template create mode 100644 addressbook/libebook/e-book-enumtypes.h.template create mode 100644 calendar/libecal/e-cal-enumtypes.c.template create mode 100644 calendar/libecal/e-cal-enumtypes.h.template create mode 100644 camel/camel-enumtypes.c.template create mode 100644 camel/camel-enumtypes.h.template delete mode 100644 camel/glib-gen.mak delete mode 100644 glib-gen.mak create mode 100644 libebackend/e-backend-enumtypes.c.template create mode 100644 libebackend/e-backend-enumtypes.h.template create mode 100644 libedataserver/e-source-enumtypes.c.template create mode 100644 libedataserver/e-source-enumtypes.h.template diff --git a/addressbook/libebook/Makefile.am b/addressbook/libebook/Makefile.am index 2d37f01..870d3c4 100644 --- a/addressbook/libebook/Makefile.am +++ b/addressbook/libebook/Makefile.am @@ -1,11 +1,13 @@ CLEANFILES= BUILT_SOURCES= -include $(top_srcdir)/glib-gen.mak -glib_enum_headers=e-book-types.h -glib_enum_output=e-book-enumtypes -glib_enum_define=E_BOOK -glib_enum_prefix=e_book +ENUM_TYPES = e-book-types.h + +e-book-enumtypes.h: e-book-enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-enumtypes.h.template $(ENUM_TYPES)) > $@ + +e-book-enumtypes.c: e-book-enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-enumtypes.c.template $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-book-enumtypes.h e-book-enumtypes.c @@ -141,8 +143,10 @@ CLEANFILES += $(BUILT_SOURCES) DISTCLEANFILES = $(pkgconfig_DATA) EXTRA_DIST = \ + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ + e-book-enumtypes.h.template \ + e-book-enumtypes.c.template \ e-book-marshal.list \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ e-name-western-tables.h.in \ gen-western-table.py diff --git a/addressbook/libebook/e-book-enumtypes.c.template b/addressbook/libebook/e-book-enumtypes.c.template new file mode 100644 index 0000000..811ca10 --- /dev/null +++ b/addressbook/libebook/e-book-enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "e-book-enumtypes.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType the_type = 0; + + if (the_type == 0) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, + "@VALUENAME@", + "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + the_type = g_@type@_register_static ( + g_intern_static_string ("@EnumName@"), + values); + } + return the_type; +} + +/*** END value-tail ***/ diff --git a/addressbook/libebook/e-book-enumtypes.h.template b/addressbook/libebook/e-book-enumtypes.h.template new file mode 100644 index 0000000..d30ec47 --- /dev/null +++ b/addressbook/libebook/e-book-enumtypes.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ +#ifndef E_BOOK_ENUMTYPES_H +#define E_BOOK_ENUMTYPES_H + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from "@filename@" */ + +/*** END file-production ***/ + +/*** BEGIN enumeration-production ***/ +#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +GType @enum_name@_get_type (void) G_GNUC_CONST; + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* E_BOOK_ENUMTYPES_H */ +/*** END file-tail ***/ + diff --git a/calendar/libecal/Makefile.am b/calendar/libecal/Makefile.am index 71d53b0..6a8548f 100644 --- a/calendar/libecal/Makefile.am +++ b/calendar/libecal/Makefile.am @@ -1,8 +1,10 @@ -include $(top_srcdir)/glib-gen.mak -glib_enum_headers=e-cal-types.h -glib_enum_output=e-cal-enumtypes -glib_enum_define=E_CAL -glib_enum_prefix=e_cal +ENUM_TYPES = e-cal-types.h + +e-cal-enumtypes.h: e-cal-enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-cal-enumtypes.h.template $(ENUM_TYPES)) > $@ + +e-cal-enumtypes.c: e-cal-enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-cal-enumtypes.c.template $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-cal-enumtypes.h e-cal-enumtypes.c @@ -117,8 +119,10 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA) endif EXTRA_DIST = \ - e-cal-marshal.list \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ + e-cal-enumtypes.h.template \ + e-cal-enumtypes.c.template \ + e-cal-marshal.list dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/calendar/libecal/e-cal-enumtypes.c.template b/calendar/libecal/e-cal-enumtypes.c.template new file mode 100644 index 0000000..1943073 --- /dev/null +++ b/calendar/libecal/e-cal-enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "e-cal-enumtypes.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType the_type = 0; + + if (the_type == 0) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, + "@VALUENAME@", + "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + the_type = g_@type@_register_static ( + g_intern_static_string ("@EnumName@"), + values); + } + return the_type; +} + +/*** END value-tail ***/ diff --git a/calendar/libecal/e-cal-enumtypes.h.template b/calendar/libecal/e-cal-enumtypes.h.template new file mode 100644 index 0000000..ad99fe3 --- /dev/null +++ b/calendar/libecal/e-cal-enumtypes.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ +#ifndef E_CAL_ENUMTYPES_H +#define E_CAL_ENUMTYPES_H + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from "@filename@" */ + +/*** END file-production ***/ + +/*** BEGIN enumeration-production ***/ +#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +GType @enum_name@_get_type (void) G_GNUC_CONST; + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* E_CAL_ENUMTYPES_H */ +/*** END file-tail ***/ + diff --git a/camel/Makefile.am b/camel/Makefile.am index a41774e..031eb38 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -32,11 +32,13 @@ camellibexec_PROGRAMS = $(LOCK_HELPER) camel-index-control-1.2 lib_LTLIBRARIES = libcamel-1.2.la -include $(top_srcdir)/camel/glib-gen.mak -glib_enum_headers=camel-enums.h -glib_enum_output=camel-enumtypes -glib_enum_define=CAMEL -glib_enum_prefix=camel +ENUM_TYPES = camel-enums.h + +camel-enumtypes.h: camel-enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template camel-enumtypes.h.template $(ENUM_TYPES)) > $@ + +camel-enumtypes.c: camel-enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template camel-enumtypes.c.template $(ENUM_TYPES)) > $@ ENUM_GENERATED = camel-enumtypes.h camel-enumtypes.c camel-imapx-tokenise.h @@ -419,6 +421,8 @@ BUILT_SOURCES = \ EXTRA_DIST = \ $(pkgconfig_in_files) \ + camel-enumtypes.h.template \ + camel-enumtypes.c.template \ camel-imapx-tokens.txt \ camel-marshal.list \ gentables.pl \ diff --git a/camel/camel-enumtypes.c.template b/camel/camel-enumtypes.c.template new file mode 100644 index 0000000..5e749b2 --- /dev/null +++ b/camel/camel-enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "camel-enumtypes.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType the_type = 0; + + if (the_type == 0) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, + "@VALUENAME@", + "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + the_type = g_@type@_register_static ( + g_intern_static_string ("@EnumName@"), + values); + } + return the_type; +} + +/*** END value-tail ***/ diff --git a/camel/camel-enumtypes.h.template b/camel/camel-enumtypes.h.template new file mode 100644 index 0000000..3f34a13 --- /dev/null +++ b/camel/camel-enumtypes.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ +#ifndef CAMEL_ENUMTYPES_H +#define CAMEL_ENUMTYPES_H + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from "@filename@" */ + +/*** END file-production ***/ + +/*** BEGIN enumeration-production ***/ +#define CAMEL_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +GType @enum_name@_get_type (void) G_GNUC_CONST; + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* CAMEL_ENUMTYPES_H */ +/*** END file-tail ***/ + diff --git a/camel/glib-gen.mak b/camel/glib-gen.mak deleted file mode 100644 index 846093d..0000000 --- a/camel/glib-gen.mak +++ /dev/null @@ -1,43 +0,0 @@ -# these are the variables your Makefile.am should set -# the example is based on the colorbalance interface - -#glib_enum_headers=$(colorbalance_headers) -#glib_enum_output=gst-color-balance-enumtypes -#glib_enum_define=GST_COLOR_BALANCE -#glib_enum_prefix=gst_color_balance - -# these are all the rules generating the relevant files -%-marshal.h: %-marshal.list - $(AM_V_GEN) glib-genmarshal --header --prefix=$(glib_enum_prefix)_marshal $^ > $*-marshal.h.tmp && \ - mv $*-marshal.h.tmp $*-marshal.h - -%-marshal.c: %-marshal.list - $(AM_V_GEN) echo "#include \"$*-marshal.h\"" >> $*-marshal.c.tmp && \ - glib-genmarshal --body --prefix=$(glib_enum_prefix)_marshal $^ >> $*-marshal.c.tmp && \ - mv $*-marshal.c.tmp $*-marshal.c - -$(glib_enum_output).h: $(glib_enum_headers) - $(AM_V_GEN) glib-mkenums \ - --fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_ENUM_TYPES_H__\n\n#include \n\nG_BEGIN_DECLS\n" \ - --fprod "/* enumerations from \"@filename@\" */\n" \ - --vhead "GType @enum_name@_get_type (void);\n#define CAMEL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ - --ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \ - $^ > $@ - -$(glib_enum_output).c: $(glib_enum_headers) - @if test "x$(glib_enum_headers)" == "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi - $(AM_V_GEN) glib-mkenums \ - --fhead "#include <$<>\n#include \"$(glib_enum_output).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" \ - $^ > $@ - -# a hack rule to make sure .Plo files exist because they get include'd -# from Makefile's -.deps/%-marshal.Plo: - touch $@ - -.deps/$(glib_enum_output).Plo: - touch $@ diff --git a/glib-gen.mak b/glib-gen.mak deleted file mode 100644 index a360dde..0000000 --- a/glib-gen.mak +++ /dev/null @@ -1,43 +0,0 @@ -# these are the variables your Makefile.am should set -# the example is based on the colorbalance interface - -#glib_enum_headers=$(colorbalance_headers) -#glib_enum_output=gst-color-balance-enumtypes -#glib_enum_define=GST_COLOR_BALANCE -#glib_enum_prefix=gst_color_balance - -# these are all the rules generating the relevant files -%-marshal.h: %-marshal.list - $(AM_V_GEN) glib-genmarshal --header --prefix=$(glib_enum_prefix)_marshal $^ > $*-marshal.h.tmp && \ - mv $*-marshal.h.tmp $*-marshal.h - -%-marshal.c: %-marshal.list - $(AM_V_GEN) echo "#include \"$*-marshal.h\"" >> $*-marshal.c.tmp && \ - glib-genmarshal --body --prefix=$(glib_enum_prefix)_marshal $^ >> $*-marshal.c.tmp && \ - mv $*-marshal.c.tmp $*-marshal.c - -$(glib_enum_output).h: $(glib_enum_headers) - $(AM_V_GEN) glib-mkenums \ - --fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_ENUM_TYPES_H__\n\n#include \n\nG_BEGIN_DECLS\n" \ - --fprod "/* enumerations from \"@filename@\" */\n" \ - --vhead "GType @enum_name@_get_type (void);\n#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ - --ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \ - $^ > $@ - -$(glib_enum_output).c: $(glib_enum_headers) - @if test "x$(glib_enum_headers)" == "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi - $(AM_V_GEN) glib-mkenums \ - --fhead "#include <$<>\n#include \"$(glib_enum_output).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" \ - $^ > $@ - -# a hack rule to make sure .Plo files exist because they get include'd -# from Makefile's -.deps/%-marshal.Plo: - touch $@ - -.deps/$(glib_enum_output).Plo: - touch $@ diff --git a/libebackend/Makefile.am b/libebackend/Makefile.am index 12fc660..35e8f5e 100644 --- a/libebackend/Makefile.am +++ b/libebackend/Makefile.am @@ -1,8 +1,10 @@ -include $(top_srcdir)/glib-gen.mak -glib_enum_headers=e-backend-enums.h -glib_enum_output=e-backend-enumtypes -glib_enum_define=E -glib_enum_prefix=e +ENUM_TYPES = e-backend-enums.h + +e-backend-enumtypes.h: e-backend-enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-backend-enumtypes.h.template $(ENUM_TYPES)) > $@ + +e-backend-enumtypes.c: e-backend-enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-backend-enumtypes.c.template $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-backend-enumtypes.h e-backend-enumtypes.c @@ -105,7 +107,9 @@ gsettings_SCHEMAS = \ EXTRA_DIST = \ $(gsettings_SCHEMAS) \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ + e-backend-enumtypes.h.template \ + e-backend-enumtypes.c.template CLEANFILES = $(gsettings_SCHEMAS:.xml=.valid) diff --git a/libebackend/e-backend-enumtypes.c.template b/libebackend/e-backend-enumtypes.c.template new file mode 100644 index 0000000..fbc6cab --- /dev/null +++ b/libebackend/e-backend-enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "e-backend-enumtypes.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType the_type = 0; + + if (the_type == 0) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, + "@VALUENAME@", + "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + the_type = g_@type@_register_static ( + g_intern_static_string ("@EnumName@"), + values); + } + return the_type; +} + +/*** END value-tail ***/ diff --git a/libebackend/e-backend-enumtypes.h.template b/libebackend/e-backend-enumtypes.h.template new file mode 100644 index 0000000..78dfa80 --- /dev/null +++ b/libebackend/e-backend-enumtypes.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ +#ifndef E_BACKEND_ENUMTYPES_H +#define E_BACKEND_ENUMTYPES_H + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from "@filename@" */ + +/*** END file-production ***/ + +/*** BEGIN enumeration-production ***/ +#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +GType @enum_name@_get_type (void) G_GNUC_CONST; + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* E_BACKEND_ENUMTYPES_H */ +/*** END file-tail ***/ + diff --git a/libedataserver/Makefile.am b/libedataserver/Makefile.am index 84d6613..4c0d9e5 100644 --- a/libedataserver/Makefile.am +++ b/libedataserver/Makefile.am @@ -1,8 +1,10 @@ -include $(top_srcdir)/glib-gen.mak -glib_enum_headers=e-source-enums.h -glib_enum_output=e-source-enumtypes -glib_enum_define=E -glib_enum_prefix=e +ENUM_TYPES = e-source-enums.h + +e-source-enumtypes.h: e-source-enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-source-enumtypes.h.template $(ENUM_TYPES)) > $@ + +e-source-enumtypes.c: e-source-enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-source-enumtypes.c.template $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-source-enumtypes.h e-source-enumtypes.c @@ -186,6 +188,8 @@ convert_DATA = libedataserver.convert EXTRA_DIST = \ $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ eds-version.h.in \ + e-source-enumtypes.h.template \ + e-source-enumtypes.c.template \ $(convert_DATA) \ $(gsettings_SCHEMAS:.xml=.xml.in) diff --git a/libedataserver/e-source-enumtypes.c.template b/libedataserver/e-source-enumtypes.c.template new file mode 100644 index 0000000..b63fc8e --- /dev/null +++ b/libedataserver/e-source-enumtypes.c.template @@ -0,0 +1,38 @@ +/*** BEGIN file-header ***/ +#include "e-source-enumtypes.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static GType the_type = 0; + + if (the_type == 0) { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, + "@VALUENAME@", + "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + the_type = g_@type@_register_static ( + g_intern_static_string ("@EnumName@"), + values); + } + return the_type; +} + +/*** END value-tail ***/ diff --git a/libedataserver/e-source-enumtypes.h.template b/libedataserver/e-source-enumtypes.h.template new file mode 100644 index 0000000..3250c7f --- /dev/null +++ b/libedataserver/e-source-enumtypes.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ +#ifndef E_SOURCE_ENUMTYPES_H +#define E_SOURCE_ENUMTYPES_H + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* Enumerations from "@filename@" */ + +/*** END file-production ***/ + +/*** BEGIN enumeration-production ***/ +#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +GType @enum_name@_get_type (void) G_GNUC_CONST; + +/*** END enumeration-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* E_SOURCE_ENUMTYPES_H */ +/*** END file-tail ***/ + -- 2.7.4