2 using System
.Diagnostics
;
3 using System
.Runtime
.InteropServices
;
7 namespace Search
.Tiles
{
9 public class NoteActivator
: TileActivator
{
11 public NoteActivator () : base ()
13 AddSupportedFlavor (new HitFlavor (null, "Note", null));
16 public override Tile
BuildTile (Beagle
.Hit hit
, Beagle
.Query query
)
18 return new TileNote (hit
, query
);
22 public class TileNote
: TileTemplate
{
24 public TileNote (Beagle
.Hit hit
, Beagle
.Query query
) : base (hit
, query
)
26 Title
= Hit
.GetFirstProperty ("dc:title");
29 protected override void LoadIcon (Gtk
.Image image
, int size
)
31 image
.Pixbuf
= Beagle
.Images
.GetPixbuf ("note", size
, size
);
34 public override void Open ()
36 SafeProcess p
= new SafeProcess ();
38 // This doesn't work very well if you have multiple
39 // terms that match. Tomboy doesn't seem to have a way
40 // to specify more than one thing to highlight.
41 p
.Arguments
= new string [] { "tomboy",
42 "--open-note", Hit
.UriAsString
,
43 "--highlight-search", Query
.QuotedText
};
47 } catch (Exception e
) {
48 Console
.WriteLine ("Could not invoke Tomboy to open note: " + e
);
52 protected override DetailsPane
GetDetails ()
54 DetailsPane details
= new DetailsPane ();
56 details
.AddLabelPair (Catalog
.GetString ("Title:"),
59 details
.AddLabelPair (Catalog
.GetString ("Last Edited:"),
60 Utils
.NiceLongDate (Timestamp
),
63 details
.AddSnippet (2, 1);