5 namespace Search
.Tiles
{
7 public class ContactActivator
: TileActivator
{
9 public ContactActivator () : base ()
11 AddSupportedFlavor (new HitFlavor (null, "Contact", null));
14 public override Tile
BuildTile (Beagle
.Hit hit
, Beagle
.Query query
)
16 return new Contact (hit
, query
);
20 public class Contact
: TileTemplate
{
22 public Contact (Beagle
.Hit hit
, Beagle
.Query query
) : base (hit
, query
)
24 Group
= TileGroup
.Contact
;
26 Title
= hit
.GetFirstProperty ("fixme:Name");
27 Description
= hit
.GetFirstProperty ("fixme:Email");
30 private Gdk
.Pixbuf
GetIcon (int size
)
32 if (Hit
.GetFirstProperty ("beagle:Photo") != null) {
33 Gdk
.Pixbuf icon
= new Gdk
.Pixbuf (Hit
.GetFirstProperty ("beagle:Photo"));
34 return icon
.ScaleSimple (size
, size
, Gdk
.InterpType
.Bilinear
);
36 return WidgetFu
.LoadThemeIcon ("stock_person", size
);
39 protected override void LoadIcon (Gtk
.Image image
, int size
)
41 image
.Pixbuf
= GetIcon (size
);
44 protected override DetailsPane
GetDetails ()
46 DetailsPane details
= new DetailsPane ();
48 details
.AddBoldLabel (Title
, 0, 1);
49 details
.AddLabel (Hit
.GetFirstProperty ("fixme:Org"), 1, 1);
50 details
.AddLabel (Hit
.GetFirstProperty ("fixme:Title"), 2, 1);
51 details
.AddLabel ("", 3, 1);
53 details
.AddLabelPair (Catalog
.GetString ("E-Mail:"),
54 Hit
.GetFirstProperty ("fixme:Email"),
56 details
.AddLabelPair (Catalog
.GetString ("Mobile Phone:"),
57 Hit
.GetFirstProperty ("fixme:MobilePhone"),
59 if (Hit
.GetFirstProperty ("fixme:BusinessPhone") != null) {
60 details
.AddLabelPair (Catalog
.GetString ("Work Phone:"),
61 Hit
.GetFirstProperty ("fixme:BusinessPhone"),
64 details
.AddLabelPair (Catalog
.GetString ("Home Phone:"),
65 Hit
.GetFirstProperty ("fixme:HomePhone"),