Change the GC.GetTotalMemory() threshold to 10%; otherwise there are just too many...
[beagle.git] / search / Tiles / Folder.cs
blob86f149a82c8aca8643fabe4be61c300fa5a7aef8
1 using System;
2 using Mono.Unix;
4 namespace Search.Tiles {
6 public class FolderActivator : TileActivator {
8 public FolderActivator () : base ()
10 AddSupportedFlavor (new HitFlavor (null, null, "inode/directory"));
11 AddSupportedFlavor (new HitFlavor (null, null, "x-directory/normal"));
14 public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
16 return new Folder (hit, query);
20 public class Folder : TileTemplate {
22 public Folder (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
24 Group = TileGroup.Folder;
25 Title = Hit ["beagle:ExactFilename"];
26 EnableOpenWith = true;
28 int n = Hit.DirectoryInfo.GetFileSystemInfos ().Length;
30 if (n == 0)
31 Description = Catalog.GetString ("Empty");
32 else
33 Description = String.Format (Catalog.GetPluralString ("Contains {0} Item",
34 "Contains {0} Items", n), n);
36 // FIXME: s/"gtk-info"/Gtk.Stock.Info/ when we can depend on gtk# 2.8
37 //AddAction (new TileAction (Catalog.GetString ("Show Information"), "gtk-info", ShowInformation));
38 AddAction (new TileAction (Catalog.GetString ("Move to Trash"), Gtk.Stock.Delete, MoveToTrash));
41 protected override void LoadIcon (Gtk.Image image, int size)
43 image.Pixbuf = WidgetFu.LoadThemeIcon ("gnome-fs-directory", size);
46 protected override DetailsPane GetDetails ()
48 DetailsPane details = new DetailsPane ();
50 details.AddTitleLabel (Title);
51 details.AddLabelPair (Catalog.GetString ("Last Edited:"), Utils.NiceLongDate (Hit.DirectoryInfo.LastWriteTimeUtc));
52 details.AddLabelPair (Catalog.GetString ("Full Path:"), Hit.Uri.LocalPath);
53 details.AddTextLabel (Description);
55 return details;
58 public override void Open ()
60 base.OpenFromMime (Hit);
63 public void MoveToTrash ()
65 // FIXME: Ask for confirmation
67 try {
68 // FIXME: Check if KDE uses ~/.Trash too
69 string trash_name = System.IO.Path.Combine (".Trash", Hit.DirectoryInfo.Name);
70 Hit.DirectoryInfo.MoveTo (System.IO.Path.Combine (Beagle.Util.PathFinder.HomeDir, trash_name));
71 } catch (Exception e) {
72 Console.WriteLine (e);