summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gratton <mike@vee.net>2019-12-26 01:07:09 +1000
committerJeffrey Stedfast <jestedfa@microsoft.com>2019-12-25 10:07:09 -0500
commitb53c1894e1df2b821962a0d8e414e9ae8da52a1b (patch)
tree77a34a76394cc65766aaf501cd2939d4d69e3faf
parent3b71f3ff9e4d8882b685ba8071945f80833b62c5 (diff)
downloadgmime-b53c1894e1df2b821962a0d8e414e9ae8da52a1b.tar.gz
Fix vala abstract public constructor warning (#76)
This fixes "Creation method of abstract class cannot be public" warnings when compiling with recent valac. Since `g_mime_object_new[_type]` are effectively static factory methods rather than constructors, suppress their use as ctors and bind using custom static methods.
-rw-r--r--gmime/GMime-3.0-custom.vala13
-rw-r--r--gmime/GMime-3.0.metadata5
-rw-r--r--gmime/Makefile.am4
3 files changed, 20 insertions, 2 deletions
diff --git a/gmime/GMime-3.0-custom.vala b/gmime/GMime-3.0-custom.vala
new file mode 100644
index 00000000..d958b291
--- /dev/null
+++ b/gmime/GMime-3.0-custom.vala
@@ -0,0 +1,13 @@
+namespace GMime {
+
+ public abstract class Object : GLib.Object {
+ [CCode (cname = "g_mime_object_new")]
+ public static Object new_for_type(GMime.ParserOptions? options,
+ GMime.ContentType content_type);
+ [CCode (cname = "g_mime_object_new_type")]
+ public static Object new_for_type_str(GMime.ParserOptions? options,
+ string type,
+ string subtype);
+ }
+
+}
diff --git a/gmime/GMime-3.0.metadata b/gmime/GMime-3.0.metadata
index 1adbbfb9..46c4a6d1 100644
--- a/gmime/GMime-3.0.metadata
+++ b/gmime/GMime-3.0.metadata
@@ -2,6 +2,11 @@ InternetAddress
.to_string#method name="to_new_string"
References struct=false
+// These are actually static factory methods
+Object
+ .new skip
+ .new_type skip
+
// G-I can't handle non-boxed types
PartIter struct=false
diff --git a/gmime/Makefile.am b/gmime/Makefile.am
index 71d7e6d2..35ade9db 100644
--- a/gmime/Makefile.am
+++ b/gmime/Makefile.am
@@ -225,12 +225,12 @@ endif
if ENABLE_VAPIGEN
-include $(VAPIGEN_MAKEFILE)
-gmime-3.0.vapi: GMime-3.0.gir GMime-3.0.metadata
+gmime-3.0.vapi: GMime-3.0.gir GMime-3.0.metadata GMime-3.0-custom.vala
VAPIGEN_VAPIS = gmime-3.0.vapi
gmime_3_0_vapi_DEPS = gio-2.0
gmime_3_0_vapi_METADATADIRS = $(srcdir)
-gmime_3_0_vapi_FILES = GMime-3.0.gir
+gmime_3_0_vapi_FILES = GMime-3.0.gir GMime-3.0-custom.vala
gmime-3.0.deps:
$(AM_V_GEN) for pkg in $(gmime_3_0_vapi_DEPS); do \