gthumb r2382 - in trunk: . libgthumb src



Author: mjc
Date: Thu Aug  7 14:14:47 2008
New Revision: 2382
URL: http://svn.gnome.org/viewvc/gthumb?rev=2382&view=rev

Log:
2008-08-07  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/file-utils.c: (_empty_file_progress_cb), (xfer_file),
        (file_rename), (path_exists), (copy_data_new),
        (copy_file_async_done), (copy_remote_file_to_cache_done):
        * libgthumb/file-utils.h:
        * libgthumb/image-loader.c: (image_loader_start__step3),
        (image_loader_start__step2):
        * src/catalog-png-exporter.c:
        (copy_current_file_to_destination_done), (begin_page), (end_page),
        (paint_frame):
        * src/catalog-png-exporter.h:
        * src/catalog-web-exporter.c: (gth_parsed_doc_print):
        * src/dlg-convert.c: (save_image_and_remove_original_step2):
        * src/dlg-file-utils.c: (dlg_file_rename_series):
        * src/dlg-jpegtran.c: (apply_transformation_done),
        (apply_transformation__step2), (apply_transformation),
        (apply_transformation_to_all_continue),
        (load_next_image_after_transformation):
        * src/dlg-photo-importer.c: (async_step_done):
        * src/dlg-png-exporter.c:
        * src/dlg-reset-exif.c: (apply_transformation_done),
        (apply_transformation__step2), (apply_transformation),
        (apply_transformation_to_all_continue):
        * src/gth-batch-op.c: (save_image_and_remove_original_step2):
        * src/gth-browser-actions-callbacks.c: (catalog_rename),
        (folder_rename), (folder_copy__response_cb):
        * src/gth-browser.c: (dir_list_key_press_cb),
        (dir_list_button_release_cb), (catalog_list_button_release_cb),
        (key_press_cb), (viewer_drag_data_received):
        * src/gth-window-actions-callbacks.c: (set_wallpaper_step_2):
        * src/rotation-utils.c: (apply_transformation_jpeg):

        Continuation of the gio migration. File transfers now use the gio
        code. Tweaked version of Gabriel FalcÃo's (gabriel nacaolivre org)
        patches from bug #525482.



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

Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c	(original)
+++ trunk/libgthumb/file-utils.c	Thu Aug  7 14:14:47 2008
@@ -67,6 +67,12 @@
 #define CHUNK_SIZE 128
 #define MAX_SYMLINKS_FOLLOWED 32
 
+/* empty functions */
+static void _empty_file_progress_cb  (goffset current_num_bytes,
+				      goffset total_num_bytes,
+				      gpointer user_data)
+{
+}
 
 /* Async directory list */
 
@@ -781,9 +787,9 @@
 	   const char *to,
 	   gboolean    move)
 {
-	GnomeVFSURI         *from_uri, *to_uri;
-	GnomeVFSXferOptions  opt;
-	GnomeVFSResult       result;
+	GnomeVFSURI   *from_uri, *to_uri;
+	GError        *ioerror = NULL;
+	GFile         *sfile, *dfile;
 
 	if (same_uri (from, to)) {
 		g_warning ("cannot copy file %s: source and destination are the same\n", from);
@@ -792,19 +798,30 @@
 
 	from_uri = new_uri_from_path (from);
 	to_uri = new_uri_from_path (to);
-	opt = move ? GNOME_VFS_XFER_REMOVESOURCE : GNOME_VFS_XFER_DEFAULT;
-	result = gnome_vfs_xfer_uri (from_uri,
-				     to_uri,
-				     opt,
-				     GNOME_VFS_XFER_ERROR_MODE_ABORT,
-				     GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
-				     NULL,
-				     NULL);
 
-	gnome_vfs_uri_unref (from_uri);
-	gnome_vfs_uri_unref (to_uri);
+	sfile = g_file_new_for_uri (gnome_vfs_uri_get_path (from_uri));
+	dfile = g_file_new_for_uri (gnome_vfs_uri_get_path (to_uri));
+	if (move)
+		g_file_move (sfile, dfile,
+			     G_FILE_COPY_OVERWRITE,
+			     NULL, _empty_file_progress_cb,
+			     NULL, &ioerror);
+	else
+		g_file_copy (sfile, dfile,
+			     G_FILE_COPY_OVERWRITE,
+			     NULL, _empty_file_progress_cb,
+			     NULL, &ioerror);
 
-	return (result == GNOME_VFS_OK);
+	g_object_unref (sfile);
+	g_object_unref (dfile);
+	g_free (from_uri);
+	g_free (to_uri);
+	
+	if (ioerror) {
+		g_error_free (ioerror);
+		return FALSE;
+	} else
+		return TRUE;
 }
 
 
@@ -844,11 +861,28 @@
 }
 
 
