gthumb r2462 - in trunk: . libgthumb src



Author: mjc
Date: Sun Dec 21 03:41:10 2008
New Revision: 2462
URL: http://svn.gnome.org/viewvc/gthumb?rev=2462&view=rev

Log:
2008-12-20  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/comments.c: (save_comment_to_metadata),
        (load_comment_from_xml), (save_comment):
        * libgthumb/dlg-save-image.c: (save_image):
        * libgthumb/file-data.c: (file_data_new), (file_data_dup),
        (file_data_unref), (file_data_set_path):
        * libgthumb/file-data.h:
        * libgthumb/file-utils.c: (gfile_get_path_from_uri),
        (get_pixbuf_using_external_converter), (gth_pixbuf_new_from_file),
        (gth_pixbuf_animation_new_from_file):
        * libgthumb/file-utils.h:
        * libgthumb/gth-exif-utils.c: (gth_read_exiv2), (update_metadata):
        * libgthumb/gth-exif-utils.h:
        * src/catalog-png-exporter.c: (begin_page), (end_page):
        * src/catalog-web-exporter.c: (save_image_preview_cb):
        * src/dlg-convert.c: (save_image_and_remove_original):
        * src/dlg-jpegtran.c: (apply_transformation__trim_response),
        (apply_transformation__step2):
        * src/dlg-photo-importer.c: (save_image):
        * src/dlg-reset-exif.c: (apply_transformation__step2):
        * src/gth-batch-op.c: (pixbuf_op_done_cb):
        * src/gth-browser.c: (get_image_to_preload):
        * src/rotation-utils.c: (apply_transformation_jpeg),
        (apply_transformation_generic):

        Stop using the gthumb cache of remote files and use the gvfs mount
        point instead. Still need to purge copy_remote_file_to_cache,
        update_file_from_cache, obtain_local_file, and allied functions.

        Added a local_path entry to the FileData structure to record the
        local path or .gvfs mount point.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/comments.c
   trunk/libgthumb/dlg-save-image.c
   trunk/libgthumb/file-data.c
   trunk/libgthumb/file-data.h
   trunk/libgthumb/file-utils.c
   trunk/libgthumb/file-utils.h
   trunk/libgthumb/gth-exif-utils.c
   trunk/libgthumb/gth-exif-utils.h
   trunk/src/catalog-png-exporter.c
   trunk/src/catalog-web-exporter.c
   trunk/src/dlg-convert.c
   trunk/src/dlg-jpegtran.c
   trunk/src/dlg-photo-importer.c
   trunk/src/dlg-reset-exif.c
   trunk/src/gth-batch-op.c
   trunk/src/gth-browser.c
   trunk/src/rotation-utils.c

Modified: trunk/libgthumb/comments.c
==============================================================================
--- trunk/libgthumb/comments.c	(original)
+++ trunk/libgthumb/comments.c	Sun Dec 21 03:41:10 2008
@@ -499,7 +499,7 @@
 
 	add_metadata = simple_add_metadata (add_metadata, TAG_NAME_SETS[KEYWORD_TAG_NAMES][0], keywords_str);
 
-	update_and_save_metadata (file->path, file->path, add_metadata);
+	update_and_save_metadata (file->local_path, file->local_path, add_metadata);
 	free_metadata (add_metadata);
 	file_data_unref (file);
 	g_free (keywords_str);
@@ -521,7 +521,7 @@
 		return NULL;
 
 	comment_uri = comments_get_comment_filename (uri, TRUE);
