~ted/ubuntu/lucid/tomboy/with-patch

« back to all changes in this revision

Viewing changes to Tomboy/Addins/Bugzilla/BugzillaLink.cs

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-01-15 11:32:52 UTC
  • mfrom: (1.1.31 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080115113252-p59wg7nqkl6vcg7a
Tags: 0.9.4-0ubuntu1
* New upstream release (LP: #181798)
  - Fix crash during note deletion 
  - Fix null reference exception 
  - Fix mnemonics in sync preferences dialog 
  - Fix fuse mount timeout for sync 
  - New port option for SSH sync 
  - New multi-select notes support in Search All Notes window
  - New config dialog for Insert Timestamp Add-in 
  - New gconf preference, middle-click paste on Tomboy icon
  - New gconf preference, disable ESC closing notes 
  - New paragraph within a bullet with SHIFT + ENTER
  - New bug numbers as links in Export to HTML 
  - New notebook notes can be created off notebook's context menu.
  - New sketching add-in (still incomplete, --enable-sketching)
  - New "Unfiled Notes" item to notebook list 
  - New drag note to "Unfiled Notes" to remove from notebook 
 * debian/tomboy.menu: updated

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
{
6
6
        public class BugzillaLink : DynamicNoteTag
7
7
        {
8
 
                Gdk.Pixbuf Icon;
9
 
 
10
 
                public BugzillaLink ()
11
 
                        : base ()
12
 
                {
13
 
                        Image = new Gdk.Pixbuf(null, "stock_bug.png");
14
 
                }
 
8
                private const string UriAttributeName = "uri";
 
9
                private const string StockIconFilename = "stock_bug.png";
15
10
 
16
11
                public override void Initialize (string element_name)
17
12
                {
27
22
 
28
23
                public string BugUrl
29
24
                {
30
 
                        get { return (string) Attributes ["uri"]; }
31
 
                        set { Attributes ["uri"] = value; }
 
25
                        get {
 
26
                                return (string) Attributes [UriAttributeName];
 
27
                        }
 
28
                        set {
 
29
                                Attributes [UriAttributeName] = value;
 
30
                                SetImage ();
 
31
                        }
 
32
                }
 
33
 
 
34
                private void SetImage()
 
35
                {
 
36
                        System.Uri uri = null;
 
37
                        try {
 
38
                                uri = new System.Uri(BugUrl);
 
39
                        } catch {}
 
40
 
 
41
                        if (uri == null) {
 
42
                                        Image = new Gdk.Pixbuf(null, StockIconFilename);
 
43
                                        return;
 
44
                                }
 
45
 
 
46
                        string host = uri.Host;
 
47
                        // TODO: Get this in a safer way
 
48
                        string imageDir = "~/.tomboy/BugzillaIcons/";
 
49
                        string imagePath = imageDir.Replace ("~", Environment.GetEnvironmentVariable ("HOME")) + host + ".png";
 
50
 
 
51
                        try {
 
52
                                Image = new Gdk.Pixbuf (imagePath);
 
53
                        } catch (GLib.GException) {
 
54
                                Image = new Gdk.Pixbuf(null, StockIconFilename);
 
55
                        }
32
56
                }
33
57
 
34
58
                protected override bool OnActivate (NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end)
40
64
                        return true;
41
65
                }
42
66
 
 
67
                protected override void OnAttributeRead (string attributeName)
 
68
                {
 
69
                        base.OnAttributeRead (attributeName);
 
70
 
 
71
                        if (attributeName == UriAttributeName)
 
72
                                SetImage ();
 
73
                }
 
74
 
43
75
        }
44
76
}