3
using System.Diagnostics;
4
using System.Collections;
8
namespace Search.Tiles {
10
public class RSSFeedActivator : TileActivator {
12
public RSSFeedActivator () : base ()
14
AddSupportedFlavor (new HitFlavor (null, "FeedItem", null));
17
public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
19
return new RSSFeed (hit, query);
23
public class RSSFeed : TileTemplate {
25
public RSSFeed (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
27
Group = TileGroup.Feed;
29
Title = Hit ["dc:title"];
30
Description = Hit ["dc:publisher"];
33
protected override void LoadIcon (Gtk.Image image, int size)
35
Gdk.Pixbuf pixbuf = null;
37
string path = Hit ["fixme:cachedimg"];
38
if (path != null && File.Exists (path)) {
40
pixbuf = new Gdk.Pixbuf (path);
41
} catch (GLib.GException) {
42
// Catch in case of an invalid pixbuf.
46
if (pixbuf != null && (pixbuf.Width > size || pixbuf.Height > size))
47
pixbuf = pixbuf.ScaleSimple (size, size, Gdk.InterpType.Bilinear);
50
pixbuf = WidgetFu.LoadThemeIcon ("gnome-fs-bookmark", size); // FIXME: RSS icon?
52
image.Pixbuf = pixbuf;
55
protected override DetailsPane GetDetails ()
57
DetailsPane details = new DetailsPane ();
59
details.AddLabelPair (Catalog.GetString ("Title:"), Hit ["dc:title"]);
60
details.AddLabelPair (Catalog.GetString ("Site:"), Hit ["dc:identifier"]);
61
details.AddLabelPair (Catalog.GetString ("Date Viewed:"), Utils.NiceLongDate (Timestamp));
62
details.AddSnippet ();
67
public override void Open ()
69
// If we are not a feed from Thunderbird just open based on mime
70
if (Hit.GetFirstProperty ("fixme:client") != "thunderbird") {
71
base.OpenFromUri (Hit ["dc:identifier"]);
75
#if ENABLE_THUNDERBIRD
76
// Here's the Thunderbird specific part
77
SafeProcess p = Thunderbird.GetSafeProcess ("-viewbeagle", Hit.GetFirstProperty ("fixme:uri"));
81
} catch (SafeProcessException e) {
82
Console.WriteLine ("Unable to run {0}: {1}", p.Arguments [0], e.Message);