[gthumb] Use gvfsd-provided mount point to read metadata, instead of a cache



commit a0bc0ed87e64e367c7fc83694139a60c73e828a2
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Wed May 6 15:43:10 2009 -0400

    Use gvfsd-provided mount point to read metadata, instead of a cache
---
 libgthumb/gth-exif-utils.c |   47 +++++++++++++++----------------------------
 1 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/libgthumb/gth-exif-utils.c b/libgthumb/gth-exif-utils.c
index e3d69e1..4cb41e7 100644
--- a/libgthumb/gth-exif-utils.c
+++ b/libgthumb/gth-exif-utils.c
@@ -467,13 +467,13 @@ write_orientation_field (const char   *local_file,
 
 
 GList *
-gth_read_exiv2 (const char *uri, GList *metadata)
+gth_read_exiv2 (const char *local_file, GList *metadata)
 {
-	char *local_file;
-	char *uri_wo_ext;
-        char *sidecar_uri;
+	char *without_ext;
+        char *sidecar;
+
+	g_assert (! uri_has_scheme (local_file));
 
-        local_file = get_cache_filename_from_uri (uri);
         if (local_file == NULL)
                 return metadata;
 
@@ -482,20 +482,16 @@ gth_read_exiv2 (const char *uri, GList *metadata)
 
 	/* Read image file */
 	metadata = read_exiv2_file (local_file, metadata);
-	g_free (local_file);
 
 	/* Read sidecar, if present */
-	/* FIXME: add remote cache support (use copy_remote_file_to_cache) */
-	uri_wo_ext = remove_extension_from_path (uri);
-	sidecar_uri = g_strconcat (uri_wo_ext, ".xmp", NULL);
-	local_file = get_cache_filename_from_uri (sidecar_uri);
+	without_ext = remove_extension_from_path (local_file);
+	sidecar = g_strconcat (without_ext, ".xmp", NULL);
 
-	if ((local_file != NULL) && path_exists (local_file))
-	       	metadata = read_exiv2_sidecar (local_file, metadata);
+	if ((sidecar != NULL) && path_exists (sidecar))
+	       	metadata = read_exiv2_sidecar (sidecar, metadata);
 
-	g_free (local_file);
-       	g_free (uri_wo_ext);
-        g_free (sidecar_uri);
+       	g_free (without_ext);
+        g_free (sidecar);
 
 	/* Undo the initial reverse */
 	metadata = g_list_reverse (metadata);
@@ -514,31 +510,24 @@ sort_by_tag_name (GthMetadata *entry1, GthMetadata *entry2)
 void
 update_metadata (FileData *fd) 
 { 
-	char *local_file;
-
 	/* Have we already read in the metadata? */
 	if (fd->exif_data_loaded == TRUE)
 		return;
 
-	local_file = get_cache_filename_from_uri (fd->path); 
-
-	/* What if the remote file has not actually been copied to the cache?
-	   In that case, do not bother to load the metadata, because it's
-	   too slow. fd->exif_data_loaded will remain FALSE. */
-	if (!path_is_file (local_file)) {
-		g_warning ("Can't read the metadata because the remote file %s has not yet been copied to the local cache. Skipping.\n", fd->path);
-		return;
+	if (fd->local_path == NULL) {
+                g_warning ("Can't read metadata if the remote files are not mounted locally.");
+                return;	
 	}
-
+	
 	if (fd->mime_type == NULL)
 		file_data_update_mime_type (fd, FALSE);
 
 	g_assert (fd->mime_type != NULL);
 
         if (mime_type_is_image (fd->mime_type)) 
-                fd->metadata = gth_read_exiv2 (local_file, fd->metadata); 
+                fd->metadata = gth_read_exiv2 (fd->local_path, fd->metadata); 
 	else if (mime_type_is_video (fd->mime_type))
- 		fd->metadata = gth_read_gstreamer (local_file, fd->metadata);
+ 		fd->metadata = gth_read_gstreamer (fd->local_path, fd->metadata);
  
         /* Sort alphabetically by tag name. The "position" value will 
            override this sorting, if position is non-zero. */ 
@@ -546,8 +535,6 @@ update_metadata (FileData *fd)
  	fd->exif_data_loaded = TRUE;
 	fd->exif_time = get_metadata_time_from_fd (fd, TAG_NAME_SETS[SORTING_DATE_TAG_NAMES]);
 
-	g_free (local_file);
-
         return; 
 }
 



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