-GnomeVFSResult
+gboolean 
 file_rename (const char *old_path,
-	     const char *new_path)
+	     const char *new_path,
+	     GError **error)
 {
-	return gnome_vfs_move (old_path, new_path, TRUE);
+	GFile *sfile, *dfile;
+	GError *err = NULL;
+	gboolean result;
+	sfile = g_file_new_for_uri (old_path);
+	dfile = g_file_new_for_uri (new_path);
+
+	result = g_file_move (sfile, dfile,
+                              G_FILE_COPY_OVERWRITE,
+                              NULL,
+			      _empty_file_progress_cb,
+			      NULL, &err);
+	if (err)
+		g_propagate_error (error, err);
+	
+	g_object_unref (sfile);
+	g_object_unref (dfile);
+	return result;
 }
 
 
@@ -1047,22 +1081,10 @@
 gboolean
 path_exists (const char *path)
 {
-	GnomeVFSFileInfo *info;
-	GnomeVFSResult    result;
-	gboolean          exists;
-
 	if (! path || ! *path)
 		return FALSE;
-
-	info = gnome_vfs_file_info_new ();
-	result = gnome_vfs_get_file_info (path,
-					  info,
-					  (GNOME_VFS_FILE_INFO_DEFAULT
-					   | GNOME_VFS_FILE_INFO_FOLLOW_LINKS));
-	exists = (result == GNOME_VFS_OK);
-	gnome_vfs_file_info_unref (info);
-
-	return exists;
+	
+	return g_file_test (path, G_FILE_TEST_EXISTS);
 }
 
 
@@ -2531,6 +2553,7 @@
 struct _CopyData {
         char                *source_uri;
         char                *target_uri;
+        GError              *error;
         GnomeVFSResult       result;
         GnomeVFSAsyncHandle *handle;
         CopyDoneFunc         done_func;
@@ -2554,6 +2577,7 @@
 	copy_data->done_data = done_data;
 	copy_data->result = GNOME_VFS_OK;
 	copy_data->idle_id = 0;
+	copy_data->error = NULL;
 	
 	return copy_data;
 }
@@ -2593,7 +2617,7 @@
 	
 	if (copy_data->done_func != NULL) {
 		copy_data->handle = NULL;	
-		(copy_data->done_func) (copy_data->target_uri, copy_data->result, copy_data->done_data);
+		(copy_data->done_func) (copy_data->target_uri, copy_data->error, copy_data->done_data);
 	}
 	copy_data_free (copy_data);
 	
@@ -2981,12 +3005,12 @@
 
 static void
 copy_remote_file_to_cache_done (const char     *uri, 
-				GnomeVFSResult  result, 
+				GError         *error, 
 				gpointer        callback_data)
 {
 	CopyToCacheData *data = callback_data;
 
-	if (result == GNOME_VFS_OK) {
+	if (error == NULL) {
 		FileData *cache_file;
 		
 		cache_file = file_data_new (uri, NULL);
@@ -2996,7 +3020,8 @@
 	}
 	
 	if (data->done_func != NULL)
-		data->done_func (uri, result, data->done_data);
+                /*FIXME: change GnomeVFSResult to GError and use below instead of NULL*/
+		data->done_func (uri, NULL, data->done_data);
 	
 	g_free (data);
 }

Modified: trunk/libgthumb/file-utils.h
==============================================================================
--- trunk/libgthumb/file-utils.h	(original)
+++ trunk/libgthumb/file-utils.h	Thu Aug  7 14:14:47 2008
@@ -39,7 +39,7 @@
 #define SPECIAL_DIR(x) (! strcmp (x, "..") || ! strcmp (x, "."))
 #define errno_to_string() (gnome_vfs_result_to_string (gnome_vfs_result_from_errno ()))
 
-typedef void (*CopyDoneFunc) (const char *, GnomeVFSResult, gpointer);
+typedef void (*CopyDoneFunc) (const char *, GError *, gpointer);
 
 /* Async directory list */
 
@@ -134,8 +134,9 @@
 						   const char       *to);
 gboolean            local_file_move               (const char       *from,
 						   const char       *to);
