[gthumb] exiv2_tools: save the image keyworks in the Xmp::dc::subject tag as well



commit 8da0434c332bc622e65ac4e429363db109d0186b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Oct 25 13:37:22 2011 +0200

    exiv2_tools: save the image keyworks in the Xmp::dc::subject tag as well
    
    Use common tag arrays to be sure to update all the used tags.

 extensions/exiv2_tools/exiv2-utils.h               |    3 ++
 .../exiv2_tools/gth-metadata-provider-exiv2.c      |   24 ++++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.h b/extensions/exiv2_tools/exiv2-utils.h
index cf44fb3..951bf26 100644
--- a/extensions/exiv2_tools/exiv2-utils.h
+++ b/extensions/exiv2_tools/exiv2-utils.h
@@ -31,6 +31,9 @@ G_BEGIN_DECLS
 extern const char *_LAST_DATE_TAG_NAMES[];
 extern const char *_ORIGINAL_DATE_TAG_NAMES[];
 extern const char *_DESCRIPTION_TAG_NAMES[];
+extern const char *_TITLE_TAG_NAMES[];
+extern const char *_LOCATION_TAG_NAMES[];
+extern const char *_KEYWORDS_TAG_NAMES[];
 
 gboolean   exiv2_read_metadata_from_file    (GFile           *file,
 					     GFileInfo       *info,
diff --git a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
index e321755..99be2d9 100644
--- a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
+++ b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
@@ -176,35 +176,35 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider   *self,
 	metadata = g_file_info_get_attribute_object (file_data->info, "general::title");
 	if (metadata != NULL) {
 		g_object_set (metadata, "value-type", NULL, NULL);
-		g_file_info_set_attribute_object (file_data->info, "Xmp::dc::title", metadata);
-		g_file_info_set_attribute_object (file_data->info, "Iptc::Application2::Headline", metadata);
+		for (i = 0; _TITLE_TAG_NAMES[i] != NULL; i++)
+			g_file_info_set_attribute_object (file_data->info, _TITLE_TAG_NAMES[i], metadata);
 	}
 	else {
-		g_file_info_remove_attribute (file_data->info, "Xmp::dc::title");
-		g_file_info_remove_attribute (file_data->info, "Iptc::Application2::Headline");
+		for (i = 0; _TITLE_TAG_NAMES[i] != NULL; i++)
+			g_file_info_remove_attribute (file_data->info, _TITLE_TAG_NAMES[i]);
 	}
 
 	metadata = g_file_info_get_attribute_object (file_data->info, "general::location");
 	if (metadata != NULL) {
 		g_object_set (metadata, "value-type", NULL, NULL);
-		g_file_info_set_attribute_object (file_data->info, "Xmp::iptc::Location", metadata);
-		g_file_info_set_attribute_object (file_data->info, "Iptc::Application2::LocationName", metadata);
+		for (i = 0; _LOCATION_TAG_NAMES[i] != NULL; i++)
+			g_file_info_set_attribute_object (file_data->info, _LOCATION_TAG_NAMES[i], metadata);
 	}
 	else {
-		g_file_info_remove_attribute (file_data->info, "Xmp::iptc::Location");
-		g_file_info_remove_attribute (file_data->info, "Iptc::Application2::LocationName");
+		for (i = 0; _LOCATION_TAG_NAMES[i] != NULL; i++)
+			g_file_info_remove_attribute (file_data->info, _LOCATION_TAG_NAMES[i]);
 	}
 
 	metadata = g_file_info_get_attribute_object (file_data->info, "general::tags");
 	if (metadata != NULL) {
 		if (GTH_IS_METADATA (metadata))
 			g_object_set (metadata, "value-type", NULL, NULL);
-		g_file_info_set_attribute_object (file_data->info, "Xmp::iptc::Keywords", metadata);
-		g_file_info_set_attribute_object (file_data->info, "Iptc::Application2::Keywords", metadata);
+		for (i = 0; _KEYWORDS_TAG_NAMES[i] != NULL; i++)
+			g_file_info_set_attribute_object (file_data->info, _KEYWORDS_TAG_NAMES[i], metadata);
 	}
 	else {
-		g_file_info_remove_attribute (file_data->info, "Xmp::iptc::Keywords");
-		g_file_info_remove_attribute (file_data->info, "Iptc::Application2::Keywords");
+		for (i = 0; _KEYWORDS_TAG_NAMES[i] != NULL; i++)
+			g_file_info_remove_attribute (file_data->info, _KEYWORDS_TAG_NAMES[i]);
 	}
 
 	metadata = g_file_info_get_attribute_object (file_data->info, "general::datetime");



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