cvsimport
[beagle.git] / search / Tiles / RSSFeed.cs
blobc953779e60d57fa238788f403d78026a19d0f79b
1 using System;
2 using System.IO;
3 using System.Diagnostics;
4 using System.Collections;
5 using Mono.Unix;
7 namespace Search.Tiles {
9 public class RSSFeedActivator : TileActivator {
11 public RSSFeedActivator () : base ()
13 AddSupportedFlavor (new HitFlavor (null, "FeedItem", null));
16 public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
18 return new RSSFeed (hit, query);
22 public class RSSFeed : TileTemplate {
24 public RSSFeed (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
26 Group = TileGroup.Feed;
28 Title = Hit ["dc:title"];
29 Description = Hit ["dc:publisher"];
32 protected override void LoadIcon (Gtk.Image image, int size)
34 string path = Hit ["fixme:cachedimg"];
35 if (path != null && File.Exists (path)) {
36 image.Pixbuf = new Gdk.Pixbuf (path);
38 if (image.Pixbuf.Width > size || image.Pixbuf.Height > size)
39 image.Pixbuf = image.Pixbuf.ScaleSimple (size, size, Gdk.InterpType.Bilinear);
40 } else
41 image.Pixbuf = WidgetFu.LoadThemeIcon ("gnome-fs-bookmark", size); // FIXME: RSS icon?
44 protected override DetailsPane GetDetails ()
46 DetailsPane details = new DetailsPane ();
48 details.AddLabelPair (Catalog.GetString ("Title:"), Hit ["dc:title"]);
49 details.AddLabelPair (Catalog.GetString ("Site:"), Hit ["dc:identifier"]);
50 details.AddLabelPair (Catalog.GetString ("Date Viewed:"), Utils.NiceLongDate (Timestamp));
51 details.AddSnippet ();
53 return details;
56 public override void Open ()
58 base.OpenFromUri (Hit ["dc:identifier"]);