f-spot r4689 - trunk/src/Core
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4689 - trunk/src/Core
- Date: Wed, 7 Jan 2009 12:52:48 +0000 (UTC)
Author: sdelcroix
Date: Wed Jan 7 12:52:48 2009
New Revision: 4689
URL: http://svn.gnome.org/viewvc/f-spot?rev=4689&view=rev
Log:
un-Gnome-ifying Photo.cs
Modified:
trunk/src/Core/Photo.cs
Modified: trunk/src/Core/Photo.cs
==============================================================================
--- trunk/src/Core/Photo.cs (original)
+++ trunk/src/Core/Photo.cs Wed Jan 7 12:52:48 2009
@@ -392,11 +392,14 @@
System.Uri uri = VersionUri (version_id);
if (!keep_file) {
- if ((new Gnome.Vfs.Uri (uri.ToString ())).Exists) {
- if ((new Gnome.Vfs.Uri (uri.ToString ()).Unlink()) != Gnome.Vfs.Result.Ok)
- throw new System.UnauthorizedAccessException();
- }
-
+ GLib.File file = GLib.FileFactory.NewForUri (uri);
+ if (file.Exists)
+ try {
+ file.Trash (null);
+ } catch (GLib.GException) {
+ Log.Debug ("Unable to Trash, trying to Delete");
+ file.Delete ();
+ }
try {
ThumbnailFactory.DeleteThumbnail (uri);
} catch {
@@ -435,15 +438,13 @@
throw new Exception ("This version name already exists");
if (create) {
- if ((new Gnome.Vfs.Uri (new_uri.ToString ())).Exists)
+ GLib.File destination = GLib.FileFactory.NewForUri (new_uri);
+ if (destination.Exists)
throw new Exception (String.Format ("An object at this uri {0} already exists", new_uri.ToString ()));
- Gnome.Vfs.Xfer.XferUri (
- new Gnome.Vfs.Uri (original_uri.ToString ()),
- new Gnome.Vfs.Uri (new_uri.ToString ()),
- Gnome.Vfs.XferOptions.Default, Gnome.Vfs.XferErrorMode.Abort,
- Gnome.Vfs.XferOverwriteMode.Abort,
- delegate (Gnome.Vfs.XferProgressInfo info) {return 1;});
+ //FIXME. or better, fix the copy api !
+ GLib.File source = GLib.FileFactory.NewForUri (original_uri);
+ source.Copy (destination, GLib.FileCopyFlags.None, null, null);
FSpot.ThumbnailGenerator.Create (new_uri).Dispose ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]