[tomboy-list] Add-in Help
S Krupa Shankar
shankarkrupa at yahoo.com
Mon Jul 20 11:42:30 PDT 2009
Hi,
I am a new Tomboy user and a relatively new user to Mono, but am a .NET developer.
I have been trying to create a new Tomboy add-in to get started. I tried to follow http://live.gnome.org/Tomboy/HowToCreateAddins with some minimal changes.
I created a InsertMyName instead of InsertDateTime. I tried to use MonoDevelop, but I do not know what file should I add as reference to refer the Tomboy namespace which contains the NoteAddin class.
So I went ahead and compiled the file along with the resource relevant file changes. I tried version version="0.7" as well version="0.14". I tried to copy it to .tomboy/Addins directory, then tried to copy it to /usr/lib/tomboy/addins directory. I tried to copy it here since I found other plugin DLLs are residing in this directory.
Now when I open Tomboy and go to Edit->Preferences->Add-ins->Tools, I could not find the Insert My Name amongst other addin names.
The command prompt log is as follows:
[DEBUG]: AddinManager.OnAddinLoaded: Tomboy.MyNameAddIn
[DEBUG]: Name: Insert My Name
[DEBUG]: Description: Inserts your name at the cursor position.
[DEBUG]: Namespace: Tomboy
[DEBUG]: Enabled: True
[DEBUG]: File: /usr/lib/tomboy/addins/InsertMyName.dll
Does the above output mean there is no problem in loading the addin?
Please help me to compile the addin. I do not know what step I missed, please correct me.
The steps I follows and the file content are as follows:
I compiled the file as follows:
gmcs -debug -out:InsertMyName.dll -target:library -pkg:tomboy-addins -r:Mono.Posix InsertMyName.cs -resource:InsertMyName.addin.xml
InsertMyName.addin.xml content
<Addin id="MyNameAddIn"
namespace="Tomboy"
name="Insert My Name"
author="Krupa"
description="Inserts your name at the cursor position."
category="Tools"
defaultEnabled="true"
version="0.1">
<Runtime>
<Import assembly="InsertMyName.dll" />
</Runtime>
<Dependencies>
<Addin id="Tomboy" version="0.14" />
</Dependencies>
<Extension path="/Tomboy/NoteAddins">
<NoteAddin type="Tomboy.InsertMyName.InsertMyNameAddin" />
</Extension>
</Addin>
InsertMyName Content
using System;
using Gtk;
using Mono.Unix;
using Tomboy;
namespace Tomboy.InsertMyName
{
public class InsertMyNameAddin:NoteAddin
{
Gtk.MenuItem item;
public InsertMyNameAddin()
{
}
public override void Initialize ()
{
item = new Gtk.MenuItem (Catalog.GetString ("Insert your name"));
item.Activated += OnMenuItemActivated;
item.Show ();
AddPluginMenuItem (item);
}
public override void Shutdown ()
{
item.Activated -= OnMenuItemActivated;
}
public override void OnNoteOpened ()
{
}
void OnMenuItemActivated (object sender, EventArgs args)
{
string format = Catalog.GetString ("dddd, MMMM d, h:mm tt");
string text = DateTime.Now.ToString (format);
NoteBuffer buffer = Note.Buffer;
Gtk.TextIter cursor = buffer.GetIterAtMark (buffer.InsertMark);
buffer.InsertWithTagsByName (ref cursor, text, "datetime");
}
}
}
Thank you very much for reading such a big mail.
Krupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.beatniksoftware.com/pipermail/tomboy-list-beatniksoftware.com/attachments/20090720/408265e7/attachment.htm>
More information about the Tomboy-list
mailing list