Commit b97e5c14 authored by Paolo Bacchilega's avatar Paolo Bacchilega

save the Exif.Image.Software tag only if the content was modified

as suggested by Greg Mansfield
parent da244e7e
......@@ -954,11 +954,13 @@ exiv2_write_metadata_private (Exiv2::Image::AutoPtr image,
mandatory_string (ed, "Exif.Photo.ComponentsConfiguration", "1 2 3 0");
mandatory_string (ed, "Exif.Photo.FlashpixVersion", "48 49 48 48");
// Overwrite the software tag
// Overwrite the software tag if the image content was modified
if (software_name == NULL)
software_name = g_strconcat (g_get_application_name (), " ", VERSION, NULL);
ed["Exif.Image.Software"] = software_name;
if (g_file_info_get_attribute_boolean (info, "gth::file::image-changed")) {
if (software_name == NULL)
software_name = g_strconcat (g_get_application_name (), " ", VERSION, NULL);
ed["Exif.Image.Software"] = software_name;
}
// Update the dimension tags with actual image values
......
......@@ -1120,6 +1120,21 @@ _gth_image_viewer_page_real_save (GthViewerPage *base,
data->original_file = gth_file_data_dup (current_file);
if (file != NULL)
gth_file_data_set_file (current_file, file);
/* save the value of 'gth::file::is-modified' into 'gth::file::image-changed'
* to allow the exiv2 metadata writer to not change some fields if the
* content wasn't modified. */
g_file_info_set_attribute_boolean (current_file->info, "gth::file::image-changed", g_file_info_get_attribute_boolean (current_file->info, "gth::file::is-modified"));
/* the 'gth::file::is-modified' attribute must be set to false before
* saving the file to avoid a scenario where the user is asked whether
* he wants to save the file after saving it.
* This is because when a file is modified in the current folder the
* folder_changed_cb function in gth-browser.c is called automatically
* and if the current file has been modified it is reloaded
* (see file_attributes_ready_cb in gth-browser.c) and if it has been
* modified ('gth::file::is-modified' is TRUE) the user is asked if he
* wants to save (see load_file_delayed_cb in gth-browser.c). */
g_file_info_set_attribute_boolean (current_file->info, "gth::file::is-modified", FALSE);
pixbuf = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (self->priv->viewer));
......
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