public static void Save(Gdk.Pixbuf image, Uri dest)
        {
            string uri = UriList.UriToStringEscaped(dest);

            System.DateTime mtime = DateTime.Now;

            // Use Gnome.Vfs
            try {
                Gnome.Vfs.FileInfo vfs = new Gnome.Vfs.FileInfo(uri);
                mtime = vfs.Mtime;

                PixbufUtils.SetOption(image, ThumbUri, uri);
                PixbufUtils.SetOption(image, ThumbMTime,
                                      ((uint)GLib.Marshaller.DateTimeTotime_t(mtime)).ToString());
            } catch (System.Exception e) {
                Console.WriteLine(e);
            }

            //System.Console.WriteLine ("saving uri \"{0}\" mtime \"{1}\"",
            //			  image.GetOption ("tEXt::Thumb::URI"),
            //			  image.GetOption ("tEXt::Thumb::MTime"));

            string large_path = ThumbnailPath(uri);

            try {
                ThumbnailCache.Default.RemoveThumbnailForPath(large_path);
            } finally {
                factory.SaveThumbnail(image, uri, mtime);
            }
        }
        public static bool ThumbnailIsValid(Gdk.Pixbuf thumbnail, System.Uri uri)
        {
            bool valid = false;

            try {
                Gnome.Vfs.FileInfo vfs   = new Gnome.Vfs.FileInfo(uri.ToString());
                DateTime           mtime = vfs.Mtime;
                valid = Gnome.Thumbnail.IsValid(thumbnail, UriList.UriToStringEscaped(uri), mtime);
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                valid = false;
            }

            return(valid);
        }
            public void UriNames(string name)
            {
                string path = CreateFile(name, 768);
                Uri    uri  = new Uri(Gnome.Vfs.Uri.GetUriFromLocalPath(path));

                string string_path = ThumbnailGenerator.ThumbnailPath(path);
                string thumb_path  = ThumbnailGenerator.ThumbnailPath(uri);

                Assert.AreEqual(thumb_path, string_path);

                ThumbnailGenerator.Create(uri);

                Assert.IsTrue(File.Exists(thumb_path), String.Format("Missing: {0} created from {1}", thumb_path, uri));
                using (Gdk.Pixbuf thumb = new Gdk.Pixbuf(thumb_path)) {
                    Assert.IsNotNull(thumb);
                    Assert.AreEqual(thumb.GetOption(ThumbUri), UriList.UriToStringEscaped(uri));
                    Assert.AreEqual(new Uri(thumb.GetOption(ThumbUri)), uri);
                    Assert.IsTrue(ThumbnailGenerator.ThumbnailIsValid(thumb, uri));
                }

                File.Delete(thumb_path);
                File.Delete(path);
            }
        public static string ThumbnailPath(System.Uri uri)
        {
            string large_path = Gnome.Thumbnail.PathForUri(UriList.UriToStringEscaped(uri), Gnome.ThumbnailSize.Large);

            return(large_path);
        }