-	local_file = get_cache_filename_from_uri (comment_uri);
+	local_file = gfile_get_path_from_uri (comment_uri);
 	if (! path_exists (local_file)) {
 		g_free (comment_uri);
 		g_free (local_file);
@@ -640,7 +640,7 @@
 	/* Write to disk. */
 
 	comment_uri = comments_get_comment_filename (uri, TRUE);
-        local_file = get_cache_filename_from_uri (comment_uri);
+        local_file = gfile_get_path_from_uri (comment_uri);
 	dest_dir = remove_level_from_path (local_file);
 	if (ensure_dir_exists (dest_dir, 0700)) {
 		xmlSetDocCompressMode (doc, 3);

Modified: trunk/libgthumb/dlg-save-image.c
==============================================================================
--- trunk/libgthumb/dlg-save-image.c	(original)
+++ trunk/libgthumb/dlg-save-image.c	Sun Dec 21 03:41:10 2008
@@ -112,20 +112,15 @@
 		image_type = g_strdup (file->mime_type + strlen("image/"));
 
 		if (dlg_save_options (parent, image_type, &keys, &values)) {
-			char *local_file;
-			
-			local_file = get_cache_filename_from_uri (file->path);
 			if (_gdk_pixbuf_savev (pixbuf,
-					       local_file,
-					       local_file,
+					       file->local_path,
+					       file->local_path,
 					       image_type,
 					       keys, values,
 					       &error))
 				image_saved = TRUE;
 			else
 				_gtk_error_dialog_from_gerror_run (parent, &error);
-				
-			g_free (local_file);
 		}
 
 		g_free (image_type);

Modified: trunk/libgthumb/file-data.c
==============================================================================
--- trunk/libgthumb/file-data.c	(original)
+++ trunk/libgthumb/file-data.c	Sun Dec 21 03:41:10 2008
@@ -68,6 +68,7 @@
 
 	fd->ref = 1;
 	fd->path = add_scheme_if_absent (path);
+	fd->local_path = gfile_get_path_from_uri (fd->path);
 	fd->name = file_name_from_path (fd->path);
 	fd->display_name = get_utf8_display_name_from_uri (fd->name);
 	if (info != NULL) {
@@ -140,6 +141,7 @@
 
 	fd->ref = 1;
 	fd->path = g_strdup (source->path);
+	fd->local_path = g_strdup (source->local_path);
 	fd->name = file_name_from_path (fd->path);
 	fd->display_name = g_strdup (source->display_name);
 	fd->mime_type = get_static_string (source->mime_type);
@@ -169,6 +171,7 @@
 
 	if (fd->ref == 0) {
 		g_free (fd->path);
+		g_free (fd->local_path);
 		g_free (fd->display_name);
 		if (fd->comment_data != NULL)
 			comment_data_free (fd->comment_data);
@@ -305,6 +308,8 @@
 
 	g_free (fd->path);
 	fd->path = g_strdup (path);
+	g_free (fd->local_path);
+	fd->local_path = gfile_get_path_from_uri (fd->path);
 
 	file_data_update (fd);
 }

Modified: trunk/libgthumb/file-data.h
==============================================================================
--- trunk/libgthumb/file-data.h	(original)
+++ trunk/libgthumb/file-data.h	Sun Dec 21 03:41:10 2008
@@ -32,7 +32,8 @@
 typedef struct {
 	guint               ref : 8;
 
-	char               *path;          /* Full path name. */
+	char               *path;          /* Full URI */
+	char               *local_path;    /* local path or .gvfs mount point */
 	const char         *name;          /* File name only. */
 	char               *display_name;
 	const char         *mime_type;

Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c	(original)
+++ trunk/libgthumb/file-utils.c	Sun Dec 21 03:41:10 2008
@@ -2618,6 +2618,22 @@
 /* VFS caching */
 
 
+char *
+gfile_get_path_from_uri (const char *uri)
+{
+        GFile *gfile;
+        char  *path;
+
+        gfile = gfile_new (uri);
+        path = gfile_get_path (gfile);
+        g_object_unref (gfile);
+
+	g_assert (path != NULL);
+
+        return path;
+}
+
+
 gboolean
 is_local_file (const char *filename)
 {
@@ -2922,8 +2938,6 @@
 				     int         requested_width,
 				     int         requested_height)
 {
-	char       *local_file;
-	char       *local_uri;
 	char	   *cache_file;
 	char       *md5_file;
 	char	   *cache_file_full;
@@ -2935,12 +2949,7 @@
 	gboolean    is_hdr;
 	gboolean    is_thumbnail;
 
-	local_file = get_cache_filename_from_uri (file->path);
-	if (local_file == NULL)
-		return NULL;
-
 	is_thumbnail = requested_width > 0;
-	local_uri = get_uri_from_local_path (local_file);
 
 	is_raw = mime_type_is_raw (file->mime_type);
 	is_hdr = mime_type_is_hdr (file->mime_type);
@@ -2948,7 +2957,7 @@
 	/* The output filename, and its persistence, depend on the input file
 	   type, and whether or not a thumbnail has been requested. */
 
-	md5_file = gnome_thumbnail_md5 (local_uri);
+	md5_file = gnome_thumbnail_md5 (file->local_path);
 	
 	if (is_raw && !is_thumbnail)
 		/* Full-sized converted RAW file */
@@ -2970,14 +2979,12 @@
 	g_free (md5_file);
 
 	if (cache_file == NULL) {
-		g_free (local_file);
-		g_free (local_uri);
 		g_free (cache_file);
 		g_free (cache_file_esc);
 		return NULL;
 	}
 
-	local_file_esc = g_shell_quote (local_file);
+	local_file_esc = g_shell_quote (file->local_path);
 
 	/* Do nothing if an up-to-date converted file is already in the cache */
 	if (! path_is_file (cache_file) || (file->mtime > get_file_mtime (cache_file))) {
@@ -2995,7 +3002,7 @@
 			        	g_spawn_command_line_sync (thumb_command, NULL, NULL, NULL, NULL);
 				g_free (thumb_command);
 
-				first_part = remove_extension_from_path (local_file);
+				first_part = remove_extension_from_path (file->local_path);
 				jpg_thumbnail = g_strdup_printf ("%s.thumb.jpg", first_part);
 				tiff_thumbnail = g_strdup_printf ("%s.thumb.tiff", first_part);
 				ppm_thumbnail = g_strdup_printf ("%s.thumb.ppm", first_part);
@@ -3070,8 +3077,6 @@
 	g_free (cache_file);
 	g_free (cache_file_esc);
 	g_free (local_file_esc);
-	g_free (local_file);
-	g_free (local_uri);
 
 	return pixbuf;
 }
@@ -3140,15 +3145,10 @@
 {
 	GdkPixbuf     *pixbuf = NULL;
 	GdkPixbuf     *rotated = NULL;
-	char          *local_file = NULL;
 
 	if (file == NULL)
 		return NULL;
 
-	local_file = get_cache_filename_from_uri (file->path);
-	if (local_file == NULL)
-		return NULL;
-
 	if (mime_type_is_video (file->mime_type)) {
 		if (factory != NULL) 
 			return gth_pixbuf_new_from_video (file, factory, error, (requested_width == 0));
@@ -3161,7 +3161,7 @@
 	if ((pixbuf == NULL) 
 	    && mime_type_is_raw (file->mime_type) 
 	    && (requested_width > 0))
-		pixbuf = or_gdkpixbuf_extract_thumbnail (local_file, requested_width);
+		pixbuf = or_gdkpixbuf_extract_thumbnail (file->local_path, requested_width);
 #endif
 
 	/* Use dcraw for raw images, pfstools for HDR images */
@@ -3176,7 +3176,7 @@
 	if ((pixbuf == NULL) && (requested_width > 0)) {
 		int w, h;
 		
-		if (gdk_pixbuf_get_file_info (local_file, &w, &h) == NULL) {
+		if (gdk_pixbuf_get_file_info (file->local_path, &w, &h) == NULL) {
 			w = -1;
 			h = -1;
 		}
@@ -3184,17 +3184,17 @@
 		/* scale the image only if the original size is larger than
 		 * the requested size. */
 		if ((w > requested_width) || (h > requested_height))
-			pixbuf = gdk_pixbuf_new_from_file_at_scale (local_file,
+			pixbuf = gdk_pixbuf_new_from_file_at_scale (file->local_path,
                         	                                    requested_width,
                                 	                            requested_height,
                                         	                    TRUE,
                                                 	            error);
 		else
-			pixbuf = gdk_pixbuf_new_from_file (local_file, error);
+			pixbuf = gdk_pixbuf_new_from_file (file->local_path, error);
 	}
 	else if (pixbuf == NULL)
 		/* otherwise, no scaling required */
-		pixbuf = gdk_pixbuf_new_from_file (local_file, error);
+		pixbuf = gdk_pixbuf_new_from_file (file->local_path, error);
 
 	/* Did any of the loaders work? */
 	if (pixbuf == NULL)
@@ -3202,7 +3202,7 @@
 
 	/* rotate pixbuf if required, based on exif orientation tag (jpeg only) */
 
-	debug (DEBUG_INFO, "Check orientation tag of %s. Width %d\n\r", local_file, requested_width);
+	debug (DEBUG_INFO, "Check orientation tag of %s. Width %d\n\r", file->local_path, requested_width);
 
 #if GDK_PIXBUF_CHECK_VERSION(2,11,5)
         /* New in gtk 2.11.5 - see bug 439567 */
@@ -3228,7 +3228,6 @@
 	}
 
 	g_object_unref (pixbuf);
-	g_free (local_file);
 
 	return rotated;
 }
@@ -3248,12 +3247,7 @@
 		return NULL;
 
 	if (mime_type_is (file->mime_type, "image/gif")) {
-		char *local_file;
-		
-		local_file = get_cache_filename_from_uri (file->path);
-		animation = gdk_pixbuf_animation_new_from_file (local_file, error);
-		g_free (local_file);
-
+		animation = gdk_pixbuf_animation_new_from_file (file->local_path, error);
 		return animation;
 	}
  

Modified: trunk/libgthumb/file-utils.h
==============================================================================
--- trunk/libgthumb/file-utils.h	(original)
+++ trunk/libgthumb/file-utils.h	Sun Dec 21 03:41:10 2008
@@ -257,6 +257,9 @@
 gboolean            is_mime_type_writable         (const char       *mime_type);
 gboolean            check_permissions             (const char       *path,
 						   int               mode);
+
+char *              gfile_get_path_from_uri       (const char       *uri);
+
 gboolean	    is_local_file                 (const char       *filename);
 char *              get_cache_filename_from_uri   (const char       *uri);
 char *              get_cache_uri_from_uri        (const char       *uri);

Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c	(original)
+++ trunk/libgthumb/gth-exif-utils.c	Sun Dec 21 03:41:10 2008
@@ -471,36 +471,26 @@
 }
 
 
-GList *
-gth_read_exiv2 (const char *uri, GList *metadata)
+static GList *
+gth_read_exiv2 (const char *local_path, GList *metadata)
 {
-	char *local_file;
-	char *uri_wo_ext;
-        char *sidecar_uri;
-
-        local_file = get_cache_filename_from_uri (uri);
-        if (local_file == NULL)
-                return metadata;
+	char *path_wo_ext;
+        char *sidecar_local_path;
 
 	/* Because prepending is faster than appending */
 	metadata = g_list_reverse (metadata);
 
 	/* Read image file */
-	metadata = read_exiv2_file (local_file, metadata);
-	g_free (local_file);
+	metadata = read_exiv2_file (local_path, metadata);
 
 	/* 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);
-
-	if ((local_file != NULL) && path_exists (local_file))
-	       	metadata = read_exiv2_sidecar (local_file, metadata);
-
-	g_free (local_file);
-       	g_free (uri_wo_ext);
-        g_free (sidecar_uri);
+	path_wo_ext = remove_extension_from_path (local_path);
+	sidecar_local_path = g_strconcat (path_wo_ext, ".xmp", NULL);
+	if (path_exists (sidecar_local_path))
+	      	metadata = read_exiv2_sidecar (sidecar_local_path, metadata);
+
+	g_free (path_wo_ext);
+        g_free (sidecar_local_path);
 
 	/* Undo the initial reverse */
 	metadata = g_list_reverse (metadata);
@@ -519,31 +509,19 @@
 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->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. */ 
@@ -551,8 +529,6 @@
  	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; 
 }
 

Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h	(original)
+++ trunk/libgthumb/gth-exif-utils.h	Sun Dec 21 03:41:10 2008
@@ -104,8 +104,6 @@
                                            GList        *metdata);
 void	      write_orientation_field     (const char   *filename, 
 				  	   GthTransform  transform);
-GList *       gth_read_exiv2		  (const char   *filename,
-					   GList        *metadata);
 void          update_metadata		  (FileData	*fd);
 void          swap_fields                 (GList        *metadata,
 					   const char   *tag1,

Modified: trunk/src/catalog-png-exporter.c
==============================================================================
--- trunk/src/catalog-png-exporter.c	(original)
+++ trunk/src/catalog-png-exporter.c	Sun Dec 21 03:41:10 2008
@@ -32,6 +32,7 @@
 #include "catalog-png-exporter.h"
 #include "comments.h"
 #include "file-utils.h"
+#include "gfile-utils.h"
 #include "gthumb-init.h"
 #include "gthumb-marshal.h"
 #include "pixbuf-utils.h"
@@ -1624,7 +1625,6 @@
 {
 	GError            *error = NULL;
 	int                width, height;
-	char              *local_file;
 	char              *filename;
 	char              *name;
 	char              *line;
@@ -1669,20 +1669,7 @@
 	ce->imap_uri = g_strconcat (ce->location, "/", name, ".html", NULL);
 	g_warning ("URI: %s", ce->imap_uri);
 
-	/*
-	 * NOTE: gio port
-	 * 
-	 *   Set ce->imap_gfile from ce->imap_uri.
-	 *   
-	 *   This is a temporary workaround. Getting rid of ce->imap_uri
-	 *   requires converting to GFile: 
-	 *   1) get_cache_uri_from_uri 
-	 *   2) recipients of all_windows_notify_files_created  
-	 */
-	local_file = get_cache_uri_from_uri (ce->imap_uri);
-	ce->imap_gfile = g_file_new_for_uri (local_file);
-	g_free (local_file);
-	
+	ce->imap_gfile = gfile_new (ce->imap_uri);
 	ce->ostream = g_file_replace (ce->imap_gfile, 
 				      NULL,
 				      FALSE,
@@ -1736,7 +1723,7 @@
 
 	name = _g_get_name_from_template (ce->templatev, ce->start_at + page_n - 1);
 	uri = g_strconcat (ce->location, "/", name, ".", ce->file_type, NULL);
-	local_file = get_cache_filename_from_uri (uri);
+	local_file = gfile_get_path_from_uri (uri);
 	
 	if (strcmp (ce->file_type, "jpeg") == 0)
 		_gdk_pixbuf_save (pixbuf, local_file, NULL, "jpeg", NULL, "quality", "85", NULL);

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Sun Dec 21 03:41:10 2008
@@ -2618,7 +2618,7 @@
 			g_free (local_file);
 			g_free (src_local_file);
 			g_object_unref (file);
-			g_object_unref (src_local_file);
+			g_object_unref (src_local_gfile);
 		}
 	}
 

Modified: trunk/src/dlg-convert.c
==============================================================================
--- trunk/src/dlg-convert.c	(original)
+++ trunk/src/dlg-convert.c	Sun Dec 21 03:41:10 2008
@@ -260,7 +260,7 @@
 	old_local_file = gfile_get_path (old_local_gfile);
 	g_object_unref (old_local_gfile);
 
-	local_file = get_cache_filename_from_uri (data->new_path);
+	local_file = gfile_get_path_from_uri (data->new_path);
 	if (! _gdk_pixbuf_savev (data->pixbuf,
 			         local_file,
 				 old_local_file,

Modified: trunk/src/dlg-jpegtran.c
==============================================================================
--- trunk/src/dlg-jpegtran.c	(original)
+++ trunk/src/dlg-jpegtran.c	Sun Dec 21 03:41:10 2008
@@ -271,18 +271,13 @@
 {
 	ApplyTransformData *at_data = callback_data;
 	FileData           *file = at_data->current_image->data;
-	char		   *local_file = NULL;
 	GthTransform        image_orientation;
 	GthTransform	    required_transform;
 
-	local_file = get_cache_filename_from_uri (file->path);
 	image_orientation = get_orientation_from_fd (file);
 	required_transform = get_next_transformation (image_orientation, at_data->data->transform);
-	
 	apply_transformation_jpeg (file, required_transform, action, NULL);
 	
-	g_free (local_file);
-	
 	update_file_from_cache (file, apply_transformation_done, at_data);
 }
 
@@ -294,18 +289,16 @@
 {
 	ApplyTransformData *at_data = callback_data;
 	FileData           *file = at_data->current_image->data;
-	char		   *local_file = NULL;
 	GthTransform        image_orientation;
 	GthTransform	    required_transform;
 	gboolean            go_on = TRUE;
 	
-	local_file = get_cache_filename_from_uri (file->path);
 	image_orientation = get_orientation_from_fd (file);
 	required_transform = get_next_transformation (image_orientation, at_data->data->transform);
 	if (mime_type_is (file->mime_type, "image/jpeg")) {
 		if (! eel_gconf_get_boolean (PREF_ROTATE_RESET_EXIF_ORIENTATION, TRUE)) 
 			/* Adjust Exif orientation tag. */
-			write_orientation_field (local_file, required_transform);
+			write_orientation_field (file->local_path, required_transform);
 		else { 
 			GError *error = NULL;
  			
@@ -325,7 +318,6 @@
 	else 
 		/* Generic image transform. */
 		apply_transformation_generic (file, required_transform, NULL);
-	g_free (local_file);
 	
 	if (go_on)
 		update_file_from_cache (file, apply_transformation_done, at_data);

Modified: trunk/src/dlg-photo-importer.c
==============================================================================
--- trunk/src/dlg-photo-importer.c	(original)
+++ trunk/src/dlg-photo-importer.c	Sun Dec 21 03:41:10 2008
@@ -1295,7 +1295,7 @@
 	} else {
 		/* Otherwise, the images go straight into the destination folder */
 		file_uri = get_file_name (data, camera_path, unescaped_local_folder, n);
-		local_path = get_cache_filename_from_uri (file_uri);		
+		local_path = gfile_get_path_from_uri (file_uri);		
 	}
 
 	if ( (local_path != NULL) && gp_file_save (file, local_path) >= 0) {

Modified: trunk/src/dlg-reset-exif.c
==============================================================================
--- trunk/src/dlg-reset-exif.c	(original)
+++ trunk/src/dlg-reset-exif.c	Sun Dec 21 03:41:10 2008
@@ -145,11 +145,8 @@
 {
 	ApplyTransformData *at_data = callback_data;
 	FileData           *file = at_data->current_image->data;
-	char		   *local_file = NULL;
 
-	local_file = get_cache_filename_from_uri (file->path);
-	write_orientation_field (local_file, GTH_TRANSFORM_NONE);
-	g_free (local_file);
+	write_orientation_field (file->local_path, GTH_TRANSFORM_NONE);
 	
 	update_file_from_cache (file, apply_transformation_done, at_data);
 }

Modified: trunk/src/gth-batch-op.c
==============================================================================
--- trunk/src/gth-batch-op.c	(original)
+++ trunk/src/gth-batch-op.c	Sun Dec 21 03:41:10 2008
@@ -479,7 +479,7 @@
         old_local_file = gfile_get_path (old_local_gfile);
         g_object_unref (old_local_gfile);
 
-	local_file = get_cache_filename_from_uri (PD(bop)->new_path);
+	local_file = gfile_get_path_from_uri (PD(bop)->new_path);
 	if (! _gdk_pixbuf_savev (pixop->dest,
 			         local_file,
 				 old_local_file,

Modified: trunk/src/gth-browser.c
==============================================================================
--- trunk/src/gth-browser.c	(original)
+++ trunk/src/gth-browser.c	Sun Dec 21 03:41:10 2008
@@ -8225,7 +8225,6 @@
 {
 	FileData  *fdata;
 	int        max_size;
-	char      *local_file;
 	int        width = 0, height = 0;
 
 	if (pos < 0)
@@ -8250,17 +8249,15 @@
 		return NULL;
 	}
 
-	local_file = get_cache_filename_from_uri (fdata->path);
-	gdk_pixbuf_get_file_info (local_file, &width, &height);
+	gdk_pixbuf_get_file_info (fdata->local_path, &width, &height);
 
-	debug (DEBUG_INFO, "%s dimensions: [%dx%d] <-> %d\n", local_file, width, height, max_size);
+	debug (DEBUG_INFO, "%s dimensions: [%dx%d] <-> %d\n", fdata->local_path, width, height, max_size);
 
 	if (width * height > max_size) {
-		debug (DEBUG_INFO, "image %s dimensions are too large for preloading\n", local_file);
+		debug (DEBUG_INFO, "image %s dimensions are too large for preloading\n", fdata->local_path);
 		file_data_unref (fdata);
 		fdata = NULL;
 	}
-	g_free (local_file);
 
 	return fdata;
 }

Modified: trunk/src/rotation-utils.c
==============================================================================
--- trunk/src/rotation-utils.c	(original)
+++ trunk/src/rotation-utils.c	Sun Dec 21 03:41:10 2008
@@ -145,7 +145,6 @@
 	char             *tmp_dir = NULL;
 	char             *tmp_output_file = NULL;
 	JXFORM_CODE       transf;
-	char		 *local_file;
 	GFile            *gfile;
 	GFileInfo        *info;
 
@@ -162,13 +161,6 @@
 		return FALSE;
 	}
 
-	local_file = get_cache_filename_from_uri (file->path);
-	if (local_file == NULL) {
-		if (error != NULL)
-			*error = g_error_new (GTHUMB_ERROR, 0, "%s", _("Could not create a local temporary copy of the remote file."));
-		result = FALSE;
-		goto apply_transformation_jpeg__free_and_close;
-	}
 	gfile = g_file_new_for_uri (file->path);
 	info = g_file_query_info (gfile, "owner::*,access::*", G_FILE_QUERY_INFO_NONE, NULL, NULL);
 	g_object_unref (gfile);
@@ -204,12 +196,12 @@
 	}
 
 	tmp_output_file = get_temp_file_name (tmp_dir, NULL);
-	if (! jpegtran (local_file, tmp_output_file, transf, mcu_action, error)) {
+	if (! jpegtran (file->local_path, tmp_output_file, transf, mcu_action, error)) {
 		result = FALSE;
 		goto apply_transformation_jpeg__free_and_close;
 	}
 
-	if (! local_file_move (tmp_output_file, local_file)) {
+	if (! local_file_move (tmp_output_file, file->local_path)) {
 		if (error != NULL)
 			*error = g_error_new (GTHUMB_ERROR, 0, "%s", _("Could not move temporary file to local destination. Check folder permissions."));
 		result = FALSE;
@@ -217,14 +209,10 @@
 	}
 
 	if (info != NULL) {
-		char *local_uri;
-		
-		local_uri = get_uri_from_local_path (local_file);
 		gfile = g_file_new_for_uri (file->path);
 		g_file_set_attributes_from_info (gfile, info, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 		g_object_unref (info);
 		g_object_unref (gfile);
-		g_free (local_uri);
 	}
 
 apply_transformation_jpeg__free_and_close:
@@ -260,19 +248,15 @@
 		
 	if (is_mime_type_writable (file->mime_type)) {
 		const char *image_type = file->mime_type + 6;
-		char	   *local_file;
 		
 		image_type = file->mime_type + 6;
-		local_file = get_cache_filename_from_uri (file->path);
 	
 		success = _gdk_pixbuf_save (transformed_pixbuf,
-					    local_file,
-					    local_file,
+					    file->local_path,
+					    file->local_path,
 					    image_type,
 					    error,
 					    NULL);
-					    
-		g_free (local_file);
 	} 
 	else {
 		if (error != NULL)



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