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

« back to all changes in this revision

Viewing changes to Tomboy/Addins/Backlinks/BacklinkMenuItem.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2007-07-16 10:26:35 UTC
  • mfrom: (1.1.21 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20070716102635-0wzk26jo50csob7b
Tags: 0.7.2-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using System;
 
3
using Tomboy;
 
4
 
 
5
namespace Tomboy.Backlinks
 
6
{
 
7
        public class BacklinkMenuItem : Gtk.ImageMenuItem, System.IComparable
 
8
        {
 
9
                Note note;
 
10
                string title_search;
 
11
                
 
12
                static Gdk.Pixbuf note_icon;
 
13
                
 
14
                static BacklinkMenuItem ()
 
15
                {
 
16
                        note_icon = GuiUtils.GetIcon ("tomboy-note", 22);
 
17
                }
 
18
 
 
19
                public BacklinkMenuItem (Note note, string title_search) : 
 
20
                                base (note.Title)
 
21
                {
 
22
                        this.note = note;
 
23
                        this.title_search = title_search;
 
24
                        this.Image = new Gtk.Image (note_icon);
 
25
                }
 
26
                
 
27
                protected override void OnActivated ()
 
28
                {
 
29
                        if (note == null)
 
30
                                return;
 
31
                        
 
32
                        // Show the title of the note
 
33
                        // where the user just came from.
 
34
                        NoteFindBar find = note.Window.Find;
 
35
                        find.ShowAll ();
 
36
                        find.Visible = true;
 
37
                        find.SearchText = title_search;
 
38
                        
 
39
                        note.Window.Present ();
 
40
                }
 
41
                
 
42
                public Note Note
 
43
                {
 
44
                        get { return note; }
 
45
                }
 
46
                
 
47
                // IComparable interface
 
48
                public int CompareTo (object obj)
 
49
                {
 
50
                        BacklinkMenuItem other_item = obj as BacklinkMenuItem;
 
51
                        return note.Title.CompareTo (other_item.Note.Title);
 
52
                }
 
53
        }
 
54
}