*** ImageFile.cs	2006-07-09 17:29:49.734356500 +0200
--- ImageFile.cs.hack	2006-07-09 17:25:59.407962000 +0200
*************** namespace FSpot {
*** 11,16 ****
--- 11,17 ----
  	public class ImageFile {
  		protected Uri uri;
  
+ 		static System.Collections.Hashtable mime_table;
  		static System.Collections.Hashtable name_table;
  
  		public ImageFile (string path) 
*************** namespace FSpot {
*** 62,67 ****
--- 63,74 ----
  			name_table [".mrw"] = typeof (FSpot.Mrw.MrwFile);
  			name_table [".raf"] = typeof (FSpot.Raf.RafFile);
  			name_table [".x3f"] = typeof (FSpot.X3f.X3fFile);
+ 			
+ 			mime_table = new System.Collections.Hashtable();
+ 			mime_table ["image/gif"] = (bool)true;
+ 			mime_table ["image/jpeg"] = (bool)true;
+ 			mime_table ["image/png"] = (bool)true;
+ 			mime_table ["image/tiff"] = (bool)true;
  		}
  
  		public Uri Uri {
*************** namespace FSpot {
*** 147,152 ****
--- 154,172 ----
  			}
  		}
  
+ 		private static System.Type TypeOf (Uri uri)
+ 		{
+ 			Gnome.Vfs.Uri g_uri = new Gnome.Vfs.Uri(uri.ToString());
+ 			Gnome.Vfs.FileInfo info = new Gnome.Vfs.FileInfo(g_uri, Gnome.Vfs.FileInfoOptions.GetMimeType);
+ 			if(mime_table[info.MimeType] != null){
+ 				string path = uri.AbsolutePath;
+ 				string extension = System.IO.Path.GetExtension (path).ToLower ();
+ 				System.Type t = (System.Type) name_table [extension];
+ 				return t;
+ 			}
+ 			return (System.Type) null;
+ 		}
+ 
  		public static bool HasLoader (string path)
  		{
  			return HasLoader (UriList.PathToFileUri (path));
*************** namespace FSpot {
*** 154,162 ****
  		
  		public static bool HasLoader (Uri uri)
  		{
! 			string path = uri.AbsolutePath;
! 			string extension = System.IO.Path.GetExtension (path).ToLower ();
! 			System.Type t = (System.Type) name_table [extension];
  			
  			return (t != null);
  		}
--- 174,180 ----
  		
  		public static bool HasLoader (Uri uri)
  		{
! 			System.Type t = TypeOf (uri);
  			
  			return (t != null);
  		}
*************** namespace FSpot {
*** 168,176 ****
  
  		public static ImageFile Create (Uri uri)
  		{
! 			string path = uri.AbsolutePath;
! 			string extension = System.IO.Path.GetExtension (path).ToLower ();
! 			System.Type t = (System.Type) name_table [extension];
  			ImageFile img;
  
  			if (t != null)
--- 186,192 ----
  
  		public static ImageFile Create (Uri uri)
  		{
! 			System.Type t = TypeOf (uri);
  			ImageFile img;
  
  			if (t != null)
