[gexiv2] Generate VAPI file from GIR file



commit dd134ba03eda528803820e2a71caac9f960d895f
Author: Jens Georg <mail jensge org>
Date:   Sun Jul 17 11:12:09 2016 +0200

    Generate VAPI file from GIR file
    
    Signed-off-by: Jens Georg <mail jensge org>

 Makefile.am               |   22 +++++++----
 configure.ac              |    7 ++++
 gexiv2.vapi               |   88 +++++++++++---------------------------------
 vapi/GExiv2-0.10.metadata |    7 ++++
 vapi/Makefile             |   11 ------
 vapi/gexiv2.excludes      |    5 ---
 vapi/gexiv2.files         |    2 -
 vapi/gexiv2.metadata      |   63 --------------------------------
 vapi/gexiv2.namespace     |    1 -
 9 files changed, 50 insertions(+), 156 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 43a776b..47eec10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,11 +36,20 @@ py3gi_DATA      = GExiv2.py
 endif
 endif
 
-.PHONY: vapi
-vapi:
-       @echo NOTE: This version of gexiv2 $(GEXIV2_VERSION) must be installed to generate a VAPI file.
-       pkg-config --exact-version=$(GEXIV2_VERSION) --print-errors gexiv2
-       make -C vapi
+vapi: gexiv2.vapi
+
+gexiv2.vapi: gexiv2_vapi.stamp
+       @true
+
+gexiv2_vapi.stamp: $(top_builddir)/GExiv2-0.10.gir $(top_srcdir)/vapi/GExiv2-0.10.metadata
+       rm -f $(@F)
+       $(AM_V_GEN)$(VAPIGEN) --metadatadir=$(top_srcdir)/vapi \
+                             --library=gexiv2 \
+                             $(top_builddir)/GExiv2-0.10.gir
+       echo timestmap > $(@F)
+
+dist_vapi_DATA = gexiv2.vapi
+EXTRA_DIST += $(top_srcdir)/vala/GExiv2-0.10.metadata gexiv2.vapi gexiv2.stamp
 
 GEXIV2_public_HEADERS = \
        $(srcdir)/gexiv2/gexiv2.h \
@@ -70,9 +79,6 @@ GEXIV2_sources = \
        gexiv2/gexiv2-preview-properties-private.h \
        gexiv2/gexiv2-preview-image-private.h
 
-dist_vapi_DATA = \
-       @PACKAGE_NAME@.vapi
-
 # compilation setup. #
 
 if PLATFORM_WIN32
diff --git a/configure.ac b/configure.ac
index 095f3c8..1d933f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,6 +222,12 @@ esac
 AC_MSG_RESULT([$platform_win32])
 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
 
+################
+# Check for VALA
+################
+
+VAPIGEN_CHECK
+
 ##############
 # Generation #
 ##############
@@ -229,6 +235,7 @@ AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
 AC_CONFIG_FILES([
 Makefile
 gexiv2.pc:gexiv2.pc.in
+vapi/Makefile
 ])
 
 AC_OUTPUT
diff --git a/gexiv2.vapi b/gexiv2.vapi
index 9e1cb6d..901931e 100644
--- a/gexiv2.vapi
+++ b/gexiv2.vapi
@@ -1,24 +1,9 @@
-/* gexiv2.vapi generated by vapigen, do not modify. */
+/* gexiv2.vapi generated by vapigen-0.32, do not modify. */
 
