File libxfce4menu-4.6.2-add-enum-types.patch of Package libxfce4menu

From 60310e06364f913c0a2bd21b2935689047f175b1 Mon Sep 17 00:00:00 2001
From: Danny Milosavljevic <dannym@xfce.org>
Date: Sun, 02 Jan 2011 20:08:08 +0000
Subject: add enum-types (enum value symbols).

---
diff --git a/libxfce4menu/Makefile.am b/libxfce4menu/Makefile.am
index 2bf778c..61c04f5 100644
--- a/libxfce4menu/Makefile.am
+++ b/libxfce4menu/Makefile.am
@@ -12,7 +12,12 @@ INCLUDES = 								\
 lib_LTLIBRARIES = 							\
 	libxfce4menu-0.1.la
 
+libxfce4menu_enum_headers = \
+	xfce-menu-layout.h \
+	xfce-menu-monitor.h
+
 libxfce4menu_headers =							\
+	libxfce4menu-enum-types.h                                         \
 	xfce-menu.h							\
 	xfce-menu-element.h						\
 	xfce-menu-separator.h						\
@@ -48,6 +53,10 @@ libxfce4menu_sources =							\
 	xfce-menu-monitor.c						\
 	xfce-menu-item.c						
 
+libxfce4menu_built_sources = \
+	libxfce4menu-enum-types.c \
+	libxfce4menu-enum-types.h
+	
 libxfce4menuincludedir = $(includedir)/xfce4/libxfce4menu-0.1/libxfce4menu
 
 libxfce4menuinclude_HEADERS =						\
@@ -57,7 +66,8 @@ libxfce4menuinclude_HEADERS =						\
 
 libxfce4menu_0_1_la_SOURCES =						\
 	$(libxfce4menu_sources)						\
-	$(libxfce4menu_headers)
+	$(libxfce4menu_headers)                                         \
+	$(libxfce4menu_built_sources)
 
 libxfce4menu_0_1_la_CFLAGS = 						\
 	$(GLIB_CFLAGS)							\
@@ -90,3 +100,36 @@ pkgconfig_DATA = libxfce4menu-0.1.pc
 
 # required for gtk-doc
 dist-hook: all
+
+if MAINTAINER_MODE
+CLEANFILES = 
+DISTCLEANFILES = \
+	$(libxfce4menu_built_sources)  
+	
+BUILT_SOURCES = \
+	$(libxfce4menu_built_sources)
+        
+libxfce4menu-enum-types.h: stamp-libxfce4menu-enum-types.h
+	@true
+stamp-libxfce4menu-enum-types.h: $(libxfce4menu_enum_headers) Makefile
+	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
+		--fhead "#ifndef __LIBXFCE4UI_ENUM_TYPES_H__\n#define __LIBXFCE4UI_ENUM_TYPES_H__\n\nG_BEGIN_DECLS\n\n" \
+		--fprod "/* enumerations from \"@filename@\" */\n\n" \
+		--vhead "GType @enum_name@_get_type(void) G_GNUC_CONST;\n#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n\n" \
+		--ftail "G_END_DECLS\n\n#endif /* !__LIBXFCE4UI_ENUM_TYPES_H__ */" \
+		$(libxfce4menu_enum_headers) ) >xgen-leth
+	cmp -s xgen-leth libxfce4menu-enum-types.h || cp xgen-leth libxfce4menu-enum-types.h
+	rm -f xgen-leth
+	echo timestamp > $(@F)
+libxfce4menu-enum-types.c: $(libxfce4menu_enum_headers) Makefile
+	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
+		--fhead "#include <libxfce4menu/libxfce4menu.h>\n\n" \
+		--fprod "/* enumerations from \"@filename@\" */\n\n" \
+		--vhead "GType\n@enum_name@_get_type(void)\n{\n    static GType type = 0;\n\n    if(!type) {\n        static const G@Type@Value values[] = {"\
+		--vprod "            { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+		--vtail "            { 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static(\"@EnumName@\", values);\n    }\n\n    return type;\n}\n\n" \
+		--ftail "\n#define __LIBXFCE4UI_ENUM_TYPES_C__\n\n" \
+		$(libxfce4menu_enum_headers) ) > xgen-letc
+	cp xgen-letc libxfce4menu-enum-types.c
+	rm -f xgen-letc
+endif
diff --git a/libxfce4menu/libxfce4menu.h b/libxfce4menu/libxfce4menu.h
index 15c18b3..05758e0 100644
--- a/libxfce4menu/libxfce4menu.h
+++ b/libxfce4menu/libxfce4menu.h
@@ -40,6 +40,7 @@
 #include <libxfce4menu/xfce-menu-separator.h>
 #include <libxfce4menu/xfce-menu.h>
 #include <libxfce4menu/xfce-menu-monitor.h>
+#include <libxfce4menu/libxfce4menu-enum-types.h>
 
 #define LIBXFCE4MENU_INSIDE_LIBXFCE4MENU_H
 
--
cgit v0.8.3.4