-GnomeVFSResult      file_rename                   (const char       *old_path,
-						   const char       *new_path);
+gboolean            file_rename                   (const char       *old_path,
+						   const char       *new_path,
+						   GError          **error);
 gboolean            file_unlink                   (const char       *path);
 void		    delete_thumbnail	          (const char       *path);
 gboolean            mime_type_is                  (const char       *mime_type,

Modified: trunk/libgthumb/image-loader.c
==============================================================================
--- trunk/libgthumb/image-loader.c	(original)
+++ trunk/libgthumb/image-loader.c	Thu Aug  7 14:14:47 2008
@@ -725,14 +725,14 @@
 
 static void
 image_loader_start__step3 (const char     *uri,
-			   GnomeVFSResult  result,
+			   GError         *error,
 			   gpointer        data)
 {
 	ImageLoader *il = data;
 	
 	g_return_if_fail (il != NULL);
 
-	if (result != GNOME_VFS_OK) {
+	if (error) {
 		image_loader_error (il);
 		return;
 	}
@@ -771,7 +771,7 @@
 	g_mutex_unlock (il->priv->data_mutex);
 	
 	if (is_local_file (file->path)) 
-		image_loader_start__step3 (file->path, GNOME_VFS_OK, il);
+		image_loader_start__step3 (file->path, NULL, il);
 	else
 		copy_remote_file_to_cache (file, image_loader_start__step3, il);
 	file_data_unref (file);

Modified: trunk/src/catalog-png-exporter.c
==============================================================================
--- trunk/src/catalog-png-exporter.c	(original)
+++ trunk/src/catalog-png-exporter.c	Thu Aug  7 14:14:47 2008
@@ -29,7 +29,6 @@
 #include <gdk/gdkx.h>
 #include <gdk/gdkrgb.h>
 #include <gio/gio.h>
-#include <libgnomevfs/gnome-vfs.h>
 
 #include "catalog-png-exporter.h"
 #include "comments.h"
@@ -871,7 +870,7 @@
 
 static void
 copy_current_file_to_destination_done (const char     *uri, 
-				       GnomeVFSResult  result, 
+				       GError         *error, 
 				       gpointer        data)
 {
 	CatalogPngExporter *ce = data;
@@ -1624,15 +1623,13 @@
 begin_page (CatalogPngExporter *ce,
 	    int                 page_n)
 {
-	GnomeVFSURI      *vfs_uri;
-	GnomeVFSResult    result;
-	GnomeVFSFileSize  temp;
-	int               width, height;
-	char             *local_file;
-	char             *filename;
-	char             *name;
-	char             *line;
-	char             *utf8_name;
+	GError            *error = NULL;
+	int                width, height;
+	char              *local_file;
+	char              *filename;
+	char              *name;
+	char              *line;
+	char              *utf8_name;
 
 	g_signal_emit (G_OBJECT (ce),
 		       catalog_png_exporter_signals[PNG_EXPORTER_PROGRESS],
@@ -1671,34 +1668,31 @@
 	
 	name = _g_get_name_from_template (ce->templatev, ce->start_at + page_n - 1);
 	ce->imap_uri = g_strconcat (ce->location, "/", name, ".html", NULL);
+	g_warning ("URI: %s", ce->imap_uri);
 
 	local_file = get_cache_uri_from_uri (ce->imap_uri);
-	vfs_uri = new_uri_from_path (local_file);
 	g_free (local_file);
-	
-	if (vfs_uri == NULL) {
-		g_warning ("URI not valid: %s", local_file);
-		return;
-	}
+		
+	ce->ostream = g_file_create (ce->imap_gfile, G_FILE_CREATE_NONE, NULL, &error);
 
-	result = gnome_vfs_create_uri (&ce->imap_handle, vfs_uri,
-				       GNOME_VFS_OPEN_WRITE, FALSE, 0664);
-	gnome_vfs_uri_unref (vfs_uri);
-	if (result != GNOME_VFS_OK) {
-		g_warning ("Cannot create file %s", ce->imap_uri);
+	if (error) {
+		g_warning ("Cannot create file %s - %s", ce->imap_uri, error->message);
 		return;
 	}
 
-	gnome_vfs_write (ce->imap_handle, HTML_PAGE_BEGIN, strlen (HTML_PAGE_BEGIN), &temp);
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), HTML_PAGE_BEGIN, strlen (HTML_PAGE_BEGIN), NULL, &error);
 
 	filename = g_strconcat (name, ".", ce->file_type, NULL);
 	line = g_strdup_printf ("<img src=\"%s\" width=\"%d\" height=\"%d\" usemap=\"#map\" alt=\"%s\" />\n", filename, width, height, filename);
-	gnome_vfs_write (ce->imap_handle, line, strlen (line), &temp);
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), line, strlen (line), NULL, &error);
+	g_warning ("LINE +: %s", line);
 	g_free (line);
 	g_free (filename);
 
 	line = g_strdup_printf ("<map name=\"map\" id=\"map\">\n");
-	gnome_vfs_write (ce->imap_handle, line, strlen (line), &temp);
+
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), line, strlen (line), NULL, &error);
+	g_warning ("LINE +: %s", line);
 	g_free (line);
 }
 
