[gssdp] Add type to errordomain



commit fca0da98e28bccc54e351ad60089ea97455fc785
Author: Jens Georg <mail jensge org>
Date:   Mon Oct 10 22:51:43 2016 +0200

    Add type to errordomain
    
    This allows us to remove the metadata override for vala
    
    Signed-off-by: Jens Georg <mail jensge org>

 configure.ac               |    7 +++++++
 libgssdp/Makefile.am       |   42 ++++++++++++++++++++++++++++++++++++++++--
 libgssdp/gssdp.h           |    1 +
 vala/GSSDP-1.2.metadata    |    2 --
 vala/Makefile.am           |    8 +++-----
 vala/gssdp-1.2-custom.vala |   31 -------------------------------
 6 files changed, 51 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 05557c7..bf27fb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,13 @@ AC_MSG_RESULT([$HAVE_SIOCGIFINDEX])
 
 GTK_DOC_CHECK([1.14], [--flavour no-tmpl])
 
+AC_MSG_CHECKING([for glib-mkenums script])
+GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+AS_IF([test "x$GLIB_MKENUMS" = "x"],
+    [AC_MSG_ERROR([glib-mkenums not listed in glib-2.0 pkg-config file])],
+    [AC_SUBST([GLIB_MKENUMS])
+     AC_MSG_RESULT([$GLIB_MKENUMS])])
+
 AC_CONFIG_FILES([
 Makefile
 libgssdp/Makefile
diff --git a/libgssdp/Makefile.am b/libgssdp/Makefile.am
index 9eca703..b1e4a91 100644
--- a/libgssdp/Makefile.am
+++ b/libgssdp/Makefile.am
@@ -20,7 +20,8 @@ libgssdpinc_HEADERS =         gssdp-client.h           \
                        gssdp-error.h            \
                        gssdp-resource-browser.h \
                        gssdp-resource-group.h   \
-                       gssdp.h
+                       gssdp.h \
+                       gssdp-enums.h
 
 gssdp-marshal.c: gssdp-marshal.list
        $(AM_V_GEN) \
@@ -30,7 +31,44 @@ gssdp-marshal.h: gssdp-marshal.list
        $(AM_V_GEN) \
        $(GLIB_GENMARSHAL) --prefix=gssdp_marshal $(srcdir)/gssdp-marshal.list --header > gssdp-marshal.h
 
-BUILT_SOURCES = gssdp-marshal.c gssdp-marshal.h
+enumheaders = $(srcdir)/gssdp-error.h
+
+BUILT_SOURCES = gssdp-marshal.c \
+       gssdp-marshal.h \
+       gssdp-enums.c \
+       gssdp-enums.h
+
+gssdp-enums.c: $(enumheaders) Makefile
+       $(AM_V_GEN)$(GLIB_MKENUMS) \
+               --identifier-prefix GSSDP \
+               --symbol-prefix gssdp \
+               --fhead "#include \"gssdp-enums.h\"\n\n" \
+               --fprod "/* enumerations from \"@filename@\" */\n" \
+               --fprod "#include \"@filename@\"\n" \
+               --vhead "GType\n@enum_name@_get_type (void)\n{\n" \
+               --vhead "    static GType type = 0;\n\n" \
+               --vhead "    if (!type)\n    {\n" \
+               --vhead "        static const G@Type@Value _@enum_name@_values[] = {" \
+               --vprod "            { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+               --vtail "            { 0, NULL, NULL }\n        };\n\n" \
+               --vtail "        type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n    
}\n\n" \
+               --vtail "  return type;\n}\n\n" \
+               $(enumheaders) > $@
+
+gssdp-enums.h: $(enumheaders) Makefile
+       $(AM_V_GEN)$(GLIB_MKENUMS) \
+               --identifier-prefix GSSDP \
+               --symbol-prefix gssdp \
+               --fhead "#ifndef GSSDP_ENUMS_H\n" \
+               --fhead "#define GSSDP_ENUMS_H\n\n" \
+               --fhead "#include <glib-object.h>\n\n" \
+               --fhead "G_BEGIN_DECLS\n\n" \
+               --fprod "/* enumerations from @filename@ */\n" \
+               --vhead "GType @enum_name@_get_type (void);\n" \
+               --vhead "#define GSSDP_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+               --ftail "G_END_DECLS\n\n" \
+               --ftail "#endif /* GSSDP_ENUMS_H */" \
+               $(enumheaders) > $@
 
 introspection_sources = $(libgssdpinc_HEADERS) \
                        gssdp-client.c          \
diff --git a/libgssdp/gssdp.h b/libgssdp/gssdp.h
index a43ddf2..4c35d11 100644
--- a/libgssdp/gssdp.h
+++ b/libgssdp/gssdp.h
@@ -23,3 +23,4 @@
 #include "gssdp-error.h"
 #include "gssdp-resource-browser.h"
 #include "gssdp-resource-group.h"
+#include "gssdp-enums.h"
diff --git a/vala/GSSDP-1.2.metadata b/vala/GSSDP-1.2.metadata
index d765a74..1ba29a9 100644
--- a/vala/GSSDP-1.2.metadata
+++ b/vala/GSSDP-1.2.metadata
@@ -1,3 +1 @@
 GSSDP cheader_filename="libgssdp/gssdp.h"
-error_quark skip
-Error skip
diff --git a/vala/Makefile.am b/vala/Makefile.am
index a559013..abc1bdd 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -4,17 +4,15 @@ gssdp-1.2.vapi: gssdp-1.2.stamp
        @true
 
 gssdp-1.2.stamp: $(top_builddir)/libgssdp/GSSDP-1.2.gir \
-               $(srcdir)/GSSDP-1.2.metadata \
-               $(srcdir)/gssdp-1.2-custom.vala
+               $(srcdir)/GSSDP-1.2.metadata
        $(AM_V_GEN)$(VAPIGEN) --metadatadir=$(srcdir) \
                              --library=gssdp-1.2 --pkg=gio-2.0 --pkg=libsoup-2.4 \
                              $(top_builddir)/libgssdp/GSSDP-1.2.gir \
-                                 $(srcdir)/gssdp-1.2-custom.vala && \
-       echo timestmap > $(@F)
+       && echo timestmap > $(@F)
 
 vapidir = $(datadir)/vala/vapi
 vapi_DATA = gssdp-1.2.vapi $(srcdir)/gssdp-1.2.deps
 CLEANFILES = gssdp-1.2.vapi gssdp-1.2.stamp
-EXTRA_DIST = gssdp-1.2.deps GSSDP-1.2.metadata gssdp-1.2-custom.vala gssdp-1.2.vapi gssdp-1.2.stamp
+EXTRA_DIST = gssdp-1.2.deps GSSDP-1.2.metadata gssdp-1.2.vapi gssdp-1.2.stamp
 endif
 endif


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