[nautilus-sendto] Generate GObject enums for capabilities enum



commit 7b01ee7320ae0651b5e946506762dd31019c2e59
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 23 11:14:43 2009 +0100

    Generate GObject enums for capabilities enum

 src/Makefile.am |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 1c67c15..005457b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,7 +18,9 @@ bin_PROGRAMS = nautilus-sendto
 
 nautilus_sendto_SOURCES =			\
 	nautilus-sendto-command.c		\
-	nautilus-sendto-plugin.h
+	nautilus-sendto-plugin.h		\
+	nst-enum-types.c			\
+	nst-enum-types.h
 
 nautilus_sendto_LDADD = $(NAUTILUS_SENDTO_LIBS)
 
@@ -32,4 +34,30 @@ libnautilus_sendto_la_SOURCES =		\
 libnautilus_sendto_la_LDFLAGS = -module -avoid-version -no-undefined
 libnautilus_sendto_la_LIBADD  = $(NAUTILUS_EXT_SENDTO_LIBS)
 
+nst_headers_to_scan_for_enums = nautilus-sendto-plugin.h
+# Generate the enums source code, with glib-mkenums:
+# This is based on the same Makefile.am stuff in pango:
+nst_built_headers = nst-enum-types.h
+nst_built_cfiles = nst-enum-types.c
+
+nst-enum-types.h: $(nst_headers_to_scan_for_enums) Makefile
+	$(AM_V_GEN) (cd $(srcdir) && glib-mkenums \
+			--fhead "#ifndef __NST_ENUM_TYPES_H__\n#define __NST_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 NST_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" 	\
+			--ftail "G_END_DECLS\n\n#endif /* __NST_ENUM_TYPES_H__ */" \
+		$(nst_headers_to_scan_for_enums)) > $@
+
+nst-enum-types.c: $(nst_headers_to_scan_for_enums) Makefile nst-enum-types.h
+	$(AM_V_GEN) (cd $(srcdir) && glib-mkenums \
+			--fhead "#include <nautilus-sendto-plugin.h>\n" \
+			--fhead "#include \"nst-enum-types.h\"\n" \
+			--fhead "#include <glib-object.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" \
+		$(nst_headers_to_scan_for_enums)) > $@
+
 EXTRA_DIST = $(ui_DATA)
+CLEANFILES = $(nst_built_headers) $(nst_built_cfiles)



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