@@ -1712,7 +1706,6 @@
 	char             *uri;
 	char             *local_file;
 	int               width, height;
-	GnomeVFSFileSize  temp;
 	char             *line;
 
 	width = ce->page_width;
@@ -1747,9 +1740,11 @@
 		return;
 
 	line = g_strdup_printf ("</map>\n");
-	gnome_vfs_write (ce->imap_handle, line, strlen (line), &temp);
-	gnome_vfs_write (ce->imap_handle, HTML_PAGE_END, strlen (HTML_PAGE_END), &temp);
-	gnome_vfs_close (ce->imap_handle);
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), line, strlen (line), NULL, NULL);	
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), HTML_PAGE_END, strlen (HTML_PAGE_END), NULL, NULL);	
+	
+	g_output_stream_close (G_OUTPUT_STREAM(ce->ostream), NULL, NULL);
+	g_object_unref (ce->imap_gfile);
 	
 	ce->created_files = g_list_prepend (ce->created_files, g_strdup (ce->imap_uri));
 	
@@ -1763,7 +1758,6 @@
 	     GdkRectangle       *image_rect,
 	     gchar              *filename)
 {
-	GnomeVFSFileSize  temp;
 	char		 *unescaped_path, *attr_path;
 	char             *line;
 	char             *rel_path;
@@ -1842,7 +1836,8 @@
 	rel_path = get_path_relative_to_uri (filename, dest_dir);
 	g_free (dest_dir);
 
-	unescaped_path = gnome_vfs_unescape_string (rel_path, NULL);
+	unescaped_path = g_uri_escape_string (rel_path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
+	g_warning ("PATH: %s", unescaped_path);
 	attr_path = _g_escape_text_for_html (unescaped_path, -1);
 	g_free (unescaped_path);
 
@@ -1855,7 +1850,7 @@
 				attr_path);
 	g_free (rel_path);
 	g_free (attr_path);
-	gnome_vfs_write (ce->imap_handle, line, strlen (line), &temp);
+	g_output_stream_write (G_OUTPUT_STREAM(ce->ostream), line, strlen (line), NULL, NULL);	
 	g_free (line);
 }
 

Modified: trunk/src/catalog-png-exporter.h
==============================================================================
--- trunk/src/catalog-png-exporter.h	(original)
+++ trunk/src/catalog-png-exporter.h	Thu Aug  7 14:14:47 2008
@@ -26,6 +26,7 @@
 #include <glib.h>
 #include <gdk/gdk.h>
 #include <gtk/gtkenums.h> /* for GtkSortType */
+#include <gio/gio.h>
 #include <libgnomevfs/gnome-vfs-file-size.h>
 #include <libgnomevfs/gnome-vfs-handle.h>
 #include "image-loader.h"
@@ -129,6 +130,8 @@
 	GdkColor      dark_gray;
 
 	char           *imap_uri;
+	GFile          *imap_gfile;          /* GFile parent of OutputStream below */	
+	GFileOutputStream *ostream;          /* Output stream to handle partial file writing */
 	GnomeVFSHandle *imap_handle;         /* handle to write image map 
 					      * files. */
 

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Thu Aug  7 14:14:47 2008
@@ -1507,7 +1507,7 @@
 			else {
 				char *unescaped_path;
 				
-				unescaped_path = gnome_vfs_unescape_string (image_src_relative, NULL);
+				unescaped_path = g_uri_unescape_string (image_src_relative, "");
 				alt_attr = _g_escape_text_for_html (unescaped_path, -1);
 				g_free (unescaped_path);
 			}

