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

« back to all changes in this revision

Viewing changes to Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.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 System.Runtime.InteropServices;
 
4
using Mono.Unix;
 
5
 
 
6
using Gtk;
 
7
 
 
8
using Tomboy;
 
9
 
 
10
namespace Tomboy.PrintNotes
 
11
{
 
12
        public class PrintNotesNoteAddin : NoteAddin
 
13
        {
 
14
                Gtk.ImageMenuItem item;
 
15
 
 
16
                public override void Initialize ()
 
17
                {
 
18
                        item = new Gtk.ImageMenuItem (Catalog.GetString ("Print"));
 
19
                        item.Image = new Gtk.Image (Gtk.Stock.Print, Gtk.IconSize.Menu);
 
20
                        item.Activated += PrintButtonClicked;
 
21
                        item.Show ();
 
22
                        AddPluginMenuItem (item);
 
23
                }
 
24
 
 
25
                public override void Shutdown ()
 
26
                {
 
27
                        // Disconnect the event handlers so
 
28
                        // there aren't any memory leaks.
 
29
                        item.Activated -= PrintButtonClicked;
 
30
                }
 
31
 
 
32
                public override void OnNoteOpened () 
 
33
                {
 
34
                        // Do nothing.
 
35
                }
 
36
 
 
37
                [DllImport("libtomboy")]
 
38
                static extern void gedit_print (IntPtr text_view_handle);
 
39
 
 
40
                //
 
41
                // Handle Print menu item Click
 
42
                //
 
43
 
 
44
                void PrintButtonClicked (object sender, EventArgs args)
 
45
                {
 
46
                        gedit_print (Note.Window.Editor.Handle);
 
47
                }
 
48
        }
 
49
}