? cscope.out
? Tomboy/Network.cs
? Tomboy/NetworkSyncWindow.cs
? data/DefaultPlugins.desktop
? data/DefaultPlugins.desktop.in
? data/tomboy-plugins.pc
? libtomboy/.deps
? libtomboy/.libs
? libtomboy/eggaccelerators.lo
? libtomboy/eggtrayicon.lo
? libtomboy/gedit-print.lo
? libtomboy/gtksourceprintjob.lo
? libtomboy/libtomboy.la
? libtomboy/tomboykeybinder.lo
? libtomboy/tomboyutil.lo
? po/.intltool-merge-cache
Index: configure.in
===================================================================
RCS file: /cvs/gnome/tomboy/configure.in,v
retrieving revision 1.67
diff -u -p -r1.67 configure.in
--- configure.in	26 Jan 2006 08:32:14 -0000	1.67
+++ configure.in	2 Feb 2006 17:20:07 -0000
@@ -96,6 +96,16 @@ AM_CONDITIONAL(ENABLE_DBUS, test "$ENABL
 AC_SUBST(DBUS_LIBS)
 
 #
+# Use Avahi# to announce tcp remoting channel
+#
+PKG_CHECK_MODULES(AVAHI, avahi-sharp >= 0.6.5, ENABLE_AVAHI="yes", ENABLE_AVAHI="no")
+AC_ARG_ENABLE(avahi, 
+	      [  --enable-avahi[[=no/yes]]    compile with avahi support [[default: yes]]],
+	      ENABLE_AVAHI="$enableval")
+AM_CONDITIONAL(ENABLE_AVAHI, test "$ENABLE_AVAHI" = "yes")
+AC_SUBST(AVAHI_LIBS)
+
+#
 # Tomboy.exe needs Gtk# Gnome# GConf#
 #
 PKG_CHECK_MODULES(TOMBOY, gtk-sharp gnome-sharp gconf-sharp)
Index: Tomboy/Applet.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Applet.cs,v
retrieving revision 1.17
diff -u -p -r1.17 Applet.cs
--- Tomboy/Applet.cs	26 Jan 2006 22:19:55 -0000	1.17
+++ Tomboy/Applet.cs	2 Feb 2006 17:20:07 -0000
@@ -167,6 +167,11 @@ namespace Tomboy
 			item.Activated += ShowPreferences;
 			menu.Append (item);
 
+			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Network Sync..."));
+			item.Image = new Gtk.Image (Gtk.Stock.Refresh, Gtk.IconSize.Menu);
+			item.Activated += ShowNetwork;
+			menu.Append (item);
+
 			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Open Plugins Folder"));
 			item.Image = new Gtk.Image (Gtk.Stock.Execute, Gtk.IconSize.Menu);
 			item.Activated += ShowPlugins;
@@ -191,6 +196,11 @@ namespace Tomboy
 		void ShowPreferences (object sender, EventArgs args)
 		{
 			tray.ShowPreferences ();
+		}
+
+		void ShowNetwork (object sender, EventArgs args)
+		{
+			manager.NetworkManager.ShowNetwork ();
 		}
 
 		void ShowPlugins (object sender, EventArgs args)
Index: Tomboy/Makefile.am
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Makefile.am,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile.am
--- Tomboy/Makefile.am	28 Sep 2005 05:49:25 -0000	1.32
+++ Tomboy/Makefile.am	2 Feb 2006 17:20:07 -0000
@@ -13,6 +13,11 @@ DBUS_CSFILES = 				\
 	$(srcdir)/RemoteControlProxy.cs
 endif
 
+if ENABLE_DBUS
+AVAHI_CSFLAGS = -define:ENABLE_AVAHI
+endif
+
+
 if OLD_GTKSPELL
 OLD_GTKSPELL_CSFLAGS = -define:OLD_GTKSPELL
 endif
@@ -27,12 +32,15 @@ CSFLAGS = 				\
 	-unsafe 			\
 	-target:exe 			\
 	$(DBUS_CSFLAGS) 		\
+	$(AVAHI_CSFLAGS) 		\
 	$(FIXED_GTKSPELL_CSFLAGS) 	\
 	$(OLD_GTKSPELL_CSFLAGS)
 
 CSFILES = 					\
 	$(srcdir)/Tomboy.cs 			\
 	$(srcdir)/Applet.cs 			\
+	$(srcdir)/Network.cs 			\
+	$(srcdir)/NetworkSyncWindow.cs  \
 	$(srcdir)/Note.cs 			\
 	$(srcdir)/NoteManager.cs 		\
 	$(srcdir)/NoteWindow.cs 		\
@@ -57,7 +65,9 @@ CSFILES = 					\
 ASSEMBLIES = 		\
 	$(TOMBOY_LIBS) 	\
 	-r:Mono.Posix	\
-	$(DBUS_LIBS)
+	-r:System.Runtime.Remoting.dll \
+	$(DBUS_LIBS) \
+	$(AVAHI_LIBS)
 
 RESOURCES = 										\
 	-resource:$(top_srcdir)/data/GNOME_TomboyApplet.xml,GNOME_TomboyApplet.xml	\
Index: Tomboy/NoteManager.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/NoteManager.cs,v
retrieving revision 1.21
diff -u -p -r1.21 NoteManager.cs
--- Tomboy/NoteManager.cs	1 Jan 2006 01:57:05 -0000	1.21
+++ Tomboy/NoteManager.cs	2 Feb 2006 17:20:07 -0000
@@ -1,4 +1,3 @@
-
 using System;
 using System.IO;
 using System.Collections;
@@ -6,16 +5,83 @@ using Mono.Posix;
 
 namespace Tomboy
 {
+	// TODO add a easy interface to fetch remote notes
+	public class NetworkManager
+	{
+		private NetworkServer server;
+		private AvahiServer avahi;
+		private NoteManager manager;
+		private AvahiBrowser browser;
+
+		public NetworkManager (NoteManager manager)
+		{
+			this.manager = manager;
+			this.server = new NetworkServer (manager);
+#if ENABLE_AVAHI			
+			Avahi.Client client = new Avahi.Client ();
+			this.avahi = new AvahiServer (client);
+			server.ListenStateChanged += OnListenStateChanged;
+			this.browser = new AvahiBrowser (client);
+			browser.ServiceFound += OnServiceFound;
+#endif			
+			server.Setup ();
+		}
+
+		public void Shutdown ()
+		{
+			server.Shutdown ();
+		}
+
+		// Connect Dialog
+		public void ShowNetwork ()
+		{
+			Gtk.Dialog net_dlg = new NetworkConnectDialog (manager);
+			net_dlg.Run ();
+			net_dlg.Destroy ();
+		}
+		
+		void OnListenStateChanged (object sender, NetworkState args)
+		{
+#if ENABLE_AVAHI			
+			if (args.Listen)
+				avahi.Start ();
+			else
+				avahi.Stop ();
+#endif
+		}
+
+		void OnServiceFound (object sender, EventArgs args)
+		{
+#if ENABLE_AVAHI			
+			Avahi.ServiceInfoArgs serviceargs = args as Avahi.ServiceInfoArgs;
+			Avahi.ServiceInfo Service = serviceargs.Service;
+
+			Console.WriteLine ("{0}: {1} with {2}:{3}", "manager:",
+					Service.Name, 
+					Service.Address, Service.Port);
+			Console.WriteLine ("\tdomain {0} nic {1} proto {2} as {3}", 
+					Service.Domain, 
+					Service.NetworkInterface, 
+					Service.Protocol,
+					Service.HostName); 
+#endif
+		}
+	}
+
 	public delegate void NotesChangedHandler (object sender, Note changed);
 
 	public class NoteManager 
 	{
 		string notes_dir;
 		string backup_dir;
+		string network_dir;
 		ArrayList notes;
 		PluginManager plugin_mgr;
+		NetworkManager network_mgr;
 		TrieController trie_controller;
 
+		public string NetworkDir { get { return network_dir; } }
+
 		public NoteManager () : 
 			this (Path.Combine (Environment.GetEnvironmentVariable ("HOME"), 
 					    ".tomboy")) 
@@ -69,6 +135,14 @@ namespace Tomboy
 				}
 			}
 
+			// Network manager
+			network_dir = Path.Combine (notes_dir, "Remote");
+			if (Directory.Exists (network_dir))
+				Directory.Delete (network_dir, true);
+			Directory.CreateDirectory (network_dir);
+
+			network_mgr = new NetworkManager (this);
+
 			Tomboy.ExitingEvent += OnExitingEvent;
 		}
 