Modified: trunk/src/dlg-convert.c
==============================================================================
--- trunk/src/dlg-convert.c	(original)
+++ trunk/src/dlg-convert.c	Thu Aug  7 14:14:47 2008
@@ -222,13 +222,13 @@
 
 static void
 save_image_and_remove_original_step2 (const char     *uri, 
-				      GnomeVFSResult  result,
+				      GError         *error,
 				      gpointer        callback_data)
 {
 	DialogData *data = callback_data;
 	FileData   *fd;
 	
-	if (result == GNOME_VFS_OK)
+	if (error == NULL)
 		data->saved_list = g_list_prepend (data->saved_list, g_strdup (data->new_path));
 	 
 	fd = (FileData*) data->current_image->data;

Modified: trunk/src/dlg-file-utils.c
==============================================================================
--- trunk/src/dlg-file-utils.c	(original)
+++ trunk/src/dlg-file-utils.c	Thu Aug  7 14:14:47 2008
@@ -942,11 +942,10 @@
 	GList          *o_scan, *n_scan;
 	GList          *error_list = NULL;
 	int             overwrite_result = OVERWRITE_RESULT_UNSPECIFIED;
-	gboolean        file_exists, show_ow_all_none;
+	gboolean        file_exists, show_ow_all_none, result;
 	gboolean        error = FALSE;
 	GList          *files_deleted = NULL;
 	GList          *files_created = NULL;
-	GnomeVFSResult  result = GNOME_VFS_OK;
 
 	all_windows_remove_monitor ();
 
@@ -1006,8 +1005,8 @@
 			continue;
 		}
 
