[tomboy-list] Timestamp idea
Raymond
rayauge at doublebite.com
Fri Jun 15 09:28:44 PDT 2007
I did just this by customizing the example for InsertDateTime.cs on the
site.
Here is the code I used (virtually the same as that on the plugin
tutorial page)
=============================================================
using System;
using Mono.Unix;
using Gtk;
using Tomboy;
[PluginInfo(
"Insert Date/Time", Defines.VERSION,
PluginInfoAttribute.OFFICIAL_AUTHOR,
"Inserts current date and time at the cursor position.",
WebSite = "http://www.gnome.org/projects/tomboy/"
)]
public class InsertDateTimePlugin : NotePlugin
{
Gtk.MenuItem item;
protected override void Initialize ()
{
item = new Gtk.MenuItem (Catalog.GetString ("Insert date and time"));
item.Activated += OnMenuItemActivated;
item.Show ();
AddPluginMenuItem (item);
}
protected override void Shutdown ()
{
item.Activated -= OnMenuItemActivated;
}
protected override void OnNoteOpened ()
{
/*
* To Add the date when a new note is opened I would
just add similar code here.
*/
}
void OnMenuItemActivated (object sender, EventArgs args)
{
string format = Catalog.GetString ("dddd, MMMM d yyyy, 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, "bold");
}
}
=================================================================
Compile with
$] gmcs -debug -out:InsertDateTime.dll -target:library
-pkg:tomboy-plugins -r:Mono.Posix InsertDateTime.cs
On Fri, 2007-06-15 at 11:04 -0400, Pete Goodall wrote:
> Hi all,
>
> Was just browsing through the Place for Ideas site, and noticed the
> Timestamps idea:
> http://live.gnome.org/Tomboy/PlaceForNewIdeas#head-4c3b027684b342a623f2133a20f669f6428dd0a6
>
> This is similar to what I had in mind, but a bit of overkill. I
> simply want an "Insert timestamp" option. For instance, when I start
> a new note, I would like to have "Note started on Friday, 15 June 2007
> @ 11:02 am EST". Then later in the note I would "Insert timestamp" to
> paste in the time I started an edit. This would be useful if I have a
> note that includes meeting notes from various meetings over time.
>
> Anyway, that's my $0.02.
>
> - Pete
>
>
Raymond Auge <rauge at liferay.com>
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
Raymond Auge <rauge at liferay.com>
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.beatniksoftware.com/pipermail/tomboy-list-beatniksoftware.com/attachments/20070615/504fd57f/attachment.html
More information about the tomboy-list
mailing list