2008-06-18 Marco Barisione <marco.barisione@collabora.co.uk>
Reviewed by Alp Toker.
https://bugs.webkit.org/show_bug.cgi?id=19171
[GTK] GTypes for enumerations
* webkit/webkit.h: Include webkit-enum-types.h.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 1995c33..9408deb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-06-18 Marco Barisione <marco.barisione@collabora.co.uk>
+
+ Reviewed by Alp Toker.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19171
+ [GTK] GTypes for enumerations
+
+ Generate GTypes for public enumerations so they can be used as
+ properties.
+
+ * GNUmakefile.am: Generate webkit-enum-types.cpp and
+ webkit-enum-types.h.
+
2008-06-16 Simon Hausmann <hausmann@webkit.org>
Fix the Qt build. testkjs.pro is now called jsc.pro.
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 7e0f6ca..0899bca 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -232,7 +232,9 @@
$(webkitgtk_built_sources)
libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
-libwebkit_1_0_la_HEADERS = $(webkitgtk_h_api)
+libwebkit_1_0_la_HEADERS = \
+ $(webkitgtk_h_api) \
+ WebKit/gtk/webkit/webkitenumtypes.h
libwebkit_1_0_la_SOURCES = \
$(webkitgtk_headers) \
@@ -319,7 +321,9 @@
webkitgtk_built_sources += \
DerivedSources/webkit-marshal.h \
- DerivedSources/webkit-marshal.cpp
+ DerivedSources/webkit-marshal.cpp \
+ DerivedSources/webkitenumtypes.cpp \
+ WebKit/gtk/webkit/webkitenumtypes.h
webkitgtk_headers += \
WebKit/gtk/webkit/webkitprivate.h \
@@ -362,12 +366,14 @@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
-WEBKIT_MARSHAL = $(GENSOURCES)/webkit-marshal
-WEBKIT_MARSHAL_LIST = $(srcdir)/WebKit/gtk/webkit/webkit-marshal.list
-
stamp_files := \
stamp-webkit-marshal.cpp \
- stamp-webkit-marshal.h
+ stamp-webkit-marshal.h \
+ stamp-webkitenumtypes.cpp \
+ stamp-webkitenumtypes.h
+
+WEBKIT_MARSHAL = $(GENSOURCES)/webkit-marshal
+WEBKIT_MARSHAL_LIST = $(srcdir)/WebKit/gtk/webkit/webkit-marshal.list
DerivedSources/webkit-marshal.cpp: stamp-webkit-marshal.cpp
@true
@@ -384,6 +390,53 @@
$(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
echo timestamp > $(@F)
+WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
+ @true
+stamp-webkitenumtypes.h: $(webkitgtk_h_api) Makefile
+ (cd $(srcdir) \
+ && glib-mkenums \
+ --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
+ --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
+ --fhead "#include <glib-object.h>\n\n" \
+ --fhead "#include <webkit/webkitdefines.h>\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif\n" \
+ --fprod "#include <@filename@>\n\n" \
+ --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
+ --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
+ $(webkitgtk_h_api) | \
+ sed 's,WebKit/gtk/,,' | \
+ sed 's,web_kit,webkit,' | \
+ sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
+ ) > xgen-gth \
+ && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
+ && rm -f xgen-gth \
+ && echo timestamp > $(@F)
+
+DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) Makefile
+ (cd $(srcdir) \
+ && glib-mkenums \
+ --fhead "#include <config.h>\n" \
+ --fhead "#include <glib-object.h>\n" \
+ --fhead "#include \"$(srcdir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
+ --fhead "extern \"C\" {\n\n" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n};\n\n" \
+ --vtail "GType @enum_name@_get_type(void)\n{\n" \
+ --vtail " static GType type = 0;\n\n" \
+ --vtail " if (!type)\n" \
+ --vtail " type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
+ --vtail " return type;\n}\n\n" \
+ --ftail "}\n" \
+ $(webkitgtk_h_api) | \
+ sed 's,web_kit,webkit,' \
+ ) > xgen-gtc \
+ && cp xgen-gtc $@ \
+ && rm -f xgen-gtc
+
# END WEBKIT GTK+
# Files that will be cleaned
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index fa72250a..d8aa1f8 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,12 @@
+2008-06-18 Marco Barisione <marco.barisione@collabora.co.uk>
+
+ Reviewed by Alp Toker.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19171
+ [GTK] GTypes for enumerations
+
+ * webkit/webkit.h: Include webkit-enum-types.h.
+
2008-06-17 Christian Dywan <christian@twotoasts.de>
Reviewed by Alp.
diff --git a/WebKit/gtk/webkit/webkit.h b/WebKit/gtk/webkit/webkit.h
index 55d5b56..10c214f 100644
--- a/WebKit/gtk/webkit/webkit.h
+++ b/WebKit/gtk/webkit/webkit.h
@@ -28,5 +28,6 @@
#include <webkit/webkitwebview.h>
#include <webkit/webkitwebbackforwardlist.h>
#include <webkit/webkitwebhistoryitem.h>
+#include <webkit/webkitenumtypes.h>
#endif /* __WEBKIT_H__ */