Index: configure.in
===================================================================
--- configure.in	(revision 2035)
+++ configure.in	(working copy)
@@ -119,6 +119,17 @@
 AC_SUBST(DBUS_LIBS)
 
 #
+# Voice Notes require Gstreamer
+#
+PKG_CHECK_MODULES(GST, gstreamer-0.10, ENABLE_GST="yes", ENABLE_GST="no")
+AC_ARG_ENABLE(gstreamer, 
+	      [  --enable-gstreamer[[=no/yes]]  compile with Voice Notes addin [[default: yes]]],
+	      ENABLE_GST="$enableval")
+AM_CONDITIONAL(ENABLE_GST, test "$ENABLE_GST" = "yes")
+AC_SUBST(GST_CFLAGS)
+AC_SUBST(GST_LIBS)
+
+#
 # Check for external Mono.Addins
 #
 PKG_CHECK_MODULES(MONO_ADDINS, mono-addins >= 0.3 \
@@ -291,6 +302,7 @@
 Tomboy/Addins/SshSyncService/Makefile
 Tomboy/Addins/StickyNoteImport/Makefile
 Tomboy/Addins/Tasque/Makefile
+Tomboy/Addins/VoiceNotes/Makefile
 Tomboy/Addins/WebDavSyncService/Makefile
 test/Makefile
 po/Makefile.in
Index: Tomboy.mdp
===================================================================
--- Tomboy.mdp	(revision 2035)
+++ Tomboy.mdp	(working copy)
@@ -206,6 +206,8 @@
     <File name="Tomboy/Addins/GalagoPresence/GalagoPresenceNoteAddin.cs" subtype="Code" buildaction="Compile" />
     <File name="Tomboy/RecentTreeView.cs" subtype="Code" buildaction="Compile" />
     <File name="Mono.Addins/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs" subtype="Code" buildaction="Compile" />
+    <File name="Tomboy/Addins/VoiceNotes" subtype="Directory" buildaction="Compile" />
+    <File name="Tomboy/Addins/VoiceNotes/VoiceNote.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
Index: Tomboy/Addins/Makefile.am
===================================================================
--- Tomboy/Addins/Makefile.am	(revision 2035)
+++ Tomboy/Addins/Makefile.am	(working copy)
@@ -13,5 +13,7 @@
 	SshSyncService		\
 	StickyNoteImport	\
 	Tasque			\
+	VoiceNotes			\
 	WebDavSyncService
 
+
Index: Tomboy/Addins/VoiceNotes/VoiceNote.cs
===================================================================
--- Tomboy/Addins/VoiceNotes/VoiceNote.cs	(revision 0)
+++ Tomboy/Addins/VoiceNotes/VoiceNote.cs	(revision 0)
@@ -0,0 +1,104 @@
+using Tomboy;
+using Mono.Unix;
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using Gtk;
+
+namespace Tomboy.VoiceNote
+{
+	public class VoiceNote : NoteAddin
+	{
+		Gtk.ToolButton recordButton;
+		Gtk.ToolButton playButton;
+		Gtk.ToolButton stopButton;
+		Gtk.SeparatorToolItem separator;
+		String voice_note_path;
+		FileStream voice_note_file;
+
+		
+		static VoiceNote ()
+		{
+		}
+		
+
+		[DllImport("libvoicenote")]
+		static extern void initialize ();
+
+		[DllImport("libvoicenote")]
+		static extern void start_play (string uri);
+
+		[DllImport("libvoicenote")]
+		static extern void start_record (string uri);
+		
+		[DllImport("libvoicenote")]
+		static extern void stop_stream ();
+
+
+		public override void Initialize ()
+		{
+			separator = new Gtk.SeparatorToolItem ();
+			recordButton = new Gtk.ToolButton (Gtk.Stock.MediaRecord);
+			recordButton.Clicked += OnRecordButtonClicked;
+			playButton = new Gtk.ToolButton (Gtk.Stock.MediaPlay);
+			playButton.Clicked += OnPlayButtonClicked;
+			stopButton = new Gtk.ToolButton (Gtk.Stock.MediaStop);
+			stopButton.Clicked += OnStopButtonClicked;
+			initialize ();
+		}
+
+		
+		public override void Shutdown ()
+		{
+			recordButton.Clicked -= OnRecordButtonClicked;
+			playButton.Clicked -= OnPlayButtonClicked;
+			stopButton.Clicked -= OnStopButtonClicked;
+		}
+
+
+		public override void OnNoteOpened ()
+		{
+			voice_note_path = Note.FilePath + ".ogg";			
+			separator.Show ();
+			recordButton.Show ();
+			playButton.Show ();
+			stopButton.Show ();
+			AddToolItem (separator, -1);
+			AddToolItem (recordButton, -3);
+			AddToolItem (playButton, -2);
+			AddToolItem (stopButton, -1);
+		}
+		
+
+		void OnRecordButtonClicked (object sender, EventArgs args)
+		{
+			start_record (voice_note_path);
+		}
+
+
+		void OnPlayButtonClicked (object sender, EventArgs args)
+		{
+			start_play (voice_note_path);
+		}
+		
+		void OnStopButtonClicked (object sender, EventArgs args)
+		{
+			stop_stream ();
+		}
+
+
+		bool voice_note_exists ()
+		{
+			try{
+				/* Not guilty, I presume */
+				voice_note_file = File.Open (voice_note_path, FileMode.Open);
+			}
+			catch (Exception except) {
+				/* Oh, you've disappointed me 
+				 * I'll do nothing for you */
+				return false;
+			}
+			return true;
+		}
+	}
+}
Index: Tomboy/Addins/VoiceNotes/VoiceNote.addin.xml
===================================================================
--- Tomboy/Addins/VoiceNotes/VoiceNote.addin.xml	(revision 0)
+++ Tomboy/Addins/VoiceNotes/VoiceNote.addin.xml	(revision 0)
@@ -0,0 +1,21 @@
+<Addin id="VoiceNote"
+    namespace="Tomboy"
+    name="Voice Notes"
+    author="Tomboy Project"
+    description="Records voice notes"
+    category="Tools"
+    defaultEnabled="false"
+    version="0.1">
+
+    <Runtime>
+        <Import assembly="VoiceNote.Addin.dll" />
+    </Runtime>
+
+    <Dependencies>
+        <Addin id="Tomboy" version="0.7" />
+    </Dependencies>
+
+    <Extension path="/Tomboy/NoteAddins">
+        <NoteAddin type="Tomboy.VoiceNote.VoiceNote" />
+    </Extension>
+</Addin>
Index: Tomboy/Addins/VoiceNotes/Makefile.am
===================================================================
--- Tomboy/Addins/VoiceNotes/Makefile.am	(revision 0)
+++ Tomboy/Addins/VoiceNotes/Makefile.am	(revision 0)
@@ -0,0 +1,67 @@
+include $(top_srcdir)/Makefile.include
+
+CSFLAGS = 		\
+	-debug 		\
+	-define:DEBUG 	\
+	-target:library
+
+ASSEMBLIES = 					\
+	$(LINK_TOMBOY_EXE)			\
+	$(TOMBOY_LIBS) 				\
+	$(LINK_MONO_ADDINS)			\
+	-r:Mono.Posix
+
+if ENABLE_GST
+ADDIN_NAME = VoiceNote
+TARGET = $(ADDIN_NAME).Addin.dll
+CSFILES = \
+	$(srcdir)/VoiceNote.cs
+RESOURCES = \
+	-resource:$(srcdir)/$(ADDIN_NAME).addin.xml
+
+$(TARGET): $(CSFILES) $(top_builddir)/Tomboy/Tomboy.exe
+	$(CSC) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES)
+
+
+addinsdir = $(pkglibdir)/addins
+addins_DATA = \
+	$(TARGET)
+
+EXTRA_DIST = \
+	$(CSFILES) \
+	$(srcdir)/$(ADDIN_NAME).addin.xml
+
+CLEANFILES = \
+	$(TARGET).mdb \
+	$(TARGET)
+
+##
+## Build libvoicenote
+##
+
+INCLUDES =					\
+	-I$(top_srcdir)				\
+	-DG_LOG_DOMAIN=\"libvoicenote\" 	\
+	-DGTK_DISABLE_DEPRECATED		\
+	-DGDK_DISABLE_DEPRECATED		\
+	-DG_DISABLE_DEPRECATED			\
+	$(LIBTOMBOY_CFLAGS)                 	\
+	$(GST_CFLAGS)				\
+	$(GTK_CFLAGS)						
+
+
+voicenotelibdir = $(pkglibdir)
+voicenotelib_LTLIBRARIES = libvoicenote.la
+
+libvoicenote_la_SOURCES =	\
+	voicenotemedia.c
+
+libvoicenote_la_LDFLAGS = \
+	-export-dynamic -module -avoid-version \
+	$(LIBTOMBOY_LIBS) \
+	$(GST_LIBS)
+
+maintainer-clean-local:
+	rm -f Makefile.in
+
+endif
Index: Tomboy/Addins/VoiceNotes/voicenotemedia.c
===================================================================
--- Tomboy/Addins/VoiceNotes/voicenotemedia.c	(revision 0)
+++ Tomboy/Addins/VoiceNotes/voicenotemedia.c	(revision 0)
@@ -0,0 +1,46 @@
+#include <gst/gst.h>
+#include <string.h>
+
+#define MAX_CMD_LENGTH 256
+#define PLAY_CMD_START "filesrc location="
+#define PLAY_CMD_END " !oggdemux!vorbisdec!audioconvert!audioresample!osssink "
+#define RECORD_CMD "osssrc !audioconvert !vorbisenc !oggmux !filesink location="
+
+static GstElement *pipeline;
+static GMainLoop *loop;
+
+void
+initialize ()
+{
+  gst_init (NULL, NULL);
+  loop = g_main_loop_new (NULL, FALSE);
+}
+
+
+void
+start_record (char *uri)
+{
+  char gst_command[MAX_CMD_LENGTH] = RECORD_CMD;
+  strcat (gst_command, uri);
+  pipeline = gst_parse_launch (gst_command, NULL);
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+  g_main_loop_run (loop);
+}
+
+void
+start_play (char *uri)
+{
+  char gst_command[MAX_CMD_LENGTH] = PLAY_CMD_START;
+  strcat (gst_command, uri);
+  strcat (gst_command, PLAY_CMD_END);
+  pipeline = gst_parse_launch (gst_command, NULL);
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+  g_main_loop_run (loop);
+}
+
+void
+stop_stream ()
+{
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+  g_main_loop_quit (loop);
+}
Index: Tomboy/Tomboy.exe.config.in
===================================================================
--- Tomboy/Tomboy.exe.config.in	(revision 2035)
+++ Tomboy/Tomboy.exe.config.in	(working copy)
@@ -2,6 +2,7 @@
   <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>
   <dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so.0"/>	
   <dllmap dll="libgtkspell" target="libgtkspell.so.0"/>
+  <dllmap dll="libgstreamer" target="libgstreamer-0.10.so" />
   <dllmap dll="libtomboy" target="libtomboy.so"/>
   <dllmap dll="panel-applet-2" target="libpanel-applet-2.so.0"/>
 </configuration>
