plug-ins: fix not showing all values of iptc tags that appear more than once.

This is one of the problems mentioned in issue #5863. This commit fixes
this problem in the metadata-editor by using gexiv2_metadata_get_tag_multiple.
Empty string values will be skipped.
This commit is contained in:
Jacob Boerema 2020-11-16 19:09:07 -05:00 committed by Jehan
parent bd2f43bf20
commit 879b3745d2
1 changed files with 44 additions and 2 deletions

View File

@ -1910,8 +1910,50 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
index = default_metadata_tags[i].other_tag_index;
if (index > -1)
{
value = gexiv2_metadata_get_tag_interpreted_string (metadata,
gchar **values;
/* These are all IPTC tags some of which can appear multiple times so
* we will use get_tag_multiple. Also IPTC most commonly uses UTF-8
* not current locale so get_tag_interpreted was wrong anyway.
* FIXME For now lets interpret as UTF-8 and in the future read
* and interpret based on the CharacterSet tag.
*/
values = gexiv2_metadata_get_tag_multiple (metadata,
equivalent_metadata_tags[index].tag);
if (values)
{
gint i;
GString *str = NULL;
for (i = 0; values[i] != NULL; i++)
{
if (values[i][0] != '\0')
{
if (! str)
{
str = g_string_new (values[i]);
}
else
{
if (! strcmp ("multi", equivalent_metadata_tags[index].mode))
{
g_string_append (str, "\n");
}
else
{
g_string_append (str, ", ");
}
g_string_append (str, values[i]);
}
}
}
if (str)
{
value = g_string_free (str, FALSE);
}
}
}
}