[gimp] libgimp: output a "saving metadata failed" message when relevant.



commit e53ce2fde9da336e67a0467392f30f1c290b5a74
Author: Jehan <jehan girinstud io>
Date:   Tue Nov 24 14:24:58 2020 +0100

    libgimp: output a "saving metadata failed" message when relevant.
    
    Similar to the message present in file-jpeg. The latter will anyway
    disappear when we will have finally ported file-jpeg to newer
    GimpSaveProcedure API, and it's better to have it outputted here so that
    it will work for every export formats.

 libgimp/gimpprocedureconfig.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c
index a7e71f4cd3..6c0082d846 100644
--- a/libgimp/gimpprocedureconfig.c
+++ b/libgimp/gimpprocedureconfig.c
@@ -846,6 +846,7 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
   if (config->priv->metadata && ! config->priv->metadata_saved)
     {
       GObjectClass *object_class = G_OBJECT_GET_CLASS (config);
+      GError       *error        = NULL;
       gint          i;
 
       for (i = 0; i < G_N_ELEMENTS (metadata_properties); i++)
@@ -869,11 +870,22 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
             }
         }
 
-      gimp_image_metadata_save_finish (exported_image,
-                                       config->priv->mime_type,
-                                       config->priv->metadata,
-                                       config->priv->metadata_flags,
-                                       file, NULL);
+      if (! gimp_image_metadata_save_finish (exported_image,
+                                             config->priv->mime_type,
+                                             config->priv->metadata,
+                                             config->priv->metadata_flags,
+                                             file, &error))
+        {
+          if (error)
+            {
+              /* Even though a failure to write metadata is not enough
+                 reason to say we failed to save the image, we should
+                 still notify the user about the problem. */
+              g_message ("%s: saving metadata failed: %s",
+                         G_STRFUNC, error->message);
+              g_error_free (error);
+            }
+        }
 
       config->priv->metadata_saved = TRUE;
     }


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