2008-06-18 Marco Barisione <marco.barisione@collabora.co.uk>
authorjmalonzo@webkit.org <jmalonzo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2008 20:04:18 +0000 (20:04 +0000)
committerjmalonzo@webkit.org <jmalonzo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2008 20:04:18 +0000 (20:04 +0000)
        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.

        (This is a recommit of r34646, w/ additional build fix)

        * GNUmakefile.am: Generate webkit-enum-types.cpp and
        webkit-enum-types.h.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34649 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
GNUmakefile.am
WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkit.h

index 1995c33..9408deb 100644 (file)
--- 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.
index 7e0f6ca..a6ae299 100644 (file)
@@ -232,7 +232,9 @@ nodist_libwebkit_1_0_la_SOURCES = \
        $(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_h_api += \
 
 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 @@ webkitgtk_cleanfiles += \
 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 @@ stamp-webkit-marshal.h: $(WEBKIT_MARSHAL_LIST)
        $(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 \"$(top_builddir)/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
index fa72250..9d34c4f 100644 (file)
@@ -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-17  Christian Dywan  <christian@twotoasts.de>
 
         Reviewed by Alp.
index 55d5b56..10c214f 100644 (file)
@@ -28,5 +28,6 @@
 #include <webkit/webkitwebview.h>
 #include <webkit/webkitwebbackforwardlist.h>
 #include <webkit/webkitwebhistoryitem.h>
+#include <webkit/webkitenumtypes.h>
 
 #endif /* __WEBKIT_H__ */