[gthumb] Fixed metadata lost after resize



commit ad6822134d001d48c301d92e17042ee8cd0aa7d5
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Mar 2 17:14:52 2010 +0100

    Fixed metadata lost after resize
    
    Added a type field to GthMetadataInfo and use it when saving metadata
    with exiv2.  This avoid type errors when a field is not known.
    
    [bug #610389]

 extensions/comments/main.c             |   12 +-
 extensions/exiv2_tools/exiv2-utils.cpp |   54 ++++++++--
 extensions/exiv2_tools/main.c          |  180 ++++++++++++++++----------------
 extensions/gstreamer_tools/main.c      |   26 +++---
 gthumb/gth-main-default-metadata.c     |   34 +++---
 gthumb/gth-metadata.c                  |    2 +
 gthumb/gth-metadata.h                  |    1 +
 7 files changed, 174 insertions(+), 135 deletions(-)
---
diff --git a/extensions/comments/main.c b/extensions/comments/main.c
index 070a309..dc0f3bf 100644
--- a/extensions/comments/main.c
+++ b/extensions/comments/main.c
@@ -38,12 +38,12 @@ GthMetadataCategory comments_metadata_category[] = {
 
 
 GthMetadataInfo comments_metadata_info[] = {
-	{ "comment::caption", "", "comment", 1, GTH_METADATA_ALLOW_NOWHERE },
-	{ "comment::note", "", "comment", 2, GTH_METADATA_ALLOW_NOWHERE },
-	{ "comment::place", "", "comment", 3, GTH_METADATA_ALLOW_NOWHERE },
-	{ "comment::time", "", "comment", 4, GTH_METADATA_ALLOW_NOWHERE },
-	{ "comment::categories", "", "comment", 5, GTH_METADATA_ALLOW_NOWHERE },
-	{ "comment::rating", "", "comment", 6, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::caption", "", "comment", 1, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::note", "", "comment", 2, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::place", "", "comment", 3, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::time", "", "comment", 4, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::categories", "", "comment", 5, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "comment::rating", "", "comment", 6, NULL, GTH_METADATA_ALLOW_NOWHERE },
 	{ NULL, NULL, NULL, 0, 0 }
 };
 
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index 6d31b4a..74df98a 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -186,13 +186,14 @@ attribute_is_date (const char *key)
 }
 
 
-inline static void
+static void
 set_file_info (GFileInfo  *info,
 	       const char *key,
 	       const char *description,
 	       const char *formatted_value,
 	       const char *raw_value,
-	       const char *category)
+	       const char *category,
+	       const char *type_name)
 {
 	char            *attribute;
 	GthMetadataInfo *metadata_info;
@@ -232,6 +233,7 @@ g_print ("%s (%s): %s (%s)\n", key, description, formatted_value, raw_value);
 		GthMetadataInfo info;
 
 		info.id = attribute;
+		info.type = (type_name != NULL) ? g_strdup (type_name) : NULL;
 		info.display_name = description_utf8;
 		info.category = category;
 		info.sort_order = 500;
@@ -281,7 +283,7 @@ set_attribute_from_tagset (GFileInfo  *info,
 		      "formatted", &formatted_value,
 		      "raw", &raw_value,
 		      NULL);
-	set_file_info (info, attribute, description, formatted_value, raw_value, NULL);
+	set_file_info (info, attribute, description, formatted_value, raw_value, NULL, NULL);
 }
 
 
@@ -378,7 +380,8 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 				       short_name.str().c_str(),
 				       value.str().c_str(),
 				       md->toString().c_str(),
-				       get_exif_default_category (*md));
+				       get_exif_default_category (*md),
+				       md->typeName());
 		}
 	}
 
@@ -397,7 +400,8 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 				       short_name.str().c_str(),
 				       value.str().c_str(),
 				       md->toString().c_str(),
-				       "Iptc");
+				       "Iptc",
+				       md->typeName());
 		}
 	}
 
@@ -416,7 +420,8 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 				       short_name.str().c_str(),
 				       value.str().c_str(),
 				       md->toString().c_str(),
-				       "Xmp::Embedded");
+				       "Xmp::Embedded",
+				       md->typeName());
 		}
 	}
 
@@ -531,7 +536,8 @@ exiv2_read_sidecar (GFile     *file,
 					       short_name.str().c_str(),
 					       value.str().c_str(),
 					       md->toString().c_str(),
-					       "Xmp::Sidecar");
+					       "Xmp::Sidecar",
+					       md->typeName());
 			}
 		}
 		Exiv2::XmpParser::terminate();