-[CCode (lower_case_cprefix = "gexiv2_")]
+[CCode (cprefix = "GExiv2", gir_namespace = "GExiv2", gir_version = "0.10", lower_case_cprefix = "gexiv2_")]
 namespace GExiv2 {
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       [Compact]
-       public class ManagedStreamCallbacks {
-               public weak GExiv2.Stream_CanRead CanRead;
-               public weak GExiv2.Stream_CanSeek CanSeek;
-               public weak GExiv2.Stream_CanWrite CanWrite;
-               public weak GExiv2.Stream_Flush Flush;
-               public weak GExiv2.Stream_Length Length;
-               public weak GExiv2.Stream_Position Position;
-               public weak GExiv2.Stream_Read Read;
-               public weak GExiv2.Stream_Seek Seek;
-               public weak GExiv2.Stream_Write Write;
-               public void* handle;
-       }
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       [Compact]
-       public class Metadata {
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", type_id = "gexiv2_metadata_get_type ()")]
+       public class Metadata : GLib.Object {
                [CCode (has_construct_function = false)]
                public Metadata ();
                public void clear ();
@@ -29,13 +14,13 @@ namespace GExiv2 {
                public void clear_xmp ();
                public void delete_gps_info ();
                public void erase_exif_thumbnail ();
-               public bool from_app1_segment ([CCode (array_length = false)] uchar[] data, long n_data) 
throws GLib.Error;
+               public bool from_app1_segment ([CCode (array_length_cname = "n_data", array_length_pos = 1.1, 
array_length_type = "glong")] uint8[] data) throws GLib.Error;
                public string? generate_xmp_packet (GExiv2.XmpFormatFlags xmp_format_flags, uint32 padding);
                public string? get_comment ();
                public bool get_exif_tag_rational (string tag, out int nom, out int den);
                [CCode (array_length = false, array_null_terminated = true)]
                public string[] get_exif_tags ();
-               public bool get_exif_thumbnail (out uchar[] buffer);
+               public bool get_exif_thumbnail ([CCode (array_length_cname = "size", array_length_pos = 1.1)] 
out uint8[] buffer);
                public bool get_exposure_time (out int nom, out int den);
                public double get_fnumber ();
                public double get_focal_length ();
@@ -52,7 +37,7 @@ namespace GExiv2 {
                public int get_pixel_width ();
                public GExiv2.PreviewImage get_preview_image (GExiv2.PreviewProperties props);
                [CCode (array_length = false, array_null_terminated = true)]
-               public unowned GExiv2.PreviewProperties?[] get_preview_properties ();
+               public unowned GExiv2.PreviewProperties[]? get_preview_properties ();
                public bool get_supports_exif ();
                public bool get_supports_iptc ();
                public bool get_supports_xmp ();
@@ -64,7 +49,7 @@ namespace GExiv2 {
                public string[]? get_tag_multiple (string tag);
                public GLib.Bytes? get_tag_raw (string tag);
                public string? get_tag_string (string tag);
-               public static unowned string get_tag_type (string tag);
+               public static unowned string? get_tag_type (string tag);
                public string? get_xmp_packet ();
                [CCode (array_length = false, array_null_terminated = true)]
                public string[] get_xmp_tags ();
@@ -75,15 +60,13 @@ namespace GExiv2 {
                public static bool is_exif_tag (string tag);
                public static bool is_iptc_tag (string tag);
                public static bool is_xmp_tag (string tag);
-               public bool open_buf ([CCode (array_length = false)] uchar[] data, long n_data) throws 
GLib.Error;
+               public bool open_buf ([CCode (array_length_cname = "n_data", array_length_pos = 1.1, 
array_length_type = "glong")] uint8[] data) throws GLib.Error;
                public bool open_path (string path) throws GLib.Error;
-               public bool open_stream (GExiv2.ManagedStreamCallbacks cb) throws GLib.Error;
                public static bool register_xmp_namespace (string name, string prefix);
                public bool save_file (string path) throws GLib.Error;
-               public bool save_stream (GExiv2.ManagedStreamCallbacks cb) throws GLib.Error;
                public void set_comment (string comment);
                public bool set_exif_tag_rational (string tag, int nom, int den);
-               public void set_exif_thumbnail_from_buffer ([CCode (array_length_pos = 1.9)] uchar[] buffer);
+               public void set_exif_thumbnail_from_buffer ([CCode (array_length_cname = "size", 
array_length_pos = 1.1)] uint8[] buffer);
                public bool set_exif_thumbnail_from_file (string path) throws GLib.Error;
                public bool set_gps_info (double longitude, double latitude, double altitude);
                public void set_orientation (GExiv2.Orientation orientation);
@@ -94,9 +77,11 @@ namespace GExiv2 {
                public static void unregister_all_xmp_namespaces ();
                public static bool unregister_xmp_namespace (string name);
        }
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       [Compact]
-       public class PreviewImage {
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", type_id = "gexiv2_preview_image_get_type ()")]
+       public class PreviewImage : GLib.Object {
+               [CCode (has_construct_function = false)]
+               protected PreviewImage ();
+               [CCode (array_length_pos = 0.1, array_length_type = "guint32")]
                public unowned uint8[] get_data ();
                public unowned string get_extension ();
                public uint32 get_height ();
@@ -104,9 +89,10 @@ namespace GExiv2 {
                public uint32 get_width ();
                public long write_file (string path);
        }
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       [Compact]
-       public class PreviewProperties {
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", type_id = "gexiv2_preview_properties_get_type ()")]
+       public class PreviewProperties : GLib.Object {
+               [CCode (has_construct_function = false)]
+               protected PreviewProperties ();
                public unowned string get_extension ();
                public uint32 get_height ();
                public unowned string get_mime_type ();
@@ -143,12 +129,6 @@ namespace GExiv2 {
                SEQ,
                LANG
        }
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", cprefix = "", has_type_id = false)]
-       public enum WrapperSeekOrigin {
-               Begin,
-               Current,
-               End
-       }
        [CCode (cheader_filename = "gexiv2/gexiv2.h", cprefix = "GEXIV2_", has_type_id = false)]
        public enum XmpFormatFlags {
                OMIT_PACKET_WRAPPER,
@@ -161,43 +141,19 @@ namespace GExiv2 {
        }
        [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
        public delegate void LogHandler (GExiv2.LogLevel level, string msg);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate bool Stream_CanRead (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate bool Stream_CanSeek (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate bool Stream_CanWrite (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate void Stream_Flush (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate int64 Stream_Length (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate int64 Stream_Position (void* handle);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate int32 Stream_Read (void* handle, void* buffer, int32 offset, int32 count);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate void Stream_Seek (void* handle, int64 offset, GExiv2.WrapperSeekOrigin origin);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)]
-       public delegate void Stream_Write (void* handle, void* buffer, int32 offset, int32 count);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", cname = "GEXIV2_MAJOR_VERSION")]
        public const int MAJOR_VERSION;
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", cname = "GEXIV2_MICRO_VERSION")]
        public const int MICRO_VERSION;
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
+       [CCode (cheader_filename = "gexiv2/gexiv2.h", cname = "GEXIV2_MINOR_VERSION")]
        public const int MINOR_VERSION;
        [CCode (cheader_filename = "gexiv2/gexiv2.h")]
        public static int get_version ();
        [CCode (cheader_filename = "gexiv2/gexiv2.h")]
        public static bool initialize ();
        [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       public static unowned GExiv2.LogHandler log_get_default_handler ();
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       public static unowned GExiv2.LogHandler log_get_handler ();
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
        public static GExiv2.LogLevel log_get_level ();
        [CCode (cheader_filename = "gexiv2/gexiv2.h")]
-       public static void log_set_handler (GExiv2.LogHandler handler);
-       [CCode (cheader_filename = "gexiv2/gexiv2.h")]
        public static void log_set_level (GExiv2.LogLevel level);
        [CCode (cheader_filename = "gexiv2/gexiv2.h")]
        public static void log_use_glib_logging ();
diff --git a/vapi/GExiv2-0.10.metadata b/vapi/GExiv2-0.10.metadata
new file mode 100644
index 0000000..8660a85
--- /dev/null
+++ b/vapi/GExiv2-0.10.metadata
@@ -0,0 +1,7 @@
+GExiv2 cheader_filename="gexiv2/gexiv2.h"
+
+Metadata
+    .free skip
+
+PreviewImage
+    .free skip


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