diff options
-rw-r--r-- | src/eom-image.c | 9 | ||||
-rw-r--r-- | src/eom-jobs.c | 44 | ||||
-rw-r--r-- | src/eom-window.c | 12 |
3 files changed, 49 insertions, 16 deletions
diff --git a/src/eom-image.c b/src/eom-image.c index 61164e9..d990f98 100644 --- a/src/eom-image.c +++ b/src/eom-image.c @@ -149,6 +149,7 @@ eom_image_free_mem_private (EomImage *image) #endif priv->status = EOM_IMAGE_STATUS_UNKNOWN; + priv->metadata_status = EOM_IMAGE_METADATA_NOT_READ; } } @@ -1195,17 +1196,17 @@ eom_image_has_data (EomImage *img, EomImageData req_data) priv = img->priv; if ((req_data & EOM_IMAGE_DATA_IMAGE) > 0) { - req_data = (req_data & !EOM_IMAGE_DATA_IMAGE); + req_data = (req_data & ~EOM_IMAGE_DATA_IMAGE); has_data = has_data && (priv->image != NULL); } if ((req_data & EOM_IMAGE_DATA_DIMENSION) > 0 ) { - req_data = (req_data & !EOM_IMAGE_DATA_DIMENSION); + req_data = (req_data & ~EOM_IMAGE_DATA_DIMENSION); has_data = has_data && (priv->width >= 0) && (priv->height >= 0); } if ((req_data & EOM_IMAGE_DATA_EXIF) > 0) { - req_data = (req_data & !EOM_IMAGE_DATA_EXIF); + req_data = (req_data & ~EOM_IMAGE_DATA_EXIF); #ifdef HAVE_EXIF has_data = has_data && (priv->exif != NULL); #else @@ -1214,7 +1215,7 @@ eom_image_has_data (EomImage *img, EomImageData req_data) } if ((req_data & EOM_IMAGE_DATA_XMP) > 0) { - req_data = (req_data & !EOM_IMAGE_DATA_XMP); + req_data = (req_data & ~EOM_IMAGE_DATA_XMP); #ifdef HAVE_EXEMPI has_data = has_data && (priv->xmp != NULL); #endif diff --git a/src/eom-jobs.c b/src/eom-jobs.c index d122a91..df5c714 100644 --- a/src/eom-jobs.c +++ b/src/eom-jobs.c @@ -613,10 +613,24 @@ eom_job_save_run (EomJob *ejob) eom_image_data_ref (image); if (!eom_image_has_data (image, EOM_IMAGE_DATA_ALL)) { - eom_image_load (image, - EOM_IMAGE_DATA_ALL, - NULL, - &ejob->error); + EomImageMetadataStatus m_status; + gint data2load = 0; + + m_status = eom_image_get_metadata_status (image); + if (!eom_image_has_data (image, EOM_IMAGE_DATA_IMAGE)) { + // Queue full read in this case + data2load = EOM_IMAGE_DATA_ALL; + } else if (m_status == EOM_IMAGE_METADATA_NOT_READ) { + // Load only if we haven't read it yet + data2load = EOM_IMAGE_DATA_EXIF | EOM_IMAGE_DATA_XMP; + } + + if (data2load != 0) { + eom_image_load (image, + data2load, + NULL, + &ejob->error); + } } handler_id = g_signal_connect (G_OBJECT (image), @@ -720,10 +734,24 @@ eom_job_save_as_run (EomJob *ejob) eom_image_data_ref (image); if (!eom_image_has_data (image, EOM_IMAGE_DATA_ALL)) { - eom_image_load (image, - EOM_IMAGE_DATA_ALL, - NULL, - &ejob->error); + EomImageMetadataStatus m_status; + gint data2load = 0; + + m_status = eom_image_get_metadata_status (image); + if (!eom_image_has_data (image, EOM_IMAGE_DATA_IMAGE)) { + // Queue full read in this case + data2load = EOM_IMAGE_DATA_ALL; + } else if (m_status == EOM_IMAGE_METADATA_NOT_READ) { + // Load only if we haven't read it yet + data2load = EOM_IMAGE_DATA_EXIF | EOM_IMAGE_DATA_XMP; + } + + if (data2load != 0) { + eom_image_load (image, + data2load, + NULL, + &ejob->error); + } } g_assert (ejob->error == NULL); diff --git a/src/eom-window.c b/src/eom-window.c index 2c75d23..ef8dd9d 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -487,7 +487,7 @@ update_status_bar (EomWindow *window) priv = window->priv; if (priv->image != NULL && - eom_image_has_data (priv->image, EOM_IMAGE_DATA_ALL)) { + eom_image_has_data (priv->image, EOM_IMAGE_DATA_DIMENSION)) { int zoom, width, height; goffset bytes = 0; @@ -847,7 +847,7 @@ eom_window_display_image (EomWindow *window, EomImage *image) eom_debug (DEBUG_WINDOW); - g_assert (eom_image_has_data (image, EOM_IMAGE_DATA_ALL)); + g_assert (eom_image_has_data (image, EOM_IMAGE_DATA_IMAGE)); priv = window->priv; @@ -1438,7 +1438,7 @@ handle_image_selection_changed_cb (EomThumbView *thumbview, EomWindow *window) priv->image_info_message_cid); eom_scroll_view_set_image (EOM_SCROLL_VIEW (priv->view), NULL); -} + } if (eom_thumb_view_get_n_selected (EOM_THUMB_VIEW (priv->thumbview)) == 0) return; @@ -1461,7 +1461,11 @@ handle_image_selection_changed_cb (EomThumbView *thumbview, EomWindow *window) return; } - if (eom_image_has_data (image, EOM_IMAGE_DATA_ALL)) { + if (eom_image_has_data (image, EOM_IMAGE_DATA_IMAGE)) { + if (priv->image != NULL) + g_object_unref (priv->image); + + priv->image = image; eom_window_display_image (window, image); return; } |