[evolution-data-server] Use template files to generate GEnumClass types.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Use template files to generate GEnumClass types.
- Date: Tue, 17 Jul 2012 14:45:38 +0000 (UTC)
commit edaa9086a266b709db934db14ac931d736b81c97
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jul 17 10:35:25 2012 -0400
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(-)
---
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 <glib-object.h>
+
+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 <glib-object.h>
+
+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 <glib-object.h>
+
+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/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 <glib-object.h>
+
+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 <glib-object.h>
+
+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 ***/
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]