-		result = file_rename (old_full_path, new_full_path);
-		if (result == GNOME_VFS_OK) {
+		result = file_rename (old_full_path, new_full_path, NULL);
+		if (result) {
 			cache_move (old_full_path, new_full_path);
 			comment_move (old_full_path, new_full_path);
 

Modified: trunk/src/dlg-jpegtran.c
==============================================================================
--- trunk/src/dlg-jpegtran.c	(original)
+++ trunk/src/dlg-jpegtran.c	Thu Aug  7 14:14:47 2008
@@ -27,6 +27,7 @@
 #include <unistd.h>
 
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 #include <gtk/gtk.h>
 #include <libgnome/gnome-help.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
@@ -215,7 +216,7 @@
 	GtkWidget        *parent_window;
 	DialogData       *data;
 	GList            *current_image;
-	GnomeVFSFileInfo *info;
+	GFileInfo        *info;
 	gboolean          notify_soon;
 	CopyDoneFunc      done_func;
 	gpointer          done_data;
@@ -239,26 +240,28 @@
 
 static void
 apply_transformation_done (const char     *uri,
-			   GnomeVFSResult  result,
+			   GError         *error,
 		           gpointer        callback_data)
 {
 	ApplyTransformData *at_data = callback_data;
 	FileData           *file = at_data->current_image->data;
+	GFile              *gfile = g_file_new_for_uri (file->path);
 		
-	if (result == GNOME_VFS_OK) {
+	if (error == NULL) {
 		if (at_data->info != NULL)
-			gnome_vfs_set_file_info (file->path, at_data->info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS | GNOME_VFS_SET_FILE_INFO_OWNER);
+			g_file_set_attributes_from_info (gfile, at_data->info, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 		notify_file_changed (at_data->data, file->path, at_data->notify_soon);
 	}
 	else 
 		_gtk_error_dialog_run (GTK_WINDOW (at_data->data->dialog), _("Could not move temporary file to remote location. Check remote permissions."));
 	
 	if (at_data->done_func)
-		(at_data->done_func) (uri, result, at_data->done_data);
+		(at_data->done_func) (uri, error, at_data->done_data);
 
 	if (at_data->info != NULL)
-		gnome_vfs_file_info_unref (at_data->info);
+		g_object_unref (at_data->info);
 	g_free (at_data);
+	g_object_unref (gfile);
 }
 
 
@@ -286,7 +289,7 @@
 
 static void
 apply_transformation__step2 (const char     *uri,
-			     GnomeVFSResult  result,
+			     GError         *error,
 		             gpointer        callback_data)
 {
 	ApplyTransformData *at_data = callback_data;
@@ -337,8 +340,10 @@
 		      CopyDoneFunc  done_func,
 		      gpointer      done_data)
 {
+        GFile              *gfile;
 	FileData           *file = current_image->data;
 	ApplyTransformData *at_data;
+        GError             *error = NULL;
 
 	at_data = g_new0 (ApplyTransformData, 1);
 	at_data->parent_window = parent_window;
@@ -347,9 +352,12 @@
 	at_data->notify_soon = notify_soon;
 	at_data->done_func = done_func;
 	at_data->done_data = done_data;
-	at_data->info = gnome_vfs_file_info_new ();
-	if (gnome_vfs_get_file_info (file->path, at_data->info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS|GNOME_VFS_FILE_INFO_FOLLOW_LINKS) != GNOME_VFS_OK) {
-		gnome_vfs_file_info_unref (at_data->info);
+
+	gfile = g_file_new_for_uri (file->path);
+	at_data->info = g_file_query_info (gfile, "owner::*,access::*", G_FILE_QUERY_INFO_NONE, NULL, &error);
+	g_object_unref (gfile);
+	if (error) {
+		g_object_unref (at_data->info);
 		at_data->info = NULL;
 	}
 
@@ -374,7 +382,7 @@
 
 static void
 apply_transformation_to_all_continue (const char     *uri,
-				      GnomeVFSResult  result,
+				      GError         *error,
 				      gpointer        data)
 {
 	BatchTransformation *bt_data = data;
@@ -472,7 +480,7 @@
 
 static void
 load_next_image_after_transformation (const char     *uri,
-				      GnomeVFSResult  result,
+				      GError         *error,
 				      gpointer        callback_data)
 {
 	DialogData *data = callback_data;

Modified: trunk/src/dlg-photo-importer.c
==============================================================================
--- trunk/src/dlg-photo-importer.c	(original)
+++ trunk/src/dlg-photo-importer.c	Thu Aug  7 14:14:47 2008
@@ -267,7 +267,7 @@
 
 static void
 async_step_done (const char     *uri,
-		 GnomeVFSResult  result,
+		 GError         *error,
                  gpointer        callback_data)
 {
 	AsyncOperationData *aodata = callback_data;

Modified: trunk/src/dlg-png-exporter.c
==============================================================================
--- trunk/src/dlg-png-exporter.c	(original)
+++ trunk/src/dlg-png-exporter.c	Thu Aug  7 14:14:47 2008
@@ -28,7 +28,6 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
 #include <glade/glade.h>
 
 #include "catalog-png-exporter.h"

Modified: trunk/src/dlg-reset-exif.c
==============================================================================
--- trunk/src/dlg-reset-exif.c	(original)
+++ trunk/src/dlg-reset-exif.c	Thu Aug  7 14:14:47 2008
@@ -1,5 +1,4 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
 /*
  *  GThumb
  *
@@ -28,6 +27,7 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <gio/gio.h>
 #include <libgnome/gnome-help.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
 #include <glade/glade.h>
@@ -89,7 +89,7 @@
 typedef struct {
 	DialogData       *data;
 	GList            *current_image;
-	GnomeVFSFileInfo *info;
+	GFileInfo        *info;
 	gboolean          notify_soon;
 	CopyDoneFunc      done_func;
 	gpointer          done_data;
@@ -113,32 +113,34 @@
 
 static void
 apply_transformation_done (const char     *uri,
-			   GnomeVFSResult  result,
+			   GError         *error,
 		           gpointer        callback_data)
 {
 	ApplyTransformData *at_data = callback_data;
 	FileData           *file = at_data->current_image->data;
+	GFile              *gfile = g_file_new_for_uri (file->path);
 		
-	if (result == GNOME_VFS_OK) {
+	if (error == NULL) {
 		if (at_data->info != NULL)
-			gnome_vfs_set_file_info (file->path, at_data->info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS | GNOME_VFS_SET_FILE_INFO_OWNER);
+			g_file_set_attributes_from_info (gfile, at_data->info, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 		notify_file_changed (at_data->data, file->path, at_data->notify_soon);
 	}
 	else 
 		_gtk_error_dialog_run (GTK_WINDOW (at_data->data->window), _("Could not move temporary file to remote location. Check remote permissions."));
 	
 	if (at_data->done_func)
-		(at_data->done_func) (uri, result, at_data->done_data);
+		(at_data->done_func) (uri, error, at_data->done_data);
 
 	if (at_data->info != NULL)
-		gnome_vfs_file_info_unref (at_data->info);
+		g_object_unref (at_data->info);
 	g_free (at_data);
+	g_object_unref (gfile);
 }
 
 
 static void
 apply_transformation__step2 (const char     *uri,
-			     GnomeVFSResult  result,
+			     GError         *error,
 		             gpointer        callback_data)
 {
 	ApplyTransformData *at_data = callback_data;
@@ -160,6 +162,8 @@
 		      CopyDoneFunc  done_func,
 		      gpointer      done_data)
 {
+	GFile              *gfile;
+	GError             *error = NULL;
 	FileData           *file = current_image->data;
 	ApplyTransformData *at_data;
 
@@ -169,9 +173,11 @@
 	at_data->notify_soon = notify_soon;
 	at_data->done_func = done_func;
 	at_data->done_data = done_data;
-	at_data->info = gnome_vfs_file_info_new ();
-	if (gnome_vfs_get_file_info (file->path, at_data->info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS|GNOME_VFS_FILE_INFO_FOLLOW_LINKS) != GNOME_VFS_OK) {
-		gnome_vfs_file_info_unref (at_data->info);
+	gfile = g_file_new_for_uri (file->path);
+	at_data->info = g_file_query_info (gfile, "owner::*,access::*", G_FILE_QUERY_INFO_NONE, NULL, &error);
+	g_object_unref (gfile);
+	if (error) {
+		g_object_unref (at_data->info);
 		at_data->info = NULL;
 	}
 
@@ -196,7 +202,7 @@
 
 static void
 apply_transformation_to_all_continue (const char     *uri,
-				      GnomeVFSResult result,
+				      GError         *error,
 				      gpointer       data)
 {
 	BatchTransformation *bt_data = data;

Modified: trunk/src/gth-batch-op.c
==============================================================================
--- trunk/src/gth-batch-op.c	(original)
+++ trunk/src/gth-batch-op.c	Thu Aug  7 14:14:47 2008
@@ -434,13 +434,13 @@
 
 static void
 save_image_and_remove_original_step2 (const char     *uri, 
-				      GnomeVFSResult  result,
+				      GError         *error,
 				      gpointer        callback_data)
 {
 	GthBatchOp *bop = callback_data;
 	FileData   *fd;
 	
-	if (result == GNOME_VFS_OK)
+	if (error == NULL)
 		PD(bop)->saved_list = g_list_prepend (PD(bop)->saved_list, g_strdup (PD(bop)->new_path));
 	 
 	fd = PD(bop)->current_image->data;

Modified: trunk/src/gth-browser-actions-callbacks.c
==============================================================================
--- trunk/src/gth-browser-actions-callbacks.c	(original)
+++ trunk/src/gth-browser-actions-callbacks.c	Thu Aug  7 14:14:47 2008
@@ -509,7 +509,7 @@
 				       _("The name \"%s\" is already used. " "Please use a different name."), utf8_name);
 		g_free (utf8_name);
 	} 
-	else if (file_rename (catalog_path, new_catalog_path) == GNOME_VFS_OK) {
+	else if (file_rename (catalog_path, new_catalog_path, NULL)) {
 		all_windows_notify_catalog_rename (catalog_path,
 						   new_catalog_path);
 	} 
@@ -1027,18 +1027,18 @@
 	} 
 	else {
 		char           *old_folder_comment;
-		GnomeVFSResult  result;
+		gboolean        result;
 
 		old_folder_comment = comments_get_comment_filename (old_path, TRUE);
 
-		result = file_rename (old_path, new_path);
-		if (result == GNOME_VFS_OK) {
+		result = file_rename (old_path, new_path, NULL);
+		if (result) {
 			char *new_folder_comment;
 
 			/* Comment cache. */
 
 			new_folder_comment = comments_get_comment_filename (new_path, TRUE);
-			file_rename (old_folder_comment, new_folder_comment);
+			file_rename (old_folder_comment, new_folder_comment, NULL);
 			g_free (new_folder_comment);
 
 			all_windows_notify_directory_rename (old_path, new_path);
@@ -1335,21 +1335,21 @@
 	} 
 	else {
 		char           *old_folder_comment = NULL;
-		GnomeVFSResult  result;
+		gboolean        result;
 
 		/* Comment cache. */
 
 		old_folder_comment = comments_get_comment_filename (old_path, TRUE);
 
-		result = file_rename (old_path, new_path);
-		if (result == GNOME_VFS_OK) {
+		result = file_rename (old_path, new_path, NULL);
+		if (result) {
 			char *new_folder_comment;
 
 			/* moving folders on the same file system can be
 			 * implemeted with rename, which is faster. */
 
 			new_folder_comment = comments_get_comment_filename (new_path, TRUE);
-			file_rename (old_folder_comment, new_folder_comment);
+			file_rename (old_folder_comment, new_folder_comment, NULL);
 			g_free (new_folder_comment);
 
 			all_windows_notify_directory_rename (old_path, new_path);

Modified: trunk/src/gth-browser.c
==============================================================================
--- trunk/src/gth-browser.c	(original)
+++ trunk/src/gth-browser.c	Thu Aug  7 14:14:47 2008
@@ -2136,7 +2136,7 @@
 			return TRUE;
 
 		utf8_name = gth_dir_list_get_name_from_iter (browser->priv->dir_list, &iter);
-		name = gnome_vfs_escape_string (utf8_name);
+		name = g_uri_escape_string (utf8_name, "", TRUE);
 		g_free (utf8_name);
 
 		if (strcmp (name, "..") == 0) {
@@ -2267,7 +2267,7 @@
 		char             *name;
 
 		utf8_name = gth_dir_list_get_name_from_iter (priv->dir_list, &iter);
-		name = gnome_vfs_escape_string (utf8_name);
+		name = g_uri_escape_string (utf8_name, "", TRUE);
 		g_free (utf8_name);
 
 		if (strcmp (name, "..") == 0) {
@@ -2542,7 +2542,7 @@
 		char             *name;
 
 		utf8_name = catalog_list_get_name_from_iter (priv->catalog_list, &iter);
-		name = gnome_vfs_escape_string (utf8_name);
+		name = g_uri_escape_string (utf8_name, "", TRUE);
 		g_free (utf8_name);
 
 		if (strcmp (name, "..") == 0) {
@@ -3242,7 +3242,7 @@
 				return FALSE;
 
 			utf8_name = catalog_list_get_name_from_iter (priv->catalog_list, &iter);
-			name = gnome_vfs_escape_string (utf8_name);
+			name = g_uri_escape_string (utf8_name, "", TRUE);
 			g_free (utf8_name);
 
 			if (strcmp (name, "..") == 0)
@@ -3278,7 +3278,7 @@
 				return FALSE;
 
 			utf8_name = gth_dir_list_get_name_from_iter (priv->dir_list, &iter);
-			name = gnome_vfs_escape_string (utf8_name);
+			name = g_uri_escape_string (utf8_name, "", TRUE);
 			g_free (utf8_name);
 
 			if (strcmp (name, "..") == 0)
@@ -3496,7 +3496,7 @@
 	catalog_name_utf8 = g_strconcat (_("Dragged Images"),
 					 CATALOG_EXT,
 					 NULL);
-	catalog_name = gnome_vfs_escape_string (catalog_name_utf8);
+	catalog_name = g_uri_escape_string (catalog_name_utf8, "", TRUE);
 	catalog_path = get_catalog_full_path (catalog_name);
 	g_free (catalog_name);
 	g_free (catalog_name_utf8);

Modified: trunk/src/gth-window-actions-callbacks.c
==============================================================================
--- trunk/src/gth-window-actions-callbacks.c	(original)
+++ trunk/src/gth-window-actions-callbacks.c	Thu Aug  7 14:14:47 2008
@@ -627,15 +627,15 @@
 
 static void 
 set_wallpaper_step_2 (const char     *uri, 
-		      GnomeVFSResult  result, 
+		      GError         *error, 
 		      gpointer        callback_data)
 {
 	SetWallpaperData *data = callback_data;
 	GConfClient      *client;
 	char             *options = "none";
 
-	if (result != GNOME_VFS_OK) {
-		_gtk_error_dialog_run (GTK_WINDOW (data->window), "%s", gnome_vfs_result_to_string (result));
+	if (error) {
+		_gtk_error_dialog_run (GTK_WINDOW (data->window), "%s", error->message);
 		g_free (data);
 		return;
 	}

Modified: trunk/src/rotation-utils.c
==============================================================================
--- trunk/src/rotation-utils.c	(original)
+++ trunk/src/rotation-utils.c	Thu Aug  7 14:14:47 2008
@@ -25,9 +25,7 @@
 #include <sys/types.h>
 
 #include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
 #include "file-utils.h"
 #include "gconf-utils.h"
 #include "gtk-utils.h"
@@ -148,7 +146,8 @@
 	char             *tmp_output_file = NULL;
 	JXFORM_CODE       transf;
 	char		 *local_file;
-	GnomeVFSFileInfo *info = NULL;
+	GFile            *gfile;
+	GFileInfo        *info;
 
 	if (file == NULL)
 		return FALSE;
@@ -170,9 +169,9 @@
 		result = FALSE;
 		goto apply_transformation_jpeg__free_and_close;
 	}
-
-	info = gnome_vfs_file_info_new ();
-	gnome_vfs_get_file_info (file->path, info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS | GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+	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);
 
 	switch (transform) {
 	case GTH_TRANSFORM_NONE:
@@ -221,8 +220,10 @@
 		char *local_uri;
 		
 		local_uri = get_uri_from_local_path (local_file);
-		gnome_vfs_set_file_info (local_uri, info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS | GNOME_VFS_SET_FILE_INFO_OWNER);
-		gnome_vfs_file_info_unref (info);
+		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);
 	}
 



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