f-spot r4662 - in trunk: . src src/Platform/Gnome



Author: sdelcroix
Date: Wed Dec 10 14:11:25 2008
New Revision: 4662
URL: http://svn.gnome.org/viewvc/f-spot?rev=4662&view=rev

Log:
a bit more of gio

2008-12-10  Stephane Delcroix  <sdelcroix novell com>

	* Platform/Gnome/ThumbnailFactory.cs: replace Gnome.Vfs calls by Gio
	equivalents.

Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am
   trunk/src/Platform/Gnome/ThumbnailFactory.cs

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed Dec 10 14:11:25 2008
@@ -323,10 +323,12 @@
 	-r:FSpot.Utils.dll
 
 GNOME_PLATFORM_ASSEMBLIES =			\
+	$(LINK_GIO)				\
 	-pkg:gnome-sharp-2.0			\
 	-pkg:gtk-sharp-2.0			\
 	-pkg:gconf-sharp-2.0			\
 	$(LINK_DBUS)				\
+	-r:Mono.Posix				\
 	-r:FSpot.Utils.dll
 
 NULL_PLATFORM_ASSEMBLIES =			\

Modified: trunk/src/Platform/Gnome/ThumbnailFactory.cs
==============================================================================
--- trunk/src/Platform/Gnome/ThumbnailFactory.cs	(original)
+++ trunk/src/Platform/Gnome/ThumbnailFactory.cs	Wed Dec 10 14:11:25 2008
@@ -26,8 +26,10 @@
 			if (imageUri == null)
 				throw new ArgumentNullException ("imageUri");
 
-			Gnome.Vfs.FileInfo vfs = new Gnome.Vfs.FileInfo (imageUri.ToString ());
-			DateTime mtime = vfs.Mtime;
+			GLib.File gfile = GLib.FileFactory.NewForUri (imageUri);
+			GLib.FileInfo info = gfile.QueryInfo ("time::modified", GLib.FileQueryInfoFlags.None, null);
+			DateTime mtime = Mono.Unix.Native.NativeConvert.ToDateTime ((long)info.GetAttributeULong ("time::modified"));
+
 			SaveThumbnail (pixbuf, imageUri, mtime);
 		}
 
@@ -68,8 +70,9 @@
 				throw new ArgumentNullException ("imageUri");
 
 			try {
-				Gnome.Vfs.FileInfo vfs = new Gnome.Vfs.FileInfo (imageUri.ToString ());
-				DateTime mtime = vfs.Mtime;
+				GLib.File gfile = GLib.FileFactory.NewForUri (imageUri);
+				GLib.FileInfo info = gfile.QueryInfo ("time::modified", GLib.FileQueryInfoFlags.None, null);
+				DateTime mtime = Mono.Unix.Native.NativeConvert.ToDateTime ((long)info.GetAttributeULong ("time::modified"));
 				return ThumbnailIsValid (pixbuf, imageUri, mtime);
 			} catch (System.IO.FileNotFoundException) {
 				// If the original file is not on disk, the thumbnail is as valid as it's going to get
@@ -133,6 +136,9 @@
 			if (!imageUri.IsFile)
 				Log.Debug ("FIXME: compute timestamp on non file uri too");
 
+			if (!System.IO.File.Exists (imageUri.AbsolutePath))
+				return true;
+
 			return imageUri.IsFile && System.IO.File.Exists (PathForUri (imageUri)) && System.IO.File.GetLastWriteTime (PathForUri (imageUri)) >= System.IO.File.GetLastWriteTime (imageUri.AbsolutePath);
 		}
 



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