~ubuntu-branches/ubuntu/jaunty/beagle/jaunty-security

« back to all changes in this revision

Viewing changes to search/Beagle.Search.Tiles/Task.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-04 00:31:32 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20080504003132-2tkm5o8moo5952ri
Tags: 0.3.7-2ubuntu1
 * Merge from Debian unstable. (LP: #225746) Remaining Ubuntu changes:
  - debian/control:
    + Rename ice{weasel,dove}-beagle to {mozilla,thunderbird}-beagle and
      and update the dependencies accordingly.
    + Change Maintainer to Ubuntu Mono Team.
  - debian/rules:
    + Install the mozilla-beagle and thunderbird-beagle extensions.
  - ice{dove,weasel}.dirs:
    + Renamed to {mozilla,thunderbird}-beagle.dirs.
    + Fixed paths to point to usr/lib/{firefox,thunderbird}

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using Mono.Unix;
 
3
using Beagle.Util;
 
4
 
 
5
namespace Beagle.Search.Tiles {
 
6
 
 
7
        public class TaskActivator : TileActivator {
 
8
 
 
9
                public TaskActivator () : base ()
 
10
                {
 
11
                        AddSupportedFlavor (new HitFlavor (null, "Task", null));
 
12
                }
 
13
 
 
14
                public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
 
15
                {
 
16
                        return new Task (hit, query);
 
17
                }
 
18
        }
 
19
 
 
20
        public class Task : TileTemplate {
 
21
 
 
22
                public Task (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
 
23
                {
 
24
                        Group = TileGroup.Calendar;
 
25
 
 
26
                        Title = hit.GetFirstProperty ("fixme:summary");
 
27
 
 
28
                        if (!String.IsNullOrEmpty (hit.GetFirstProperty ("fixme:description")))
 
29
                                Description = Utils.TrimFirstLine (hit.GetFirstProperty ("fixme:description"));
 
30
                }
 
31
 
 
32
                protected override void LoadIcon (Gtk.Image image, int size)
 
33
                {
 
34
                        image.Pixbuf = WidgetFu.LoadThemeIcon ("stock_todo", size);
 
35
                }
 
36
 
 
37
                protected override DetailsPane GetDetails ()
 
38
                {
 
39
                        DetailsPane details = new DetailsPane ();
 
40
 
 
41
                        details.AddLabelPair (Catalog.GetString ("Title:"), Title);
 
42
 
 
43
                        if (!String.IsNullOrEmpty (Description))
 
44
                                details.AddLabelPair (Catalog.GetString ("Description:"), Description);
 
45
                        
 
46
                        if (!String.IsNullOrEmpty (Hit.GetFirstProperty ("fixme:starttime")))
 
47
                                details.AddLabelPair (Catalog.GetString ("Date:"), Utils.NiceShortDate (Hit.GetFirstProperty ("fixme:starttime")));
 
48
                        
 
49
                        return details;
 
50
                }
 
51
 
 
52
                public override void Open ()
 
53
                {
 
54
                        SafeProcess p = new SafeProcess ();
 
55
                        p.Arguments = new string [] { "evolution", Hit.EscapedUri };
 
56
 
 
57
                        try {
 
58
                                p.Start ();
 
59
                        } catch (SafeProcessException e) {
 
60
                                Console.WriteLine (e.Message);
 
61
                        }
 
62
                }
 
63
        }
 
64
}