[gimp/gimp-2-10] plug-ins: fix not showing all values of iptc tags that appear more than once.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: fix not showing all values of iptc tags that appear more than once.
- Date: Fri, 20 Nov 2020 02:51:21 +0000 (UTC)
commit f6bed86934b0832224d96fb34d9877175a4566a1
Author: Jacob Boerema <jgboerema gmail com>
Date: Mon Nov 16 19:09:07 2020 -0500
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.
(cherry picked from commit 879b3745d2a895b1decad5cac214ece4911175a7)
plug-ins/metadata/metadata-editor.c | 46 +++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index ccd0a88f5f..84982df512 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -1894,8 +1894,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,
- equivalent_metadata_tags[index].tag);
+ 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);
+ }
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]