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.
This commit is contained in:
Jehan 2020-11-24 14:24:58 +01:00
parent 5bbc7899bc
commit e53ce2fde9
1 changed files with 17 additions and 5 deletions

View File

@ -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;
}