4
// Copyright (C) 2007 Lukas Lipka <lukaslipka@gmail.com>
12
namespace Search.Tiles {
14
public class ManpageActivator : TileActivator {
16
public ManpageActivator () : base ()
18
AddSupportedFlavor (new HitFlavor (null, "File", null));
21
public override bool Validate (Beagle.Hit hit)
23
if (! base.Validate (hit))
26
if (hit ["beagle:FileType"] != "documentation")
34
public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
36
return new Manpage (hit, query);
40
public class Manpage : TileTemplate {
44
public Manpage (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
46
if (! String.IsNullOrEmpty (hit.GetFirstProperty ("dc:title")))
47
Title = hit.GetFirstProperty ("dc:title");
49
Title = hit.GetFirstProperty ("beagle:ExactFilename");
51
if (hit ["beagle:IsChild"] == "true")
52
path = hit.ParentUri.LocalPath;
54
path = hit.Uri.LocalPath;
56
Description = hit.GetFirstProperty ("dc:subject") ?? Catalog.GetString ("Manual page");
59
protected override void LoadIcon (Gtk.Image image, int size)
61
image.Pixbuf = WidgetFu.LoadThemeIcon ("gtk-help", size);
64
public override void Open ()
66
SafeProcess p = new SafeProcess ();
67
p.Arguments = new string [] { "yelp", path };
72
Console.WriteLine ("Failed to start '{0}'", p.Arguments [0]);