Add methods and messages to retrieve specific information from beagle-info. Clients...
[beagle.git] / search / Tiles / CApplet.cs
blob7878865ac83b2418b3110f3b580bd1d95a2439c9
1 using System;
2 using System.Collections;
3 using System.Diagnostics;
4 using Mono.Posix;
6 namespace Search.Tiles {
8 public class CAppletActivator : TileActivator {
10 public CAppletActivator () : base ()
12 AddSupportedFlavor (new HitFlavor (null, null, "application/x-desktop"));
15 public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
17 return new CApplet (hit, query);
20 public override bool Validate (Beagle.Hit hit)
22 if (! base.Validate (hit))
23 return false;
25 ICollection categories = hit.GetProperties ("fixme:Categories");
27 if (categories == null || categories.Count < 1)
28 return false;
30 foreach (string cat in categories) {
31 if (cat == "Settings") {
32 Weight += 1;
33 return true;
37 return false;
41 public class CApplet : Application {
43 public CApplet (Beagle.Hit hit, Beagle.Query query) : base (hit, query) {}
45 public override void Open ()
47 Process p = new Process ();
48 p.StartInfo.UseShellExecute = true;
49 p.StartInfo.FileName = Hit ["fixme:Exec"];
51 try {
52 p.Start ();
53 } catch (Exception e) {
54 Console.WriteLine ("Unable to run {0}: {1}", p.StartInfo.FileName, e.Message);