[eog] Fix bogus usage of eog_image_has_data()
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Fix bogus usage of eog_image_has_data()
- Date: Tue, 9 Aug 2011 20:01:15 +0000 (UTC)
commit 40919ebb2ce1fd70edae61c7b578c6a7ce8ef432
Author: Felix Riemann <friemann gnome org>
Date: Tue Aug 2 23:18:19 2011 +0200
Fix bogus usage of eog_image_has_data()
This tries to fix cases where it apparently wasn't taken into account
that if you use the function with multiple test flags all tests must be
successful or the result will be negative.
https://bugzilla.gnome.org/show_bug.cgi?id=655794
src/eog-image.c | 1 +
src/eog-jobs.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
src/eog-window.c | 6 +++---
3 files changed, 45 insertions(+), 11 deletions(-)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index 75b38b6..5cf8574 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -154,6 +154,7 @@ eog_image_free_mem_private (EogImage *image)
#endif
priv->status = EOG_IMAGE_STATUS_UNKNOWN;
+ priv->metadata_status = EOG_IMAGE_METADATA_NOT_READ;
}
}
diff --git a/src/eog-jobs.c b/src/eog-jobs.c
index ed90725..3e5d743 100644
--- a/src/eog-jobs.c
+++ b/src/eog-jobs.c
@@ -609,10 +609,26 @@ eog_job_save_run (EogJob *ejob)
eog_image_data_ref (image);
if (!eog_image_has_data (image, EOG_IMAGE_DATA_ALL)) {
- eog_image_load (image,
- EOG_IMAGE_DATA_ALL,
- NULL,
- &ejob->error);
+ EogImageMetadataStatus m_status;
+ gint data2load = 0;
+
+ m_status = eog_image_get_metadata_status (image);
+ if (!eog_image_has_data (image, EOG_IMAGE_DATA_IMAGE)) {
+ // Queue full read in this case
+ data2load = EOG_IMAGE_DATA_ALL;
+ } else if (m_status == EOG_IMAGE_METADATA_NOT_READ)
+ {
+ // Load only if we haven't read it yet
+ data2load = EOG_IMAGE_DATA_EXIF
+ | EOG_IMAGE_DATA_XMP;
+ }
+
+ if (data2load != 0) {
+ eog_image_load (image,
+ data2load,
+ NULL,
+ &ejob->error);
+ }
}
handler_id = g_signal_connect (G_OBJECT (image),
@@ -716,12 +732,29 @@ eog_job_save_as_run (EogJob *ejob)
eog_image_data_ref (image);
if (!eog_image_has_data (image, EOG_IMAGE_DATA_ALL)) {
- eog_image_load (image,
- EOG_IMAGE_DATA_ALL,
- NULL,
- &ejob->error);
+ EogImageMetadataStatus m_status;
+ gint data2load = 0;
+
+ m_status = eog_image_get_metadata_status (image);
+ if (!eog_image_has_data (image, EOG_IMAGE_DATA_IMAGE)) {
+ // Queue full read in this case
+ data2load = EOG_IMAGE_DATA_ALL;
+ } else if (m_status == EOG_IMAGE_METADATA_NOT_READ)
+ {
+ // Load only if we haven't read it yet
+ data2load = EOG_IMAGE_DATA_EXIF
+ | EOG_IMAGE_DATA_XMP;
+ }
+
+ if (data2load != 0) {
+ eog_image_load (image,
+ data2load,
+ NULL,
+ &ejob->error);
+ }
}
+
g_assert (ejob->error == NULL);
handler_id = g_signal_connect (G_OBJECT (image),
diff --git a/src/eog-window.c b/src/eog-window.c
index 1f44023..af670e2 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -501,7 +501,7 @@ update_status_bar (EogWindow *window)
priv = window->priv;
if (priv->image != NULL &&
- eog_image_has_data (priv->image, EOG_IMAGE_DATA_ALL)) {
+ eog_image_has_data (priv->image, EOG_IMAGE_DATA_DIMENSION)) {
int zoom, width, height;
goffset bytes = 0;
@@ -866,7 +866,7 @@ eog_window_display_image (EogWindow *window, EogImage *image)
eog_debug (DEBUG_WINDOW);
- g_assert (eog_image_has_data (image, EOG_IMAGE_DATA_ALL));
+ g_assert (eog_image_has_data (image, EOG_IMAGE_DATA_IMAGE));
priv = window->priv;
@@ -1494,7 +1494,7 @@ handle_image_selection_changed_cb (EogThumbView *thumbview, EogWindow *window)
return;
}
- if (eog_image_has_data (image, EOG_IMAGE_DATA_ALL)) {
+ if (eog_image_has_data (image, EOG_IMAGE_DATA_IMAGE)) {
eog_window_display_image (window, image);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]