Commit 37a3610d authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

fixed the "original photo date" field

parent d827fd70
......@@ -34,7 +34,7 @@ typedef enum {
NO_DATE = 0,
FOLLOWING_DATE,
CURRENT_DATE,
EMBEDDED_DATE,
PHOTO_DATE,
LAST_MODIFIED_DATE,
CREATION_DATE,
NO_CHANGE
......@@ -225,7 +225,6 @@ get_date_from_option (GthEditCommentPage *self,
GTimeVal timeval;
GthDateTime *date_time;
char *exif_date;
const char *date;
GthMetadata *metadata;
_g_time_val_reset (&timeval);
......@@ -236,7 +235,7 @@ get_date_from_option (GthEditCommentPage *self,
case FOLLOWING_DATE:
date_time = gth_datetime_new ();
gth_time_selector_get_value (GTH_TIME_SELECTOR (self->priv->date_selector), date_time);
exif_date = gth_datetime_to_exif_date (&date_time);
exif_date = gth_datetime_to_exif_date (date_time);
_g_time_val_from_exif_date (exif_date, &timeval);
g_free (exif_date);
gth_datetime_free (date_time);
......@@ -244,8 +243,8 @@ get_date_from_option (GthEditCommentPage *self,
case CURRENT_DATE:
g_get_current_time (&timeval);
break;
case EMBEDDED_DATE:
metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "Embedded::Image::DateTime");
case PHOTO_DATE:
metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "Embedded::Photo::DateTimeOriginal");
if (metadata != NULL)
_g_time_val_from_exif_date (gth_metadata_get_raw (metadata), &timeval);
else
......@@ -260,9 +259,9 @@ get_date_from_option (GthEditCommentPage *self,
timeval.tv_usec = g_file_info_get_attribute_uint32 (self->priv->file_data->info, "time::created-usec");
break;
case NO_CHANGE:
date = g_file_info_get_attribute_string (self->priv->file_data->info, "comment::time");
if (date != NULL)
_g_time_val_from_exif_date (date, &timeval);
metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->file_data->info, "Embedded::Image::DateTime");
if (metadata != NULL)
_g_time_val_from_exif_date (gth_metadata_get_raw (metadata), &timeval);
else
return g_strdup ("");
break;
......
......@@ -55,6 +55,16 @@ const char *_DATE_TAG_NAMES[] = {
NULL
};
const char *_ORIGINAL_DATE_TAG_NAMES[] = {
"Exif::Photo::DateTimeOriginal",
"Xmp::exif::DateTimeOriginal",
"Exif::Photo::DateTimeDigitized",
"Xmp::exif::DateTimeDigitized",
"Xmp::xmp::CreateDate",
"Xmp::photoshop::DateCreated",
NULL
};
const char *_EXPOSURE_TIME_TAG_NAMES[] = {
"Exif::Photo::ExposureTime",
"Xmp::exif::ExposureTime",
......@@ -275,6 +285,7 @@ static void
set_attributes_from_tagsets (GFileInfo *info)
{
set_attribute_from_tagset (info, "Embedded::Image::DateTime", _DATE_TAG_NAMES);
set_attribute_from_tagset (info, "Embedded::Photo::DateTimeOriginal", _ORIGINAL_DATE_TAG_NAMES);
set_attribute_from_tagset (info, "Embedded::Image::Comment", _COMMENT_TAG_NAMES);
set_attribute_from_tagset (info, "Embedded::Image::Location", _LOCATION_TAG_NAMES);
set_string_list_attribute_from_tagset (info, "Embedded::Image::Keywords", _KEYWORDS_TAG_NAMES);
......
......@@ -47,6 +47,7 @@ GthMetadataInfo file_metadata_info[] = {
{ "Embedded::Image::Location", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Image::Keywords", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Image::Orientation", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Photo::DateTimeOriginal", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ NULL, NULL, NULL, 0, 0 }
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment