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

« back to all changes in this revision

Viewing changes to Tomboy/Addins/FixedWidth/FixedWidthNoteAddin.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
// Add a 'fixed width' item to the font styles menu.
 
2
// (C) 2006 Ryan Lortie <desrt@desrt.ca>, LGPL 2.1 or later.
 
3
// vim:set sw=8 noet:
 
4
 
 
5
using Mono.Unix;
 
6
using System;
 
7
using Gtk;
 
8
 
 
9
using Tomboy;
 
10
 
 
11
namespace Tomboy.FixedWidth
 
12
{
 
13
        public class FixedWidthNoteAddin : NoteAddin
 
14
        {
 
15
                TextTag tag;
 
16
 
 
17
                public override void Initialize ()
 
18
                {
 
19
                        // If a tag of this name already exists, don't install.
 
20
                        if (Note.TagTable.Lookup ("monospace") == null) {
 
21
                                tag = new FixedWidthTag ();
 
22
                                Note.TagTable.Add (tag);
 
23
                        }
 
24
                }
 
25
 
 
26
                public override void Shutdown ()
 
27
                {
 
28
                        // Remove the tag only if we installed it.
 
29
                        if (tag != null)
 
30
                                Note.TagTable.Remove (tag);
 
31
                }
 
32
 
 
33
                public override void OnNoteOpened () 
 
34
                {
 
35
                        // Add here instead of in Initialize to avoid creating unopened
 
36
                        // notes' windows/buffers.
 
37
                        AddTextMenuItem (new FixedWidthMenuItem (this));
 
38
                }
 
39
        }
 
40
}