@@ -591,6 +597,23 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr  image,
 		key = exiv2_key_from_attribute (attributes[i]);
 
 		try {
+			/* If the metadatum has no value yet, a new empty value
+			 * is created. The type is taken from Exiv2's tag
+			 * lookup tables. If the tag is not found in the table,
+			 * the type defaults to Ascii.
+			 * We always create the metadatum explicilty if the
+			 * type is available to avoid type errors.
+			 * See bug #610389 for more details.  The original
+			 * expanation is here:
+			 * http://uk.groups.yahoo.com/group/exiv2/message/1472
+			 */
+
+			GthMetadataInfo *metadatum_info = gth_main_get_metadata_info (attributes[i]);
+			if ((metadatum_info != NULL) && (metadatum_info->type != NULL)) {
+				Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (metadatum_info->type));
+				Exiv2::ExifKey exif_key(key);
+				ed.add (exif_key, value.get());
+			}
 			ed[key] = gth_metadata_get_raw (metadatum);
 		}
 		catch (Exiv2::AnyError& e) {
@@ -676,6 +699,13 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr  image,
 		char *key = exiv2_key_from_attribute (attributes[i]);
 
 		try {
+			/* See the exif data code above for an explanation. */
+			GthMetadataInfo *metadatum_info = gth_main_get_metadata_info (attributes[i]);
+			if ((metadatum_info != NULL) && (metadatum_info->type != NULL)) {
+				Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (metadatum_info->type));
+				Exiv2::IptcKey iptc_key(key);
+				id.add (iptc_key, value.get());
+			}
 			id[key] = gth_metadata_get_raw (metadatum);
 		}
 		catch (Exiv2::AnyError& e) {
@@ -705,8 +735,16 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr  image,
 		try {
 			const char *value = gth_metadata_get_raw (metadatum);
 
-			if ((value != NULL) && strcmp (value, "") != 0)
+			if ((value != NULL) && strcmp (value, "") != 0) {
+				/* See the exif data code above for an explanation. */
+				GthMetadataInfo *metadatum_info = gth_main_get_metadata_info (attributes[i]);
+				if ((metadatum_info != NULL) && (metadatum_info->type != NULL)) {
+					Exiv2::Value::AutoPtr value = Exiv2::Value::create (Exiv2::TypeInfo::typeId (metadatum_info->type));
+					Exiv2::XmpKey xmp_key(key);
+					xd.add (xmp_key, value.get());
+				}
 				xd[key] = gth_metadata_get_raw (metadatum);
+			}
 		}
 		catch (Exiv2::AnyError& e) {
 			/* we don't care about invalid key errors */
diff --git a/extensions/exiv2_tools/main.c b/extensions/exiv2_tools/main.c
index ee20267..a9c55b9 100644
--- a/extensions/exiv2_tools/main.c
+++ b/extensions/exiv2_tools/main.c
@@ -46,102 +46,100 @@ GthMetadataCategory exiv2_metadata_category[] = {
 
 
 GthMetadataInfo exiv2_metadata_info[] = {
-	{ "Exif::Image::Make", NULL, "Exif::General", 1, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Image::Model", NULL, "Exif::General", 2, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Image::Software", NULL, "Exif::General", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::DateTime", NULL, "Exif::General", 4, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::SubSecTime", NULL, "Exif::General", 5, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::DateTimeOriginal", NULL, "Exif::General", 6, GTH_METADATA_ALLOW_EVERYWHERE},
-	{ "Exif::Photo::SubSecTimeOriginal", NULL, "Exif::General", 7, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::DateTimeDigitized", NULL, "Exif::General", 8, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::SubSecTimeDigitized", NULL, "Exif::General", 9, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::Artist", NULL, "Exif::General", 11, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Image::Copyright", NULL, "Exif::General", 12, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::UniqueID", NULL, "Exif::General", 13, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SoundFile", NULL, "Exif::General", 14, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
-	{ "Exif::Photo::ISOSpeedRatings", NULL, "Exif::Conditions", 2, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::BrightnessValue", NULL, "Exif::Conditions", 3, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::FNumber", NULL, "Exif::Conditions", 4, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::ApertureValue", NULL, "Exif::Conditions", 5, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::MaxApertureValue", NULL, "Exif::Conditions", 6, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::ExposureTime", NULL, "Exif::Conditions", 7, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::ExposureProgram", NULL, "Exif::Conditions", 8, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ExposureIndex", NULL, "Exif::Conditions", 9, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ExposureBiasValue", NULL, "Exif::Conditions", 10, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ExposureMode", NULL, "Exif::Conditions", 11, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ShutterSpeedValue", NULL, "Exif::Conditions", 12, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::MeteringMode", NULL, "Exif::Conditions", 13, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::LightSource", NULL, "Exif::Conditions", 14, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::WhiteBalance", NULL, "Exif::Conditions", 15, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::Flash", NULL, "Exif::Conditions", 16, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::FlashEnergy", NULL, "Exif::Conditions", 17, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SubjectDistance", NULL, "Exif::Conditions", 18, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SubjectDistanceRange", NULL, "Exif::Conditions", 19, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SubjectArea", NULL, "Exif::Conditions", 20, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SubjectLocation", NULL, "Exif::Conditions", 21, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::FocalLength", NULL, "Exif::Conditions", 22, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::FocalLengthIn35mmFilm", NULL, "Exif::Conditions", 23, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::FocalPlaneXResolution", NULL, "Exif::Conditions", 24, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::FocalPlaneYResolution", NULL, "Exif::Conditions", 25, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::FocalPlaneResolutionUnit", NULL, "Exif::Conditions", 26, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::Contrast", NULL, "Exif::Conditions", 27, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::Saturation", NULL, "Exif::Conditions", 28, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::Sharpness", NULL, "Exif::Conditions", 29, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SceneType", NULL, "Exif::Conditions", 30, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SceneCaptureType", NULL, "Exif::Conditions", 31, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::CustomRendered", NULL, "Exif::Conditions", 32, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::DigitalZoomRatio", NULL, "Exif::Conditions", 33, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "Exif::Photo::FileSource", NULL, "Exif::Conditions", 34, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SensingMethod", NULL, "Exif::Conditions", 35, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::DeviceSettingDescription", NULL, "Exif::Conditions", 36, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::OECF", NULL, "Exif::Conditions", 37, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SpatialFrequencyResponse", NULL, "Exif::Conditions", 38, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::SpectralSensitivity", NULL, "Exif::Conditions", 39, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::GainControl", NULL, "Exif::Conditions", 40, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
-	{ "Exif::Image::ImageWidth", NULL, "Exif::Structure", 1, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::ImageLength", NULL, "Exif::Structure", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::PixelXDimension", NULL, "Exif::Structure", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::PixelYDimension", NULL, "Exif::Structure", 4, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::Orientation", NULL, "Exif::Structure", 5, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::XResolution", NULL, "Exif::Structure", 6, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::YResolution", NULL, "Exif::Structure", 7, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::ResolutionUnit", NULL, "Exif::Structure", 8, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::Compression", NULL, "Exif::Structure", 9, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::SamplesPerPixel", NULL, "Exif::Structure", 10, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::BitsPerSample", NULL, "Exif::Structure", 11, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::PlanarConfiguration", NULL, "Exif::Structure", 12, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::YCbCrSubSampling", NULL, "Exif::Structure", 13, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::YCbCrPositioning", NULL, "Exif::Structure", 14, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::PhotometricInterpretation", NULL, "Exif::Structure", 15, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ComponentsConfiguration", NULL, "Exif::Structure", 16, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::CompressedBitsPerPixel", NULL, "Exif::Structure", 17, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::StripOffset", NULL, "Exif::Structure", 18, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::RowsPerStrip", NULL, "Exif::Structure", 19, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::StripByteCounts", NULL, "Exif::Structure", 20, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::JPEGInterchangeFormat", NULL, "Exif::Structure", 21, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::JPEGInterchangeFormatLength", NULL, "Exif::Structure", 22, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::TransferFunction", NULL, "Exif::Structure", 23, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::WhitePoint", NULL, "Exif::Structure", 24, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::PrimaryChromaticities", NULL, "Exif::Structure", 25, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::YCbCrCoefficients", NULL, "Exif::Structure", 26, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ReferenceBlackWhite", NULL, "Exif::Structure", 27, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::ColorSpace", NULL, "Exif::Structure", 28, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
-	{ "Exif::Photo::ExifVersion", NULL, "Exif::Versions", 1, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Image::ExifTag", NULL, "Exif::Versions", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::FlashpixVersion", NULL, "Exif::Versions", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Iop::InteroperabilityIndex", NULL, "Exif::Versions", 4, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Iop::InteroperabilityVersion", NULL, "Exif::Versions", 5, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::InteroperabilityTag", NULL, "Exif::Versions", 6, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::RelatedImageFileFormat", NULL, "Exif::Versions", 7, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::RelatedImageWidth", NULL, "Exif::Versions", 8, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "Exif::Photo::RelatedImageLength", NULL, "Exif::Versions", 9, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
-	{ "Exif::Photo::MakerNote", NULL, "Exif::Other", 0, GTH_METADATA_ALLOW_NOWHERE },
-
-	{ NULL, NULL, NULL, 0, 0 }
+	{ "Exif::Image::Make", NULL, "Exif::General", 1, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Image::Model", NULL, "Exif::General", 2, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Image::Software", NULL, "Exif::General", 3, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::DateTime", NULL, "Exif::General", 4, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::SubSecTime", NULL, "Exif::General", 5, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::DateTimeOriginal", NULL, "Exif::General", 6, NULL, GTH_METADATA_ALLOW_EVERYWHERE},
+	{ "Exif::Photo::SubSecTimeOriginal", NULL, "Exif::General", 7, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::DateTimeDigitized", NULL, "Exif::General", 8, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::SubSecTimeDigitized", NULL, "Exif::General", 9, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::Artist", NULL, "Exif::General", 11, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Image::Copyright", NULL, "Exif::General", 12, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::UniqueID", NULL, "Exif::General", 13, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SoundFile", NULL, "Exif::General", 14, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+	{ "Exif::Photo::ISOSpeedRatings", NULL, "Exif::Conditions", 2, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::BrightnessValue", NULL, "Exif::Conditions", 3, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::FNumber", NULL, "Exif::Conditions", 4, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::ApertureValue", NULL, "Exif::Conditions", 5, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::MaxApertureValue", NULL, "Exif::Conditions", 6, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::ExposureTime", NULL, "Exif::Conditions", 7, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::ExposureProgram", NULL, "Exif::Conditions", 8, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ExposureIndex", NULL, "Exif::Conditions", 9, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ExposureBiasValue", NULL, "Exif::Conditions", 10, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ExposureMode", NULL, "Exif::Conditions", 11, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ShutterSpeedValue", NULL, "Exif::Conditions", 12, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::MeteringMode", NULL, "Exif::Conditions", 13, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::LightSource", NULL, "Exif::Conditions", 14, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::WhiteBalance", NULL, "Exif::Conditions", 15, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::Flash", NULL, "Exif::Conditions", 16, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::FlashEnergy", NULL, "Exif::Conditions", 17, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SubjectDistance", NULL, "Exif::Conditions", 18, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SubjectDistanceRange", NULL, "Exif::Conditions", 19, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SubjectArea", NULL, "Exif::Conditions", 20, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SubjectLocation", NULL, "Exif::Conditions", 21, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::FocalLength", NULL, "Exif::Conditions", 22, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::FocalLengthIn35mmFilm", NULL, "Exif::Conditions", 23, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::FocalPlaneXResolution", NULL, "Exif::Conditions", 24, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::FocalPlaneYResolution", NULL, "Exif::Conditions", 25, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::FocalPlaneResolutionUnit", NULL, "Exif::Conditions", 26, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::Contrast", NULL, "Exif::Conditions", 27, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::Saturation", NULL, "Exif::Conditions", 28, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::Sharpness", NULL, "Exif::Conditions", 29, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SceneType", NULL, "Exif::Conditions", 30, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SceneCaptureType", NULL, "Exif::Conditions", 31, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::CustomRendered", NULL, "Exif::Conditions", 32, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::DigitalZoomRatio", NULL, "Exif::Conditions", 33, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "Exif::Photo::FileSource", NULL, "Exif::Conditions", 34, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SensingMethod", NULL, "Exif::Conditions", 35, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::DeviceSettingDescription", NULL, "Exif::Conditions", 36, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::OECF", NULL, "Exif::Conditions", 37, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SpatialFrequencyResponse", NULL, "Exif::Conditions", 38, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::SpectralSensitivity", NULL, "Exif::Conditions", 39, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::GainControl", NULL, "Exif::Conditions", 40, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+	{ "Exif::Image::ImageWidth", NULL, "Exif::Structure", 1, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::ImageLength", NULL, "Exif::Structure", 2, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::PixelXDimension", NULL, "Exif::Structure", 3, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::PixelYDimension", NULL, "Exif::Structure", 4, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::YResolution", NULL, "Exif::Structure", 7, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::ResolutionUnit", NULL, "Exif::Structure", 8, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::Compression", NULL, "Exif::Structure", 9, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::SamplesPerPixel", NULL, "Exif::Structure", 10, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::BitsPerSample", NULL, "Exif::Structure", 11, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::PlanarConfiguration", NULL, "Exif::Structure", 12, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::YCbCrSubSampling", NULL, "Exif::Structure", 13, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::YCbCrPositioning", NULL, "Exif::Structure", 14, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::PhotometricInterpretation", NULL, "Exif::Structure", 15, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ComponentsConfiguration", NULL, "Exif::Structure", 16, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::CompressedBitsPerPixel", NULL, "Exif::Structure", 17, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::StripOffset", NULL, "Exif::Structure", 18, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::RowsPerStrip", NULL, "Exif::Structure", 19, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::StripByteCounts", NULL, "Exif::Structure", 20, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::JPEGInterchangeFormat", NULL, "Exif::Structure", 21, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::JPEGInterchangeFormatLength", NULL, "Exif::Structure", 22, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::TransferFunction", NULL, "Exif::Structure", 23, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::WhitePoint", NULL, "Exif::Structure", 24, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::PrimaryChromaticities", NULL, "Exif::Structure", 25, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::YCbCrCoefficients", NULL, "Exif::Structure", 26, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ReferenceBlackWhite", NULL, "Exif::Structure", 27, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::ColorSpace", NULL, "Exif::Structure", 28, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+	{ "Exif::Photo::ExifVersion", NULL, "Exif::Versions", 1, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Image::ExifTag", NULL, "Exif::Versions", 2, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::FlashpixVersion", NULL, "Exif::Versions", 3, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Iop::InteroperabilityIndex", NULL, "Exif::Versions", 4, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Iop::InteroperabilityVersion", NULL, "Exif::Versions", 5, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::InteroperabilityTag", NULL, "Exif::Versions", 6, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::RelatedImageFileFormat", NULL, "Exif::Versions", 7, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::RelatedImageWidth", NULL, "Exif::Versions", 8, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "Exif::Photo::RelatedImageLength", NULL, "Exif::Versions", 9, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+	{ "Exif::Photo::MakerNote", NULL, "Exif::Other", 0, NULL, GTH_METADATA_ALLOW_NOWHERE },
+
+	{ NULL, NULL, NULL, 0, NULL, 0 }
 };
 
 
diff --git a/extensions/gstreamer_tools/main.c b/extensions/gstreamer_tools/main.c
index a6939d7..66cb6fa 100644
--- a/extensions/gstreamer_tools/main.c
+++ b/extensions/gstreamer_tools/main.c
@@ -37,19 +37,19 @@ GthMetadataCategory gstreamer_metadata_category[] = {
 
 
 GthMetadataInfo gstreamer_metadata_info[] = {
-	{ "audio-video::general::artist", N_("Artist"), "general", 2, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "audio-video::general::album", N_("Album"), "general", 3, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "audio-video::general::bitrate", N_("Bitrate"), "general", 20, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "audio-video::general::encoder", N_("Encoder"), "general", 21, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
-	{ "audio-video::video::codec", N_("Codec"), "audio-video::video", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "audio-video::video::framerate", N_("Framerate"), "audio-video::video", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "audio-video::video::width", N_("Width"), "audio-video::video", 0, GTH_METADATA_ALLOW_NOWHERE },
-	{ "audio-video::video::height", N_("Height"), "audio-video::video", 0, GTH_METADATA_ALLOW_NOWHERE },
-
-	{ "audio-video::audio::codec", N_("Codec"), "audio-video::audio", 1, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "audio-video::audio::channels", N_("Channels"), "audio-video::audio", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "audio-video::audio::samplerate", N_("Sample rate"), "audio-video::audio", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::general::artist", N_("Artist"), "general", 2, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "audio-video::general::album", N_("Album"), "general", 3, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "audio-video::general::bitrate", N_("Bitrate"), "general", 20, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::general::encoder", N_("Encoder"), "general", 21, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+	{ "audio-video::video::codec", N_("Codec"), "audio-video::video", 2, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::video::framerate", N_("Framerate"), "audio-video::video", 3, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::video::width", N_("Width"), "audio-video::video", 0, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "audio-video::video::height", N_("Height"), "audio-video::video", 0, NULL, GTH_METADATA_ALLOW_NOWHERE },
+
+	{ "audio-video::audio::codec", N_("Codec"), "audio-video::audio", 1, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::audio::channels", N_("Channels"), "audio-video::audio", 2, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "audio-video::audio::samplerate", N_("Sample rate"), "audio-video::audio", 3, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
 
 	{ NULL, NULL, NULL, 0, 0 }
 };
diff --git a/gthumb/gth-main-default-metadata.c b/gthumb/gth-main-default-metadata.c
index beb71b3..7391a8c 100644
--- a/gthumb/gth-main-default-metadata.c
+++ b/gthumb/gth-main-default-metadata.c
@@ -37,25 +37,25 @@ GthMetadataCategory file_metadata_category[] = {
 
 
 GthMetadataInfo file_metadata_info[] = {
-	{ "standard::display-name", N_("Name"), "file", 1, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "gth::file::display-size", N_("Size"), "file", 2, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "gth::file::display-mtime", N_("Modified"), "file", 3, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "standard::fast-content-type", N_("Type"), "file", 4, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "gth::file::is-modified", NULL, "file", 5, GTH_METADATA_ALLOW_NOWHERE },
-	{ "gth::file::full-name", N_("Full Name"), "file", 6, GTH_METADATA_ALLOW_IN_PRINT | GTH_METADATA_ALLOW_IN_FILE_LIST | GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "standard::display-name", N_("Name"), "file", 1, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "gth::file::display-size", N_("Size"), "file", 2, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "gth::file::display-mtime", N_("Modified"), "file", 3, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "standard::fast-content-type", N_("Type"), "file", 4, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "gth::file::is-modified", NULL, "file", 5, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "gth::file::full-name", N_("Full Name"), "file", 6, NULL, GTH_METADATA_ALLOW_IN_PRINT | GTH_METADATA_ALLOW_IN_FILE_LIST | GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
 
-	{ "general::title", N_("Title"), "general", 1, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::dimensions", N_("Dimensions"), "general", 10, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::duration", N_("Duration"), "general", 11, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::format", N_("Format"), "general", 12, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-	{ "general::location", N_("Place"), "general", 14, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::datetime", N_("Date"), "general", 15, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::description", N_("Description"), "general", 17, GTH_METADATA_ALLOW_IN_PRINT },
-	{ "general::tags", N_("Tags"), "general", 18, GTH_METADATA_ALLOW_EVERYWHERE },
-	{ "general::rating", N_("Rating"), "general", 19, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::title", N_("Title"), "general", 1, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::dimensions", N_("Dimensions"), "general", 10, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::duration", N_("Duration"), "general", 11, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::format", N_("Format"), "general", 12, NULL, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+	{ "general::location", N_("Place"), "general", 14, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::datetime", N_("Date"), "general", 15, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::description", N_("Description"), "general", 17, NULL, GTH_METADATA_ALLOW_IN_PRINT },
+	{ "general::tags", N_("Tags"), "general", 18, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
+	{ "general::rating", N_("Rating"), "general", 19, NULL, GTH_METADATA_ALLOW_EVERYWHERE },
 
-	{ "Embedded::Image::Orientation", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
-	{ "Embedded::Photo::DateTimeOriginal", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
+	{ "Embedded::Image::Orientation", "", "", 0, NULL, GTH_METADATA_ALLOW_NOWHERE },
+	{ "Embedded::Photo::DateTimeOriginal", "", "", 0, NULL, GTH_METADATA_ALLOW_NOWHERE },
 
 	{ NULL, NULL, NULL, 0, 0 }
 };
diff --git a/gthumb/gth-metadata.c b/gthumb/gth-metadata.c
index e590443..e965c08 100644
--- a/gthumb/gth-metadata.c
+++ b/gthumb/gth-metadata.c
@@ -222,6 +222,8 @@ gth_metadata_info_dup (GthMetadataInfo *info)
 	new_info = g_new0 (GthMetadataInfo, 1);
 	if (info->id != NULL)
 		new_info->id = g_strdup (info->id);
+	if (info->type != NULL)
+		new_info->type = g_strdup (info->type);
 	if (info->display_name != NULL)
 		new_info->display_name = g_strdup (info->display_name);
 	if (info->category != NULL)
diff --git a/gthumb/gth-metadata.h b/gthumb/gth-metadata.h
index 8adab74..ad2390c 100644
--- a/gthumb/gth-metadata.h
+++ b/gthumb/gth-metadata.h
@@ -48,6 +48,7 @@ typedef struct {
 	const char         *display_name;
 	const char         *category;
 	int                 sort_order;
+	const char         *type;
 	GthMetadataFlags    flags;
 } GthMetadataInfo;
 



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