aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-17 22:52:43 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-07-18 01:49:09 +0800
commitf22e38ffad3d6360920e278ac35c3a00102738ff (patch)
tree6e66ce1159f3d2b41ee46dc273d85d0639f5edfa
parentcc29868877436d404610039b719c5d781925d97e (diff)
downloadgsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar.gz
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar.bz2
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar.lz
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar.xz
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.tar.zst
gsoc2013-evolution-f22e38ffad3d6360920e278ac35c3a00102738ff.zip
Use template files to generate GEnumClass types.
-rw-r--r--e-util/Makefile.am23
-rw-r--r--e-util/e-util-enumtypes.c.template38
-rw-r--r--e-util/e-util-enumtypes.h.template27
-rw-r--r--glib-gen.mak43
-rw-r--r--libemail-engine/Makefile.am17
-rw-r--r--libemail-engine/e-mail-enumtypes.c.template38
-rw-r--r--libemail-engine/e-mail-enumtypes.h.template27
-rw-r--r--libgnomecanvas/Makefile.am10
-rw-r--r--libgnomecanvas/gnome-canvas-marshal.list2
-rw-r--r--libgnomecanvas/gnome-canvas.c8
-rw-r--r--shell/Makefile.am14
-rw-r--r--shell/e-shell-enumtypes.c.template38
-rw-r--r--shell/e-shell-enumtypes.h.template27
13 files changed, 236 insertions, 76 deletions
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 7f6ef95782..4464f93045 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -2,11 +2,22 @@ eutilincludedir = $(privincludedir)/e-util
ecpsdir = $(privdatadir)/ecps
ruledir = $(privdatadir)
-include $(top_srcdir)/glib-gen.mak
-glib_enum_headers=e-util-enums.h
-glib_enum_output=e-util-enumtypes
-glib_enum_define=E_UTIL
-glib_enum_prefix=e
+ENUM_TYPES = e-util-enums.h
+
+e-util-enumtypes.h: e-util-enumtypes.h.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-util-enumtypes.h.template $(ENUM_TYPES)) > $@
+
+e-util-enumtypes.c: e-util-enumtypes.c.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-util-enumtypes.c.template $(ENUM_TYPES)) > $@
+
+e-marshal.h: e-marshal.list
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --header --prefix=e_marshal $^ > e-marshal.h.tmp && \
+ mv e-marshal.h.tmp e-marshal.h
+
+e-marshal.c: e-marshal.list
+ $(AM_V_GEN) echo "#include \"e-marshal.h\"" >> e-marshal.c.tmp && \
+ $(GLIB_GENMARSHAL) --body --prefix=e_marshal $^ >> e-marshal.c.tmp && \
+ mv e-marshal.c.tmp e-marshal.c
ENUM_GENERATED = e-util-enumtypes.h e-util-enumtypes.c
MARSHAL_GENERATED = e-marshal.c e-marshal.h
@@ -131,6 +142,8 @@ errordir = $(privdatadir)/errors
@EVO_PLUGIN_RULE@
EXTRA_DIST = \
+ e-util-enumtypes.h.template \
+ e-util-enumtypes.c.template \
e-system.error.xml \
e-marshal.list
diff --git a/e-util/e-util-enumtypes.c.template b/e-util/e-util-enumtypes.c.template
new file mode 100644
index 0000000000..cb2634790c
--- /dev/null
+++ b/e-util/e-util-enumtypes.c.template
@@ -0,0 +1,38 @@
+/*** BEGIN file-header ***/
+#include "e-util-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/e-util/e-util-enumtypes.h.template b/e-util/e-util-enumtypes.h.template
new file mode 100644
index 0000000000..c5bfa9c2c1
--- /dev/null
+++ b/e-util/e-util-enumtypes.h.template
@@ -0,0 +1,27 @@
+/*** BEGIN file-header ***/
+#ifndef E_UTIL_ENUMTYPES_H
+#define E_UTIL_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_UTIL_ENUMTYPES_H */
+/*** END file-tail ***/
+
diff --git a/glib-gen.mak b/glib-gen.mak
deleted file mode 100644
index a360dde048..0000000000
--- 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 <glib-object.h>\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/libemail-engine/Makefile.am b/libemail-engine/Makefile.am
index 103a9d530f..5589fe4e73 100644
--- a/libemail-engine/Makefile.am
+++ b/libemail-engine/Makefile.am
@@ -2,11 +2,13 @@ NULL =
privsolib_LTLIBRARIES = libemail-engine.la
-include $(top_srcdir)/glib-gen.mak
-glib_enum_headers=e-mail-enums.h
-glib_enum_output=e-mail-enumtypes
-glib_enum_define=E_MAIL
-glib_enum_prefix=e_mail
+ENUM_TYPES = e-mail-enums.h
+
+e-mail-enumtypes.h: e-mail-enumtypes.h.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-mail-enumtypes.h.template $(ENUM_TYPES)) > $@
+
+e-mail-enumtypes.c: e-mail-enumtypes.c.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-mail-enumtypes.c.template $(ENUM_TYPES)) > $@
ENUM_GENERATED = e-mail-enumtypes.h e-mail-enumtypes.c
@@ -74,6 +76,11 @@ BUILT_SOURCES = $(ENUM_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(pkgconfig_DATA)
+EXTRA_DIST = \
+ e-mail-enumtypes.h.template \
+ e-mail-enumtypes.c.template \
+ $(NULL)
+
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/libemail-engine/e-mail-enumtypes.c.template b/libemail-engine/e-mail-enumtypes.c.template
new file mode 100644
index 0000000000..db4f2a4503
--- /dev/null
+++ b/libemail-engine/e-mail-enumtypes.c.template
@@ -0,0 +1,38 @@
+/*** BEGIN file-header ***/
+#include "e-mail-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/libemail-engine/e-mail-enumtypes.h.template b/libemail-engine/e-mail-enumtypes.h.template
new file mode 100644
index 0000000000..d983a72d5c
--- /dev/null
+++ b/libemail-engine/e-mail-enumtypes.h.template
@@ -0,0 +1,27 @@
+/*** BEGIN file-header ***/
+#ifndef E_MAIL_ENUMTYPES_H
+#define E_MAIL_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_MAIL_ENUMTYPES_H */
+/*** END file-tail ***/
+
diff --git a/libgnomecanvas/Makefile.am b/libgnomecanvas/Makefile.am
index 02fa1e025b..a1eb3f1e26 100644
--- a/libgnomecanvas/Makefile.am
+++ b/libgnomecanvas/Makefile.am
@@ -49,13 +49,6 @@ libgnomecanvas_la_SOURCES = \
gnome-canvas-widget.c \
gnome-canvas.c
-include $(top_srcdir)/glib-gen.mak
-glib_enum_prefix=gnome_canvas
-
-MARSHAL_GENERATED = \
- gnome-canvas-marshal.c \
- gnome-canvas-marshal.h
-
libgnomecanvas_la_LIBADD = \
$(GNOME_PLATFORM_LIBS) \
$(MATH_LIB)
@@ -66,7 +59,4 @@ BUILT_SOURCES = $(MARSHAL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
-EXTRA_DIST = \
- gnome-canvas-marshal.list
-
-include $(top_srcdir)/git.mk
diff --git a/libgnomecanvas/gnome-canvas-marshal.list b/libgnomecanvas/gnome-canvas-marshal.list
deleted file mode 100644
index c2f9657b0c..0000000000
--- a/libgnomecanvas/gnome-canvas-marshal.list
+++ /dev/null
@@ -1,2 +0,0 @@
-VOID:BOXED,INT,INT,INT,INT
-BOOLEAN:BOXED
diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c
index 8911e610eb..62cc77268a 100644
--- a/libgnomecanvas/gnome-canvas.c
+++ b/libgnomecanvas/gnome-canvas.c
@@ -91,8 +91,6 @@
#include "gnome-canvas.h"
#include "gnome-canvas-i18n.h"
#include "gnome-canvas-util.h"
-#include "gnome-canvas-marshal.h"
-#include "gnome-canvas-marshal.c"
/* We must run our idle update handler *before* GDK wants to redraw. */
#define CANVAS_IDLE_PRIORITY (GDK_PRIORITY_REDRAW - 5)
@@ -1839,8 +1837,7 @@ gnome_canvas_class_init (GnomeCanvasClass *class)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnomeCanvasClass, draw_background),
- NULL, NULL,
- gnome_canvas_marshal_VOID__BOXED_INT_INT_INT_INT,
+ NULL, NULL, NULL,
G_TYPE_NONE, 5, CAIRO_GOBJECT_TYPE_CONTEXT,
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
@@ -3320,8 +3317,7 @@ gnome_canvas_item_class_init (GnomeCanvasItemClass *class)
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnomeCanvasItemClass, event),
- boolean_handled_accumulator, NULL,
- gnome_canvas_marshal_BOOLEAN__BOXED,
+ boolean_handled_accumulator, NULL, NULL,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 0398379c41..b460d08d43 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -10,11 +10,13 @@ privsolib_LTLIBRARIES = libeshell.la
eshellincludedir = $(privincludedir)/shell
-include $(top_srcdir)/glib-gen.mak
-glib_enum_headers=e-shell.h
-glib_enum_output=e-shell-enumtypes
-glib_enum_define=E_SHELL
-glib_enum_prefix=e_shell
+ENUM_TYPES = e-shell.h
+
+e-shell-enumtypes.h: e-shell-enumtypes.h.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-shell-enumtypes.h.template $(ENUM_TYPES)) > $@
+
+e-shell-enumtypes.c: e-shell-enumtypes.c.template $(ENUM_TYPES)
+ $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-shell-enumtypes.c.template $(ENUM_TYPES)) > $@
ENUM_GENERATED = e-shell-enumtypes.h e-shell-enumtypes.c
@@ -190,6 +192,8 @@ errordir = $(privdatadir)/errors
EXTRA_DIST = \
evo-version.h.in \
+ e-shell-enumtypes.h.template \
+ e-shell-enumtypes.c.template \
shell.error.xml \
evolution-icon.rc \
evolution.ico \
diff --git a/shell/e-shell-enumtypes.c.template b/shell/e-shell-enumtypes.c.template
new file mode 100644
index 0000000000..4d30900611
--- /dev/null
+++ b/shell/e-shell-enumtypes.c.template
@@ -0,0 +1,38 @@
+/*** BEGIN file-header ***/
+#include "e-shell-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/shell/e-shell-enumtypes.h.template b/shell/e-shell-enumtypes.h.template
new file mode 100644
index 0000000000..76ff677384
--- /dev/null
+++ b/shell/e-shell-enumtypes.h.template
@@ -0,0 +1,27 @@
+/*** BEGIN file-header ***/
+#ifndef E_SHELL_ENUMTYPES_H
+#define E_SHELL_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_SHELL_ENUMTYPES_H */
+/*** END file-tail ***/
+