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 ();
49 details
.AddBoldLabel (Title
, i
++, 1);
51 string org
= Hit
.GetFirstProperty ("fixme:Org");
52 string title
= Hit
.GetFirstProperty ("fixme:Title");
53 string email
= Hit
.GetFirstProperty ("fixme:Email");
54 string mobile_phone
= Hit
.GetFirstProperty ("fixme:MobilePhone");
55 string work_phone
= Hit
.GetFirstProperty ("fixme:BusinessPhone");
56 string home_phone
= Hit
.GetFirstProperty ("fixme:HomePhone");
58 if (org
!= null && org
!= "")
59 details
.AddLabel (org
, i
++, 1);
60 if (title
!= null && title
!= "")
61 details
.AddLabel (title
, i
++, 1);
63 details
.AddLabel ("", i
++, 1);
65 if (email
!= null && email
!= "")
66 details
.AddLabelPair (Catalog
.GetString ("E-Mail:"), email
, i
++, 1);
67 if (mobile_phone
!= null && mobile_phone
!= "")
68 details
.AddLabelPair (Catalog
.GetString ("Mobile Phone:"), mobile_phone
, i
++, 1);
69 if (work_phone
!= null && work_phone
!= "")
70 details
.AddLabelPair (Catalog
.GetString ("Work Phone:"), work_phone
, i
++, 1);
71 if (home_phone
!= null && home_phone
!= "")
72 details
.AddLabelPair (Catalog
.GetString ("Home Phone:"), home_phone
, i
++, 1);