[gimp] plug-ins: set most common CreatorContactInfo last in metadata-editor.



commit d00fe2bfe248dbfda42174da0e33e77eddd7ceb1
Author: Jacob Boerema <jgboerema gmail com>
Date:   Sun Mar 14 19:19:09 2021 -0400

    plug-ins: set most common CreatorContactInfo last in metadata-editor.
    
    Set Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:* last since the short
    form Xmp.iptc.Ci* could have been used to set this information too.
    
    Becausethe first (longer) form is the most common let that override the
    shorter form in the (unlikely) case that both are present and also have
    different values.
    
    Due to a bug in the metadata-editor previously only the short form
    was saved.

 plug-ins/metadata/metadata-editor.c | 67 ++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 30 deletions(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index f1dbd95948..abb1836ba0 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -2025,36 +2025,6 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
 
   /* Set up tag data */
 
-  for (i = 0; i < creatorContactInfoHeader.size; i++)
-    {
-      GtkWidget *widget;
-
-      widget = builder_get_widget (builder, creatorContactInfoTags[i].id);
-
-      value = gexiv2_metadata_get_tag_interpreted_string (metadata,
-                                                          creatorContactInfoTags[i].tag);
-
-      if (value)
-        {
-          gchar *value_utf;
-
-          value_utf = clean_xmp_string (value);
-          g_free (value);
-
-          if (! strcmp ("single", creatorContactInfoTags[i].mode))
-            {
-              gtk_entry_set_text (GTK_ENTRY (widget), value_utf);
-            }
-          else if (! strcmp ("multi", creatorContactInfoTags[i].mode))
-            {
-              GtkTextBuffer *buffer;
-              buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
-              gtk_text_buffer_set_text (buffer, value_utf, -1);
-            }
-          g_free (value_utf);
-        }
-    }
-
   for (i = 0; i < numele; i++)
     {
       GtkWidget *widget;
@@ -3619,6 +3589,43 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
         }
     }
 
+  /* Set Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:* last since the short form
+   * Xmp.iptc.Ci* could have been used to set this information too. Because
+   * the first (longer) form is the most common let that override the shorter
+   * form in the (unlikely) case that both are present and also have
+   * different values. Due to a bug in the metadata-editor previously only
+   * the short form was saved.
+   */
+  for (i = 0; i < creatorContactInfoHeader.size; i++)
+    {
+      GtkWidget *widget;
+
+      widget = builder_get_widget (builder, creatorContactInfoTags[i].id);
+
+      value = gexiv2_metadata_get_tag_interpreted_string (metadata,
+                                                          creatorContactInfoTags[i].tag);
+
+      if (value)
+        {
+          gchar *value_utf;
+
+          value_utf = clean_xmp_string (value);
+          g_free (value);
+
+          if (! strcmp ("single", creatorContactInfoTags[i].mode))
+            {
+              gtk_entry_set_text (GTK_ENTRY (widget), value_utf);
+            }
+          else if (! strcmp ("multi", creatorContactInfoTags[i].mode))
+            {
+              GtkTextBuffer *buffer;
+              buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
+              gtk_text_buffer_set_text (buffer, value_utf, -1);
+            }
+          g_free (value_utf);
+        }
+    }
+
   /* Set creation date */
   entry_widget = builder_get_widget (builder, "create_date_button");
   g_signal_connect (entry_widget, "clicked",


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