[gnome-photos] gexiv2: stop using deprecated gexiv2 API



commit 2388a6dd9a9219df02e738e220f4c2f193d5a6c6
Author: Stephan Vedder <vedder mbits info>
Date:   Fri Jul 22 11:09:24 2022 +0200

    gexiv2: stop using deprecated gexiv2 API
    
    Instead use the new API, which fills GError itself

 meson.build              | 2 +-
 src/photos-application.c | 2 +-
 src/photos-base-item.c   | 2 +-
 src/photos-local-item.c  | 8 +++-----
 4 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/meson.build b/meson.build
index 63d480f8..b3240247 100644
--- a/meson.build
+++ b/meson.build
@@ -157,7 +157,7 @@ cairo_dep = dependency('cairo', version: '>= 1.14.0')
 gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.36.8')
 gegl_dep = dependency('gegl-0.4', version: '>= 0.4.0')
 geocode_glib_dep = dependency('geocode-glib-2.0')
-gexiv_dep = dependency('gexiv2', version: '>= 0.10.8')
+gexiv_dep = dependency('gexiv2', version: '>= 0.14.0')
 gio_dep = dependency('gio-2.0')
 gio_unix_dep = dependency('gio-unix-2.0')
 glib_dep = dependency('glib-2.0', version: '>= 2.62.0')
diff --git a/src/photos-application.c b/src/photos-application.c
index e8ddd63a..91d3aec6 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -728,7 +728,7 @@ photos_application_create_window (PhotosApplication *self)
   gexiv2_initialized = gexiv2_initialize ();
   g_return_val_if_fail (gexiv2_initialized, FALSE);
 
-  gexiv2_registered_namespace = gexiv2_metadata_register_xmp_namespace ("http://www.gnome.org/xmp";, "gnome");
+  gexiv2_registered_namespace = gexiv2_metadata_try_register_xmp_namespace ("http://www.gnome.org/xmp";, 
"gnome", NULL);
   g_return_val_if_fail (gexiv2_registered_namespace, FALSE);
 
   photos_application_start_miners (self);
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 3b20bc2e..f249d359 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1995,7 +1995,7 @@ photos_base_item_save_metadata_in_thread_func (GTask *task,
       }
   }
 
-  gexiv2_metadata_set_orientation (metadata, GEXIV2_ORIENTATION_NORMAL);
+  gexiv2_metadata_try_set_orientation (metadata, GEXIV2_ORIENTATION_NORMAL, NULL);
   export_path = g_file_get_path (export_file);
 
   {
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 3f2858f1..636c6d69 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -320,9 +320,8 @@ photos_local_item_metadata_add_shared (PhotosBaseItem  *item,
   if (!gexiv2_metadata_open_path (metadata, path, error))
     goto out;
 
-  if (!gexiv2_metadata_set_tag_long (metadata, version_tag, 0))
+  if (!gexiv2_metadata_try_set_tag_long (metadata, version_tag, 0, error))
     {
-      g_set_error (error, PHOTOS_ERROR, 0, "Failed to update %s", version_tag);
       goto out;
     }
 
@@ -337,7 +336,7 @@ photos_local_item_metadata_add_shared (PhotosBaseItem  *item,
 
     g_variant_builder_add (&builder, tuple_type_format, provider_type, account_identity, shared_id);
 
-    shared_string = gexiv2_metadata_get_tag_string (metadata, shared_tag);
+    shared_string = gexiv2_metadata_try_get_tag_string (metadata, shared_tag, NULL);
     if (shared_string != NULL)
       {
         g_autoptr (GVariant) old_shared_variant = NULL;
@@ -365,9 +364,8 @@ photos_local_item_metadata_add_shared (PhotosBaseItem  *item,
     g_autofree gchar *shared_string = NULL;
 
     shared_string = g_variant_print (shared_variant, TRUE);
-    if (!gexiv2_metadata_set_tag_string (metadata, shared_tag, shared_string))
+    if (!gexiv2_metadata_try_set_tag_string (metadata, shared_tag, shared_string, error))
       {
-        g_set_error (error, PHOTOS_ERROR, 0, "Failed to update %s", shared_tag);
         goto out;
       }
   }


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