Forgot to bump FSQ version. Weekend syndrome.
[beagle.git] / search / Tiles / Note.cs
blob8b64f3052fdddaae16fe49dc91e3ff90419da0fb
1 using System;
2 using System.Diagnostics;
3 using System.Runtime.InteropServices;
4 using Mono.Unix;
6 namespace Search.Tiles {
8 public class NoteActivator : TileActivator {
10 public NoteActivator () : base ()
12 AddSupportedFlavor (new HitFlavor (null, "Note", null));
15 public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
17 return new TileNote (hit, query);
21 public class TileNote : TileTemplate {
23 public TileNote (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
25 Title = Hit.GetFirstProperty ("dc:title");
28 protected override void LoadIcon (Gtk.Image image, int size)
30 image.Pixbuf = Beagle.Images.GetPixbuf ("note", size, size);
33 public override void Open ()
35 // This doesn't work very well if you have multiple
36 // terms that match. Tomboy doesn't seem to have a way
37 // to specify more than one thing to highlight.
38 string args = String.Format ("--open-note {0} --highlight-search \"{1}\"",
39 Hit.Uri, Query.QuotedText);
41 Process p = new Process ();
42 p.StartInfo.UseShellExecute = false;
43 p.StartInfo.FileName = "tomboy";
44 p.StartInfo.Arguments = args;
46 try {
47 p.Start ();
48 } catch (Exception e) {
49 Console.WriteLine ("Could not invoke Tomboy to open note: " + e);
53 protected override DetailsPane GetDetails ()
55 DetailsPane details = new DetailsPane ();
57 details.AddLabelPair (Catalog.GetString ("Title:"),
58 Title,
59 0, 1);
60 details.AddLabelPair (Catalog.GetString ("Last Edited:"),
61 Utils.NiceLongDate (Timestamp),
62 1, 1);
64 details.AddSnippet (2, 1);
66 return details;