2 using System
.Diagnostics
;
6 namespace Search
.Tiles
{
8 public class ArchivedFileActivator
: TileActivator
{
10 public ArchivedFileActivator () : base ()
12 AddSupportedFlavor (new HitFlavor (null, "File", null));
15 public override Tile
BuildTile (Beagle
.Hit hit
, Beagle
.Query query
)
17 return new TileArchivedFile (hit
, query
);
20 public override bool Validate (Beagle
.Hit hit
)
22 if (! base.Validate (hit
))
25 string str
= hit
.GetFirstProperty ("fixme:inside_archive");
26 if (hit
.ParentUri
== null || str
== null || str
== "false")
35 public class TileArchivedFile
: TileFile
{
37 public TileArchivedFile (Beagle
.Hit hit
, Beagle
.Query query
) : base (hit
, query
)
39 Description
= String
.Format (Catalog
.GetString ("Inside archive {0}"), GetTitle (hit
, true));
42 protected override void LoadIcon (Gtk
.Image image
, int size
)
44 base.LoadIcon (image
, size
);
46 string parent_mime_type
= XdgMime
.GetMimeTypeFromFileName (Hit
.EscapedParentUri
);
48 if (parent_mime_type
== null)
51 Gdk
.Pixbuf emblem
= WidgetFu
.LoadMimeIcon (parent_mime_type
, 24);
56 Gdk
.Pixbuf icon
= image
.Pixbuf
.Copy ();
58 emblem
.Composite (icon
,
60 icon
.Height
- emblem
.Height
, // dest_y
61 emblem
.Width
, // dest_width
62 emblem
.Height
, // dest_height
64 icon
.Height
- emblem
.Height
, // offset_y
66 Gdk
.InterpType
.Bilinear
, 255);
68 image
.Pixbuf
.Dispose ();
72 protected override DetailsPane
GetDetails ()
74 DetailsPane details
= new DetailsPane ();
76 details
.AddLabelPair (Catalog
.GetString ("Title:"), GetTitle (Hit
));
77 details
.AddLabelPair (Catalog
.GetString ("File Name:"), Hit
.Uri
.Fragment
.Substring (1)); // Substring to move past the initial #
78 details
.AddLabelPair (Catalog
.GetString ("Inside File:"), Hit
.Uri
.LocalPath
);
80 if (Hit
["dc:author"] != null)
81 details
.AddLabelPair (Catalog
.GetString ("Author:"), Hit
["dc:author"]);
83 details
.AddSnippet ();