@@ -105,6 +179,9 @@ namespace Tomboy
 
 		void OnExitingEvent (object sender, EventArgs args)
 		{
+			// Shutdown network
+			network_mgr.Shutdown ();
+
 			Console.WriteLine ("Saving unsaved notes...");
 
 			foreach (Note note in notes) {
@@ -292,6 +369,13 @@ namespace Tomboy
 		{
 			get {
 				return plugin_mgr;
+			}
+		}
+
+		public NetworkManager NetworkManager
+		{
+			get {
+				return network_mgr;
 			}
 		}
 
Index: Tomboy/Preferences.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Preferences.cs,v
retrieving revision 1.5
diff -u -p -r1.5 Preferences.cs
--- Tomboy/Preferences.cs	13 Aug 2005 11:16:11 -0000	1.5
+++ Tomboy/Preferences.cs	2 Feb 2006 17:20:08 -0000
@@ -23,6 +23,12 @@ namespace Tomboy
 		public const string EXPORTHTML_LAST_DIRECTORY = "/apps/tomboy/export_html/last_directory";
 		public const string EXPORTHTML_EXPORT_LINKED = "/apps/tomboy/export_html/export_linked";
 
+		public const string ENABLE_NETWORK_SERVER = "/apps/tomboy/enable_network_server";
+		public const string ENABLE_AVAHI_SERVER = "/apps/tomboy/enable_avahi_server";
+		public const string NETWORK_LISTEN_PORT = "/apps/tomboy/network_listen_port";
+		public const string NETWORK_REMOTE_HOST = "/apps/tomboy/network_remote_host";
+		public const string NETWORK_REMOTE_PORT = "/apps/tomboy/network_remote_port";
+
 		static GConf.Client client;
 		static GConf.NotifyEventHandler changed_handler;
 
@@ -51,6 +57,21 @@ namespace Tomboy
 			case ENABLE_WIKIWORDS:
 				return false;
 
+			case ENABLE_NETWORK_SERVER:
+				return false;
+
+			case ENABLE_AVAHI_SERVER:
+				return false;
+
+			case NETWORK_LISTEN_PORT:
+				return "1222";
+
+			case NETWORK_REMOTE_HOST:
+				return "localhost";
+
+			case NETWORK_REMOTE_PORT:
+				return "1222";
+
 			case CUSTOM_FONT_FACE:
 				return "Serif 11";
 
@@ -107,6 +128,7 @@ namespace Tomboy
 	public class PreferencesDialog : Gtk.Dialog
 	{
 		Gtk.Button font_button;
+		Gtk.CheckButton avahi_check;
 		Gtk.Label font_face;
 		Gtk.Label font_size;
 
@@ -143,6 +165,9 @@ namespace Tomboy
 			notebook.AppendPage (MakeHotkeysPane (), 
 					     new Gtk.Label (Catalog.GetString ("Hotkeys")));
 
+			notebook.AppendPage (MakeNetworkPane (), 
+					     new Gtk.Label (Catalog.GetString ("Network")));
+
 			VBox.PackStart (notebook, true, true, 0);
 
 
@@ -376,6 +401,70 @@ namespace Tomboy
 			return hotkeys_list;
 		}
 
+		// Page 3
+		// List of Network options
+		public Gtk.Widget MakeNetworkPane ()
+		{
+			Gtk.CheckButton check;
+			Gtk.Label label;
+			Gtk.Entry entry;
+			PropertyEditor peditor;
+			PropertyEditorBool peditor_bool;
+
+			Gtk.VBox network_list = new Gtk.VBox (false, 4);
+			network_list.BorderWidth = 12;
+			network_list.Show ();
+
+			// Network Server enable Checkbox
+			check = MakeCheckButton (Catalog.GetString ("Enable _Network Server"));
+			network_list.PackStart (check, false, false, 0);
+
+			peditor_bool = new PropertyEditorToggleButton (Preferences.ENABLE_NETWORK_SERVER, 
+								  check);
+			SetupPropertyEditor (peditor_bool);
+
+			label = MakeTipLabel (Catalog.GetString ("Enable this option to make " +
+								 "Tomboy listen on a tcp port "));
+			network_list.PackStart (label, false, false, 0);
+			
+			// Listen Port Number Entry
+			Gtk.HBox port_box = new Gtk.HBox (false, 2);
+
+			label = MakeLabel (Catalog.GetString ("_Port Number"));
+			port_box.Add (label);
+
+			entry = new Gtk.Entry ();
+			entry.Show ();
+			port_box.Add (entry);
+
+			peditor = new PropertyEditorEntry (Preferences.NETWORK_LISTEN_PORT, 
+							   entry);
+			SetupPropertyEditor (peditor);
+
+			port_box.Show ();
+			network_list.PackStart (port_box, false, false, 0);
+
+#if ENABLE_AVAHI			
+			// Avahi Announce Checkbox
+			avahi_check = MakeCheckButton (Catalog.GetString ("Enable _Avahi Announcer"));
+			avahi_check.Sensitive = check.Active;
+			network_list.PackStart (avahi_check, false, false, 0);
+
+			peditor_bool = new PropertyEditorToggleButton (Preferences.ENABLE_AVAHI_SERVER, 
+								  avahi_check);
+			SetupPropertyEditor (peditor_bool);
+
+			label = MakeTipLabel (Catalog.GetString ("Enable this option to announce " +
+								 "the Tomboy server via mdns."));
+			network_list.PackStart (label, false, false, 0);
+
+			// grey out avahi
+			check.Toggled += OnEnableNetworkServerToggled;
+#endif // ENABLE_AVAHI			
+			
+			return network_list;
+		}
+
 		void SetupPropertyEditor (PropertyEditor peditor)
 		{
 			// Ensure the key exists
@@ -452,5 +541,15 @@ namespace Tomboy
 							  font_desc,
 							  desc.ToString ());
 		}
+
+		void OnEnableNetworkServerToggled (object sender, EventArgs args)
+		{
+			Gtk.CheckButton cb = sender as Gtk.CheckButton;
+			if (cb.Active)
+				avahi_check.Sensitive = cb.Active;
+			else
+				avahi_check.Sensitive = false;
+		}
+
 	}
 }
