Add example code to use beagle as a service provider.
[beagle.git] / search / Tiles / WebHistory.cs
blobd6fd995414bf99d0bb4cefa24f1880517dee5c18
1 using System;
2 using Mono.Unix;
4 namespace Search.Tiles {
6 public class WebHistoryActivator : TileActivator {
8 public WebHistoryActivator () : base ()
10 AddSupportedFlavor (new HitFlavor (null, "WebHistory", null));
13 public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
15 return new WebHistory (hit, query);
20 public class WebHistory : TileTemplate {
22 public WebHistory (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
24 Group = TileGroup.Website;
25 Title = hit.GetFirstProperty ("dc:title");
26 Description = hit.Uri.ToString ();
29 // We intentionally use a separate thumbnailer/thread from Tiles.File,
30 // because the web thumbnailer is much slower and we don't want it to
31 // hold up the image/document thumbnails
33 static ThumbnailFactory thumbnailer = new ThumbnailFactory ();
35 protected override void LoadIcon (Gtk.Image image, int size)
37 if (!thumbnailer.SetThumbnailIcon (image, Hit, size))
38 base.LoadIcon (image, size);
41 public override void Open ()
43 base.OpenFromMime (Hit);
46 protected override DetailsPane GetDetails ()
48 DetailsPane details = new DetailsPane ();
50 details.AddLabelPair (Catalog.GetString ("Title:"), Title);
51 details.AddLabelPair (Catalog.GetString ("URL:"), Hit.Uri.ToString ());
52 details.AddLabelPair (Catalog.GetString ("Accessed:"), Utils.NiceLongDate (Timestamp));
53 details.AddSnippet ();
55 return details;