[gmime] Fix vala abstract public constructor warning (#76)
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fix vala abstract public constructor warning (#76)
- Date: Tue, 5 May 2020 15:47:34 +0000 (UTC)
commit b53c1894e1df2b821962a0d8e414e9ae8da52a1b
Author: Michael Gratton <mike vee net>
Date: Thu Dec 26 01:07:09 2019 +1000
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.
gmime/GMime-3.0-custom.vala | 13 +++++++++++++
gmime/GMime-3.0.metadata | 5 +++++
gmime/Makefile.am | 4 ++--
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 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]