Index: data/tomboy.schemas.in
===================================================================
RCS file: /cvs/gnome/tomboy/data/tomboy.schemas.in,v
retrieving revision 1.3
diff -u -p -r1.3 tomboy.schemas.in
--- data/tomboy.schemas.in	4 May 2005 09:03:28 -0000	1.3
+++ data/tomboy.schemas.in	2 Feb 2006 17:20:08 -0000
@@ -63,6 +63,81 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/tomboy/enable_network_server</key>
+      <applyto>/apps/tomboy/enable_network_server</applyto>
+      <owner>tomboy</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Enable Tomboy network.</short>
+         <long>
+	   Enable this option to make Tomboy listen on 
+       a tcp port.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/tomboy/enable_avahi_server</key>
+      <applyto>/apps/tomboy/enable_avahi_server</applyto>
+      <owner>tomboy</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Enable avahi announcer.</short>
+         <long>
+	   Enable this option to announce the Tomboy server via 
+       mdns.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/tomboy/network_listen_port</key>
+      <applyto>/apps/tomboy/network_listen_port</applyto>
+      <owner>tomboy</owner>
+      <type>string</type>
+      <default>1222</default>
+      <locale name="C">
+         <short>Network Port</short>
+         <long>
+	   Tomboy will listen on this port for remote tomboy 
+       sync requests.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/tomboy/network_remote_host</key>
+      <applyto>/apps/tomboy/network_remote_host</applyto>
+      <owner>tomboy</owner>
+      <type>string</type>
+      <default>localhost</default>
+      <locale name="C">
+         <short>Remote Host</short>
+         <long>
+	   Tomboy will connect to this host to
+       sync.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/tomboy/network_remote_port</key>
+      <applyto>/apps/tomboy/network_remote_port</applyto>
+      <owner>tomboy</owner>
+      <type>string</type>
+      <default>1222</default>
+      <locale name="C">
+         <short>Remote Port</short>
+         <long>
+	   Tomboy will connect to this port on the remote host to
+       sync.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/tomboy/enable_keybindings</key>
       <applyto>/apps/tomboy/enable_keybindings</applyto>
       <owner>tomboy</owner>
