[shotwell/shotwell-0.30] Fix building against latest gexiv2



commit 318c30394f4661e8d96e4fd906356a0736a30504
Author: Jens Georg <mail jensge org>
Date:   Fri Feb 8 14:34:37 2019 +0100

    Fix building against latest gexiv2
    
    Fixes #106

 meson.build                   | 3 +++
 src/photos/PhotoMetadata.vala | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 4c9f6031..1d9a4932 100644
--- a/meson.build
+++ b/meson.build
@@ -53,6 +53,9 @@ gstreamer_pbu = dependency('gstreamer-pbutils-1.0', version : '>= 1.0')
 gphoto2 = dependency('libgphoto2', version : '>= 2.5.0')
 gudev = dependency('gudev-1.0', version : '>= 145', required: false)
 gexiv2 = dependency('gexiv2', version: '>= 0.10.4')
+if gexiv2.version().version_compare('>= 0.11')
+  add_global_arguments(['--define=NEW_GEXIV2_API'], language : 'vala')
+endif
 libraw = dependency('libraw', version : '>= 0.13.2')
 libexif = dependency('libexif', version : '>= 0.6.16')
 unity = dependency('unity', required : false)
diff --git a/src/photos/PhotoMetadata.vala b/src/photos/PhotoMetadata.vala
index 2c2d6c5a..06b49cab 100644
--- a/src/photos/PhotoMetadata.vala
+++ b/src/photos/PhotoMetadata.vala
@@ -276,7 +276,11 @@ public class PhotoMetadata : MediaMetadata {
         exiv2 = new GExiv2.Metadata();
         exif = null;
         
+#if NEW_GEXIV2_API
+        exiv2.open_buf(buffer[0:length]);
+#else
         exiv2.open_buf(buffer, length);
+#endif
         exif = Exif.Data.new_from_data(buffer, length);
         source_name = "<memory buffer %d bytes>".printf(length);
     }
@@ -285,8 +289,11 @@ public class PhotoMetadata : MediaMetadata {
         exiv2 = new GExiv2.Metadata();
         exif = null;
         
-        exiv2.from_app1_segment(buffer.get_data(), (long) buffer.get_size());
+#if NEW_GEXIV2_API
+        exiv2.from_app1_segment(buffer.get_data());
+#else
         exif = Exif.Data.new_from_data(buffer.get_data(), buffer.get_size());
+#endif
         source_name = "<app1 segment %zu bytes>".printf(buffer.get_size());
     }
     


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