[gthumb] Purged get_local_path_from_uri as part of gnomevfs removal



commit 2168305424cf6f81557010c8e3e61d39fe0e0e24
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Wed May 20 08:40:28 2009 -0400

    Purged get_local_path_from_uri as part of gnomevfs removal
---
 libgthumb/file-utils.c             |   16 +++--------
 libgthumb/file-utils.h             |    1 -
 src/gth-window-actions-callbacks.c |   50 +++++++++++++++++++----------------
 3 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
index 26909cd..723af91 100644
--- a/libgthumb/file-utils.c
+++ b/libgthumb/file-utils.c
@@ -1220,13 +1220,6 @@ file_name_from_path (const char *file_name)
 }
 
 
-char *
-get_local_path_from_uri (const char *uri)
-{
-       	return gnome_vfs_unescape_string (remove_host_from_uri (uri), NULL);
-}
-
-
 /* Check whether the path_src is contained in path_dest */
 gboolean
 path_in_path (const char  *path_src,
@@ -2326,11 +2319,10 @@ gth_pixbuf_new_from_video (FileData               *file,
 							file->uri,
 							file->mtime);
 	if (thumbnail_uri != NULL) {
-		char *thumbnail_path;
-
-		thumbnail_path = get_local_path_from_uri (thumbnail_uri);
-		pixbuf = gdk_pixbuf_new_from_file (thumbnail_path, error);
-		g_free (thumbnail_path);
+		FileData *fd_thumb;
+		fd_thumb = file_data_new (thumbnail_uri);
+		pixbuf = gdk_pixbuf_new_from_file (fd_thumb->local_path, error);
+		file_data_unref (fd_thumb);
 	}
 	else if (gnome_thumbnail_factory_has_valid_failed_thumbnail (factory, 
 								     file->uri, 
diff --git a/libgthumb/file-utils.h b/libgthumb/file-utils.h
index de45363..45ae4f8 100644
--- a/libgthumb/file-utils.h
+++ b/libgthumb/file-utils.h
@@ -156,7 +156,6 @@ char *              add_filename_to_uri           (const char       *uri,
 char *              get_uri_from_local_path       (const char       *path);
 char *              get_uri_display_name          (const char       *uri);
 G_CONST_RETURN char*file_name_from_path           (const char       *path);
-char *              get_local_path_from_uri       (const char       *uri);
 gboolean            path_in_path                  (const char       *path_src,
 						   const char       *path_dest);
 int                 uricmp                        (const char       *uri1,
diff --git a/src/gth-window-actions-callbacks.c b/src/gth-window-actions-callbacks.c
index 4a8aee2..8921e73 100644
--- a/src/gth-window-actions-callbacks.c
+++ b/src/gth-window-actions-callbacks.c
@@ -641,14 +641,14 @@ set_wallpaper_step_2 (const char     *uri,
 	client = gconf_client_get_default ();
 
 	if (path_is_file (uri)) {
-		char *image_path;
-		
-		image_path = get_local_path_from_uri (uri);
-		gconf_client_set_string (client,
-					 "/desktop/gnome/background/picture_filename",
-					 image_path,
-					 NULL);
-		g_free (image_path);
+		FileData *fd;
+		fd = file_data_new (uri);
+		if (file_data_has_local_path (fd, GTK_WINDOW (data->window)))
+			gconf_client_set_string (client,
+						 "/desktop/gnome/background/picture_filename",
+						 fd->local_path,
+						 NULL);
+		file_data_unref (fd);
 		
 		switch (data->align) {
 		case WALLPAPER_ALIGN_TILED:
@@ -755,6 +755,7 @@ set_wallpaper_from_window (GthWindow      *window,
 		char        *wallpaper_filename = NULL;
 		char        *local_file;
 		GError      *error = NULL;
+		FileData    *fd;
 
 		image_viewer = gth_window_get_image_viewer (window);
 		pixbuf = image_viewer_get_current_pixbuf (image_viewer);
@@ -764,23 +765,26 @@ set_wallpaper_from_window (GthWindow      *window,
 		g_object_ref (pixbuf);
 
 		wallpaper_filename = get_new_wallpaper_filename ();
-		local_file = get_local_path_from_uri (wallpaper_filename);
-		if (! _gdk_pixbuf_save (pixbuf,
-					local_file,
-					NULL,
-					"jpeg",
-					&error,
-					NULL)) 
-		{
-			_gtk_error_dialog_from_gerror_run (GTK_WINDOW (window), &error);
-			g_object_unref (pixbuf);
-			g_free (local_file);			
-			g_free (wallpaper_filename);
-			return;
-		}
 
+		fd = file_data_new (wallpaper_filename);
+		if (file_data_has_local_path (fd, GTK_WINDOW (window))) {
+			if (! _gdk_pixbuf_save (pixbuf,
+						fd->local_path,
+						NULL,
+						"jpeg",
+						&error,
+						NULL)) 
+			{
+				_gtk_error_dialog_from_gerror_run (GTK_WINDOW (window), &error);
+				g_object_unref (pixbuf);
+				file_data_unref (fd);		
+				g_free (wallpaper_filename);
+				return;
+			}
+		}
 		image_path = wallpaper_filename;
-		
+
+		file_data_unref (fd);
 		g_object_unref (pixbuf);
 		g_free (local_file);
 	}



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