Index: configure.in
===================================================================
RCS file: /cvs/gnome/tomboy/configure.in,v
retrieving revision 1.83
diff -U3 -r1.83 configure.in
--- configure.in	24 Jul 2006 19:11:40 -0000	1.83
+++ configure.in	24 Jul 2006 21:15:34 -0000
@@ -91,6 +91,16 @@
 AM_CONDITIONAL(ENABLE_DBUS, test "$ENABLE_DBUS" = "yes")
 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#
 #
Index: Tomboy/Applet.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Applet.cs,v
retrieving revision 1.20
diff -U3 -r1.20 Applet.cs
--- Tomboy/Applet.cs	23 Jul 2006 23:14:25 -0000	1.20
+++ Tomboy/Applet.cs	24 Jul 2006 21:15:34 -0000
@@ -167,6 +167,12 @@
 			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;
@@ -192,6 +198,11 @@
 		{
 			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.35
diff -U3 -r1.35 Makefile.am
--- Tomboy/Makefile.am	24 Jul 2006 07:26:55 -0000	1.35
+++ Tomboy/Makefile.am	24 Jul 2006 21:15:34 -0000
@@ -13,6 +13,11 @@
 	$(srcdir)/RemoteControlProxy.cs
 endif
 
+if ENABLE_DBUS
+AVAHI_CSFLAGS = -define:ENABLE_AVAHI
+endif
+
+
 if FIXED_GTKSPELL
 FIXED_GTKSPELL_CSFLAGS = -define:FIXED_GTKSPELL
 endif
@@ -23,17 +28,21 @@
 	-unsafe 			\
 	-target:exe 			\
 	$(DBUS_CSFLAGS) 		\
+	$(AVAHI_CSFLAGS) 		\
 	$(FIXED_GTKSPELL_CSFLAGS)
 
 CSFILES = 					\
 	$(srcdir)/Tomboy.cs 			\
 	$(srcdir)/Applet.cs 			\
 	$(srcdir)/Logger.cs			\
+    $(srcdir)/Network.cs            \
+    $(srcdir)/NetworkSyncWindow.cs  \
 	$(srcdir)/Note.cs 			\
 	$(srcdir)/NoteManager.cs 		\
 	$(srcdir)/NoteWindow.cs 		\
 	$(srcdir)/NoteBuffer.cs 		\
 	$(srcdir)/NoteTag.cs 			\
+	$(srcdir)/NetworkManager.cs		\
 	$(srcdir)/PluginManager.cs		\
 	$(srcdir)/Preferences.cs		\
 	$(srcdir)/RecentChanges.cs		\
@@ -50,7 +59,10 @@
 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/Network.cs
===================================================================
RCS file: Tomboy/Network.cs
diff -N Tomboy/Network.cs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Tomboy/Network.cs	24 Jul 2006 21:15:34 -0000
@@ -0,0 +1,512 @@
+using System;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using Gtk;
+using Mono.Unix;
+
+
+namespace Tomboy
+{
+	// ------------ Shared Data
+	public class NetworkData : MarshalByRefObject
+	{
+		[Serializable]
+		public class SerNote {
+			public string title;
+			public string xml;
+			public DateTime date;
+
+			public SerNote (string title, string xml, DateTime date)
+			{
+				this.title = title;
+				this.xml = xml;
+				this.date = date;
+			}
+		}
+
+		private NoteManager manager;
+
+		public NetworkData (NoteManager manager)
+		{
+			this.manager = manager;
+		}
+
+		public bool Connected ()
+		{
+			return true;
+		}
+
+		public ArrayList Notes ()
+		{
+			ArrayList tmp = new ArrayList ();
+			foreach (Note note in manager.Notes)
+				tmp.Add (new SerNote (note.Title, note.XmlContent, note.ChangeDate));
+			return tmp;
+		}
+
+		// unused
+		public ArrayList Titles ()
+		{
+			ArrayList tmp = new ArrayList ();
+			foreach (Note note in manager.Notes)
+				tmp.Add (note.Title);
+			return tmp;
+		}
+
+		// unused
+		public bool PutNote (SerNote note, bool overwrite)
+		{
+			// create or overwrite
+			Note local_note = manager.Find (note.title);
+			if (local_note != null && !overwrite)
+				return false;
+
+			if (local_note !=null)
+			{
+				local_note.XmlContent = note.xml;
+				return true;
+			}
+
+			manager.Create (note.title, note.xml);
+			return true;
+		}
+
+		// unused
+		public SerNote GetNote (string title)
+		{
+			SerNote note = null;
+			Note local_note = manager.Find (title);
+			if (local_note == null)
+				return note;
+
+			note = new SerNote (local_note.Title, local_note.XmlContent, 
+					local_note.ChangeDate);
+			return note;
+		}
+
+		// Fixes crash on exit...
+		public override System.Object InitializeLifetimeService()
+		{
+			return null;
+		}
+	}
+
+	// ------------ Client
+	public class NetworkConnectDialog : Dialog		
+	{
+		Button connectButton;
+		Entry remoteHost, remotePort;
+		static Gdk.Pixbuf tintin;
+
+		NoteManager manager;
+		NetworkData data;
+		TcpChannel channel;
+
+		static NetworkConnectDialog  ()
+		{
+			tintin = new Gdk.Pixbuf (null, "tintin.png");
+		}
+
+		public NetworkConnectDialog  (NoteManager manager) : base ()
+		{
+			Icon = tintin;
+			Title = Catalog.GetString ("Tomboy Network");
+			Modal = true;
+
+			this.manager = manager;
+
+			Preferences.SettingChanged += OnNetworkSettingChanged;
+
+			MakeLayout ();
+
+			remoteHost.Text = GetHost();
+			remotePort.Text = GetPort();
+		}
+
+		public void MakeLayout ()
+		{
+			Gtk.Label label;
+
+			VBox.Spacing = 5;
+			ActionArea.Layout = Gtk.ButtonBoxStyle.End;
+
+			// Settings Table
+			Gtk.Table table = new Gtk.Table (2, 2, false);
+			table.ColumnSpacing = 6;
+			table.RowSpacing = 6;
+
+			label = new Label (Catalog.GetString ("Remote Host"));
+			label.Show ();
+			table.Attach (label, 0, 1, 0, 1);
+
+			// FIXME as a ComboBox, filled by avahi
+			remoteHost = new Entry ();
+			remoteHost.Show ();
+			table.Attach (remoteHost, 1, 2, 0, 1);
+
+			label = new Label (Catalog.GetString ("Remote Port"));
+			label.Show ();
+			table.Attach (label, 0, 1, 1, 2);
+
+			remotePort = new Entry ();
+			remotePort.Show ();
+			table.Attach (remotePort, 1, 2, 1, 2);
+
+			table.Show ();
+			VBox.Add (table);
+
+			// Connect&Sync Button
+			connectButton = new Button ();
+			connectButton.Label = Catalog.GetString("Connect");
+                        connectButton.CanDefault = true;
+			connectButton.Show ();
+			connectButton.Clicked += OnConnectRemoteClicked;
+			VBox.Add (connectButton);
+
+                        // Ok button...
+                        Gtk.Button button = new Gtk.Button (Gtk.Stock.Close);
+                        button.CanDefault = true;
+                        button.Show ();
+
+                        Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
+                        AddAccelGroup (accel_group);
+
+                        button.AddAccelerator ("activate",
+                                               accel_group,
+                                               (uint) Gdk.Key.Escape,
+                                               0,
+                                               0);
+
+                        AddActionWidget (button, Gtk.ResponseType.Close);
+                        DefaultResponse = Gtk.ResponseType.Close;
+		}
+
+		void OnNetworkSettingChanged (object sender, GConf.NotifyEventArgs args)
+		{
+			switch (args.Key) {
+			case Preferences.NETWORK_REMOTE_HOST:
+				remoteHost.Text = GetHost();
+				break;
+
+			case Preferences.NETWORK_REMOTE_PORT:
+				remotePort.Text = GetPort ();
+				break;
+			}
+		}
+
+		private string GetHost ()
+		{
+			string host = (string) Preferences.Get (Preferences.NETWORK_REMOTE_HOST);
+			if (host == null)
+				host = (string) Preferences.GetDefault ("NETWORK_REMOTE_HOST");
+			return host;
+		}
+
+		private string GetPort ()
+		{
+			string port_str = (string) Preferences.Get (Preferences.NETWORK_REMOTE_PORT);
+			if (port_str == null || Int32.Parse (port_str) < 1024)
+				port_str = (string) Preferences.GetDefault ("NETWORK_REMOTE_PORT");
+			return port_str;
+		}
+
+		public void OnConnectRemoteClicked (object obj, System.EventArgs args)
+		{
+			string hostname = remoteHost.Text;
+			string port = remotePort.Text;
+
+			if (hostname == "" || port == "")
+				return;
+
+			Console.WriteLine ("Connecting {0}:{1}", 
+					hostname, port);
+
+                        IDictionary props = new Hashtable();
+                        props["name"] = "tomboy.rem";
+                        props["port"] = 1236;
+                        channel = new TcpChannel(props, null, null);
+			try {
+                        	ChannelServices.RegisterChannel (channel);
+			} catch {
+				Console.WriteLine ("Channel registration error.");
+				return;
+			}
+                        object remOb = Activator.GetObject (
+					typeof(NetworkData),
+					String.Format("tcp://{0}:{1}/tomboy.rem", 
+						hostname, port)
+					);
+                        data = (NetworkData)remOb;
+			
+			try {
+				//bool test = data.Connected ();
+				data.Connected ();
+			} catch {
+				// FIXME show error dialog
+	            ChannelServices.UnregisterChannel (channel);
+				Console.WriteLine ("Connection failed.");
+				return;
+			}
+
+			Preferences.Set (Preferences.NETWORK_REMOTE_HOST, remoteHost.Text);
+			Preferences.Set (Preferences.NETWORK_REMOTE_PORT, remotePort.Text);
+			ShowSyncWindow ();
+			Destroy();
+		}
+
+		public void ShowSyncWindow ()
+		{
+			Gtk.Window sync_window = new NetworkSyncWindow (manager, data);
+			sync_window.Destroyed += OnSyncWindowClosed;
+			sync_window.Show();
+		}
+
+		public void OnSyncWindowClosed (object obj, System.EventArgs args)
+		{
+			Console.WriteLine ("Connection closed.");
+                        ChannelServices.UnregisterChannel (channel);
+		}
+
+	}
+
+	// ------------ Server
+	public class NetworkState : EventArgs 
+	{ 
+		private bool listen;
+		public bool Listen { get { return listen; } }
+		public NetworkState (bool listen) : base ()
+		{
+			this.listen = listen;
+		}
+	}
+
+	public class NetworkServer
+	{
+		private int listenPort;
+		private TcpChannel channel;
+
+		NoteManager manager;
+	
+		private NetworkData data;
+		public NetworkData Data { 
+			get { return data; } 
+			set { data = value; }
+		}
+
+		public delegate void NetworkEventHandler (object sender, NetworkState args);
+		public event NetworkEventHandler ListenStateChanged;
+
+		public NetworkServer (NoteManager manager)
+		{
+			this.manager = manager;
+			listenPort = GetPort ();
+
+			data = new NetworkData (manager);
+			RemotingServices.Marshal (data, "tomboy.rem");
+
+		}
+
+		public void Setup ()
+		{
+			if ((bool) Preferences.Get (Preferences.ENABLE_NETWORK_SERVER)) 
+				Listen ();
+
+			Preferences.SettingChanged += OnNetworkSettingChanged;
+		}
+
+		private int GetPort ()
+		{
+			string port_str = (string) Preferences.Get (Preferences.NETWORK_LISTEN_PORT);
+			if (port_str == null || Int32.Parse (port_str) < 1024)
+				port_str = (string) Preferences.GetDefault ("NETWORK_LISTEN_PORT");
+			return Int32.Parse (port_str);
+		}
+
+		public void Listen ()
+		{
+			if (channel != null)
+				return;
+
+			try {
+				channel = new TcpChannel(listenPort);
+				ChannelServices.RegisterChannel (channel);
+			} catch {
+				Console.WriteLine ("Channel already in use.");
+				channel = null;
+				return;
+			}
+
+			if (ListenStateChanged != null)
+				ListenStateChanged (this, new NetworkState (true));
+
+			Console.WriteLine ("Tomboy tcp network enabled, " + 
+					"listening for incoming connections on port {0}", 
+					listenPort.ToString());
+		}
+
+		public void UnListen ()
+		{
+			if (channel == null)
+				return;
+
+			channel.StopListening (null);
+			ChannelServices.UnregisterChannel(channel);
+			channel = null;
+
+			if (ListenStateChanged != null)
+				ListenStateChanged (this, new NetworkState (false));
+			Console.WriteLine ("Tomboy tcp network disabled");
+		}
+
+		public void Shutdown ()
+		{
+			RemotingServices.Disconnect(data);
+			if (channel != null)
+				ChannelServices.UnregisterChannel(channel);
+			Console.WriteLine("Network server shutdown.");
+		}
+
+		void OnNetworkSettingChanged (object sender, GConf.NotifyEventArgs args)
+		{
+			switch (args.Key) {
+			case Preferences.ENABLE_NETWORK_SERVER:
+				if ((bool) Preferences.Get (Preferences.ENABLE_NETWORK_SERVER)) 
+					Listen ();
+				else
+					UnListen ();
+				break;
+
+			case Preferences.NETWORK_LISTEN_PORT:
+				listenPort = GetPort ();
+				if ((bool) Preferences.Get (Preferences.ENABLE_NETWORK_SERVER)) 
+				{
+					UnListen ();
+					Listen ();
+				}
+				break;
+			}
+		}
+	}
+
+#if ENABLE_AVAHI		
+	// ------------ Avahi Announcer
+	public class AvahiServer
+	{
+		Avahi.Client client;
+		private Avahi.EntryGroup eg;
+
+		public AvahiServer (Avahi.Client client)
+		{
+			this.client = client;
+
+			Preferences.SettingChanged += OnAvahiSettingChanged;
+		}
+
+		public void Start ()
+		{
+			if ((bool) Preferences.Get (Preferences.ENABLE_AVAHI_SERVER) && 
+					(bool) Preferences.Get (Preferences.ENABLE_AVAHI_SERVER)) 
+				RegisterService ();
+		}
+
+		public void Stop ()
+		{
+			UnregisterService ();
+		}
+
+		private int GetPort ()
+		{
+			string port_str = (string) Preferences.Get (Preferences.NETWORK_LISTEN_PORT);
+			if (port_str == null || Int32.Parse (port_str) < 1024)
+				port_str = (string) Preferences.GetDefault ("NETWORK_LISTEN_PORT");
+			return Int32.Parse (port_str);
+		}
+
+		private void RegisterService () 
+		{
+			if (eg != null)
+				eg.Reset ();
+			else
+				eg = new Avahi.EntryGroup (client);
+
+			try {
+				eg.AddService (
+						String.Format ("Tomboy Notes from {0}", 
+							System.Environment.UserName),
+						"_tomboy._tcp", "", 
+						(ushort) GetPort (),
+						new string[] { 
+							"Machine Name=Tomboy Note Share", 
+							"Password=false", 
+							"txtvers=1" 
+						});
+				eg.Commit ();
+				Console.WriteLine ("Started Avahi announcer.");
+			} catch (Exception e) {
+				// already registered similiar mdns
+				Console.WriteLine ("Avahi Exception: {0}", e.ToString());
+			}
+		}
+
+		private void UnregisterService () 
+		{
+			if (eg == null)
+				return;
+
+			eg.Reset ();
+			eg.Dispose ();
+			eg = null;
+			Console.WriteLine ("Stopped Avahi announcer.");
+		}
+
+		void OnAvahiSettingChanged (object sender, GConf.NotifyEventArgs args)
+		{
+			if (args.Key == Preferences.ENABLE_AVAHI_SERVER)
+				if ((bool) Preferences.Get (Preferences.ENABLE_AVAHI_SERVER)) 
+					RegisterService ();
+				else
+					UnregisterService ();
+		}
+	}
+#endif // ENABLE_AVAHI		
+
+#if ENABLE_AVAHI		
+	// ------------ Avahi Service Browser
+	public class AvahiBrowser
+	{
+		Avahi.Client client;
+		Avahi.ServiceBrowser browser;
+		Avahi.ServiceResolver resolver;
+
+		public event Avahi.ServiceInfoHandler ServiceFound;
+
+		public AvahiBrowser (Avahi.Client client)
+		{
+			this.client = client;
+			this.browser = new Avahi.ServiceBrowser (client, "_tomboy._tcp");
+			browser.ServiceAdded += OnServiceAdded;
+		}
+
+		public void OnServiceAdded (object o, Avahi.ServiceInfoArgs args)
+		{
+			if (args.Service.Protocol != Avahi.Protocol.IPv4)
+				return;
+			// FIXME still receiving own anouncement
+			if (args.Service.Flags != Avahi.LookupResultFlags.OurOwn)
+			{
+				resolver = new Avahi.ServiceResolver (client, args.Service);
+				resolver.Found += OnFound;
+			}
+		}
+
+		public void OnFound (object o, Avahi.ServiceInfoArgs args)
+		{
+			ServiceFound(this, args);
+			Avahi.ServiceResolver r = o as Avahi.ServiceResolver;
+			r.Dispose();
+		}
+	}
+#endif // ENABLE_AVAHI		
+}
Index: Tomboy/NetworkManager.cs
===================================================================
RCS file: Tomboy/NetworkManager.cs
diff -N Tomboy/NetworkManager.cs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Tomboy/NetworkManager.cs	24 Jul 2006 21:15:34 -0000
@@ -0,0 +1,72 @@
+
+using System;
+using System.IO;
+using System.Collections;
+using Mono.Unix;
+
+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
+		}
+	}
+
+}
Index: Tomboy/NetworkSyncWindow.cs
===================================================================
RCS file: Tomboy/NetworkSyncWindow.cs
diff -N Tomboy/NetworkSyncWindow.cs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Tomboy/NetworkSyncWindow.cs	24 Jul 2006 21:15:34 -0000
@@ -0,0 +1,469 @@
+using System;
+using System.Collections;
+using Mono.Unix;
+using Gtk;
+
+namespace Tomboy
+{
+	public class NetworkSyncWindow : Window
+	{
+		NoteManager manager;
+		NetworkData data;
+
+		Gtk.AccelGroup accel_group;
+		Gtk.Button close_button;
+		Gtk.Button sync_button;
+		Gtk.Button keep_button;
+		Gtk.ScrolledWindow matches_window;
+		Gtk.VBox content_vbox;
+
+		Gtk.TreeView tree;
+		Gtk.ListStore store;
+
+		static Gdk.Pixbuf recent_icon;
+		static Gdk.Pixbuf stock_notes_icon;
+
+		Note cur_lnote, cur_rnote;
+
+		private enum Columns {
+			ICON = 0,
+			TITLE = 1,
+			LOCAL_DATE = 2,
+			REMOTE_DATE = 3,
+			ACTION_KEEP = 4,
+			ACTION_GET = 5,
+			LOCAL_NOTE = 6,
+			REMOTE_NOTE = 7,
+			REMOTE_DATETIME = 8
+                }
+
+
+		static NetworkSyncWindow ()
+		{
+                        // FIXME: Get a better recent notes window icon
+                        //recent_icon = new Gdk.Pixbuf (null, "stock_notes.png");
+                        recent_icon = GuiUtils.GetIcon ("stock_notes",16);
+                        stock_notes_icon = GuiUtils.GetIcon ("stock_notes",16);
+		}
+
+		public NetworkSyncWindow (NoteManager manager, NetworkData data)
+			: base (Catalog.GetString ("Network Synchronization"))
+		{ 
+			this.manager = manager;
+			this.data = data;
+			this.Icon = recent_icon;
+			this.DefaultWidth = 500;
+
+			// For Escape (Close)
+			accel_group = new Gtk.AccelGroup ();
+			AddAccelGroup (accel_group);
+
+			Gtk.Image image = new Gtk.Image (Gtk.Stock.SortAscending, 
+							 Gtk.IconSize.Dialog);
+
+			Gtk.Label label = new Gtk.Label (Catalog.GetString (
+				"<b>Note Overview</b> ...\n" +
+				"Select action for each note."));
+			label.UseMarkup = true;
+			label.Wrap = true;
+
+			Gtk.HBox hbox = new Gtk.HBox (false, 2);
+			hbox.BorderWidth = 8;
+			hbox.PackStart (image, false, false, 4);
+			hbox.PackStart (label, false, false, 0);
+			hbox.ShowAll ();
+
+			MakeSyncTree ();
+			tree.Show ();
+
+			// List all the current notes
+			UpdateResults ();
+
+			// Update on changes to notes
+			manager.NoteDeleted += OnNotesChanged;
+			manager.NoteAdded += OnNotesChanged;
+			manager.NoteRenamed += OnNoteRenamed;
+			
+			matches_window = new Gtk.ScrolledWindow ();
+			matches_window.ShadowType = Gtk.ShadowType.In;
+
+			// Reign in the window size if there are notes with long
+			// names, or a lot of notes...
+
+			Gtk.Requisition tree_req = tree.SizeRequest ();
+			if (tree_req.Height > 420)
+				matches_window.HeightRequest = 420;
+			else
+				matches_window.VscrollbarPolicy = Gtk.PolicyType.Never;
+
+			if (tree_req.Width < 280)
+				matches_window.WidthRequest = 280;
+			else
+				matches_window.HscrollbarPolicy = Gtk.PolicyType.Never;
+
+			matches_window.Add (tree);
+			matches_window.Show ();
+
+			keep_button = new Gtk.Button ();
+			keep_button.Label = Catalog.GetString("Keep All");
+			keep_button.Clicked += OnKeepClicked;
+			keep_button.Show ();
+
+			sync_button = new Gtk.Button ();
+			sync_button.Label = Catalog.GetString("Sync");
+			sync_button.Clicked += OnSyncClicked;
+			sync_button.Show ();
+
+			Separator separator = new Gtk.VSeparator ();
+			separator.Show ();
+
+
+			close_button = new Gtk.Button (Gtk.Stock.Close);
+			close_button.Clicked += CloseClicked;
+			close_button.AddAccelerator ("activate",
+						     accel_group,
+						     (uint) Gdk.Key.Escape, 
+						     0,
+						     Gtk.AccelFlags.Visible);
+			close_button.Show ();
+
+			Gtk.HButtonBox button_box = new Gtk.HButtonBox ();
+			button_box.Layout = Gtk.ButtonBoxStyle.End;
+			button_box.Spacing = 8;
+			button_box.PackStart (keep_button);
+			button_box.PackStart (sync_button);
+			button_box.PackStart (separator);
+			button_box.PackEnd (close_button);
+			button_box.Show ();
+
+			content_vbox = new Gtk.VBox (false, 8);
+			content_vbox.BorderWidth = 6;
+			content_vbox.PackStart (hbox, false, false, 0);
+			content_vbox.PackStart (matches_window);
+			content_vbox.PackStart (button_box, false, false, 0);
+			content_vbox.Show ();
+
+			this.Add (content_vbox);
+		}
+
+		void MakeSyncTree ()
+		{
+			Type [] types = 
+				new Type [] {
+					typeof (Gdk.Pixbuf), // icon
+					typeof (string),     // title
+					typeof (string),     // local change date
+					typeof (string),     // remote change date
+					typeof (bool),       // check keep
+					typeof (bool),       // check get
+					typeof (Note),       // note
+					typeof (Note),       // note
+					typeof (string),     // real date for remote note
+				};
+
+			store = new Gtk.ListStore (types);
+			store.SetSortFunc ((int)Columns.LOCAL_DATE,
+					   new Gtk.TreeIterCompareFunc (CompareLocalDates));
+			store.SetSortFunc ((int)Columns.REMOTE_DATE,
+					   new Gtk.TreeIterCompareFunc (CompareRemoteDates));
+			//store.SetSortColumnId ((int)Columns.LOCAL_DATE, Gtk.SortType.Descending);
+
+			tree = new Gtk.TreeView (store);
+			tree.HeadersVisible = true;
+			tree.RulesHint = true;
+			tree.RowActivated += OnRowActivated;
+
+			Gtk.CellRenderer renderer;
+
+			// Column Icon+Title
+			Gtk.TreeViewColumn title = new Gtk.TreeViewColumn ();
+			title.Title = "Note";
+			title.Sizing = Gtk.TreeViewColumnSizing.Autosize;
+			title.Resizable = true;
+			
+			renderer = new Gtk.CellRendererPixbuf ();
+			title.PackStart (renderer, false);
+			title.AddAttribute (renderer, "pixbuf", (int)Columns.ICON);
+
+			renderer = new Gtk.CellRendererText ();
+			title.PackStart (renderer, true);
+			title.AddAttribute (renderer, "text", (int)Columns.TITLE);
+			title.SortColumnId = (int)Columns.TITLE;
+
+			tree.AppendColumn (title);
+
+			// Column Local Date
+			Gtk.TreeViewColumn change = MakeDateColumn (
+				Catalog.GetString ("Local Last Changed"),
+				(int)Columns.LOCAL_DATE
+				);
+			tree.AppendColumn (change);
+
+			// Column Remote Date
+			change = MakeDateColumn (
+				Catalog.GetString ("Remote Last Changed"),
+				(int)Columns.REMOTE_DATE
+				);
+			tree.AppendColumn (change);
+
+			// Action RadioButtons
+			change = new Gtk.TreeViewColumn ();
+			CellRendererToggle toggle = new CellRendererToggle();
+			toggle.Activatable = true;
+			toggle.Radio = true;
+			toggle.Toggled += OnToggleKeep;
+			tree.AppendColumn ("Keep", toggle, "active", (int)Columns.ACTION_KEEP);
+
+			toggle = new CellRendererToggle();
+			toggle.Activatable = true;
+			toggle.Radio = true;
+			toggle.Toggled += OnToggleGet;
+			tree.AppendColumn ("Get", toggle, "active", (int)Columns.ACTION_GET);
+		}
+
+		private Gtk.TreeViewColumn MakeDateColumn (string title, int column)
+		{
+			Gtk.TreeViewColumn change = new Gtk.TreeViewColumn ();
+			change.Title = title;
+			change.Sizing = Gtk.TreeViewColumnSizing.Autosize;
+			change.Resizable = true;
+
+			Gtk.CellRenderer renderer = new Gtk.CellRendererText ();
+			renderer.Data ["xalign"] = 1.0;
+			change.PackStart (renderer, false);
+			change.AddAttribute (renderer, "text", column);
+			change.SortColumnId = column;
+
+			return change;
+		}
+
+		void UpdateResults ()
+		{
+			store.Clear ();
+			Hashtable lookup = new Hashtable ();
+
+			foreach (NetworkData.SerNote ser_note in data.Notes ()) {
+				// create remote note
+				Guid guid = Guid.NewGuid ();
+			 	string tmp_file = System.IO.Path.Combine (manager.NetworkDir, 
+						guid.ToString () + ".note");
+				Note note = Note.CreateNewNote ("[Remote] "+ser_note.title, tmp_file, manager);
+				note.XmlContent = ser_note.xml;
+				manager.PluginManager.LoadPluginsForNote (note);
+
+				// find matching local note
+				lookup.Add (ser_note.title, 1);
+
+				Gtk.TreeIter iter = store.Append ();
+				store.SetValue (iter, (int)Columns.ICON, stock_notes_icon);
+				store.SetValue (iter, (int)Columns.TITLE, note.Title);
+				store.SetValue (iter, (int)Columns.REMOTE_NOTE, note);
+				store.SetValue (iter, (int)Columns.REMOTE_DATE, 
+						PrettyPrintDate (ser_note.date));
+				store.SetValue (iter, (int)Columns.REMOTE_DATETIME, ser_note.date.ToString());
+				store.SetValue (iter, (int)Columns.ACTION_GET, true);
+
+				Note local_note = manager.Find (ser_note.title);
+				if (local_note != null)
+				{
+					store.SetValue (iter, (int)Columns.TITLE, local_note.Title);
+					store.SetValue (iter, (int)Columns.LOCAL_DATE, 
+							PrettyPrintDate (local_note.ChangeDate));
+					store.SetValue (iter, (int)Columns.LOCAL_NOTE, local_note);
+					if (local_note.ChangeDate  > ser_note.date)
+					{
+						store.SetValue (iter, (int)Columns.ACTION_GET, false);
+						store.SetValue (iter, (int)Columns.ACTION_KEEP, true);
+					}
+				}
+			}
+
+			foreach (Note note in manager.Notes) {
+				if (lookup.Contains (note.Title))
+					continue;
+				Gtk.TreeIter iter = store.Append ();
+				store.SetValue (iter, (int)Columns.ICON, stock_notes_icon);
+				store.SetValue (iter, (int)Columns.TITLE, note.Title);
+				store.SetValue (iter, (int)Columns.LOCAL_DATE, 
+						PrettyPrintDate (note.ChangeDate));
+				store.SetValue (iter, (int)Columns.REMOTE_DATETIME, DateTime.MinValue.ToString());
+				store.SetValue (iter, (int)Columns.LOCAL_NOTE, note);
+				store.SetValue (iter, (int)Columns.ACTION_KEEP, true);
+			}
+		}
+
+		void OnKeepClicked (object sender, EventArgs args)
+		{
+			TreeIter iter;
+			if (store.GetIterFirst (out iter))
+				do {
+					store.SetValue (iter, (int)Columns.ACTION_GET, false);
+					store.SetValue (iter, (int)Columns.ACTION_KEEP, true);
+				} while (store.IterNext (ref iter));
+		}
+
+		void OnSyncClicked (object sender, EventArgs args)
+		{
+			TreeIter iter;
+			if (store.GetIterFirst (out iter))
+				do {
+					if ((bool) store.GetValue (iter, (int)Columns.ACTION_KEEP))
+						continue;
+
+					Note local_note = (Note) store.GetValue (iter, (int)Columns.LOCAL_NOTE);
+					Note remote_note = (Note) store.GetValue (iter, (int)Columns.REMOTE_NOTE);
+
+					if (remote_note == null)
+						continue;
+
+					if (local_note == null) 
+					{
+						// create new note
+						string title = remote_note.Title;
+						title.Replace ("[Remote] ","");
+						manager.Create (title, remote_note.XmlContent);
+					} else
+						// update local note
+						local_note.XmlContent = remote_note.XmlContent;
+
+				} while (store.IterNext (ref iter));
+		}
+
+		void OnNotesChanged (object sender, Note changed)
+		{
+			UpdateResults ();
+		}
+
+		void OnNoteRenamed (Note note, string old_title)
+		{
+			UpdateResults ();
+		}
+
+		void OnToggleKeep (object o, ToggledArgs args) {
+			Toggle (o, args, (int)Columns.ACTION_KEEP);
+		}
+
+		void OnToggleGet (object o, ToggledArgs args) {
+			TreeIter iter;
+			if (store.GetIter (out iter, new TreePath (args.Path))) {
+				Note note = (Note) store.GetValue (iter, (int)Columns.REMOTE_NOTE);
+				if (note != null)
+					Toggle (o, args, (int)Columns.ACTION_GET);
+			}
+		}
+
+		void Toggle (object o, ToggledArgs args, int n) 
+		{
+			TreeIter iter;
+
+			// toggle other radio buttons off
+			if (store.GetIter (out iter, new TreePath (args.Path))) {
+				store.SetValue (iter, (int)Columns.ACTION_GET, false);
+				store.SetValue (iter, (int)Columns.ACTION_KEEP, false);
+				store.SetValue (iter, n, true);
+			}
+		}
+
+		string PrettyPrintDate (DateTime date)
+		{
+			DateTime now = DateTime.Now;
+			string short_time = date.ToShortTimeString ();
+
+			if (date.Year == now.Year) {
+				if (date.DayOfYear == now.DayOfYear)
+					return String.Format (Catalog.GetString ("Today, {0}"), 
+							      short_time);
+				else if (date.DayOfYear == now.DayOfYear - 1)
+					return String.Format (Catalog.GetString ("Yesterday, {0}"),
+							      short_time);
+				else if (date.DayOfYear > now.DayOfYear - 6)
+					return String.Format (Catalog.GetString ("{0} days ago, {1}"), 
+							      now.DayOfYear - date.DayOfYear,
+							      short_time);
+				else
+					return date.ToString (Catalog.GetString ("MMMM d, h:mm tt"));
+			} else
+				return date.ToString (Catalog.GetString ("MMMM d yyyy, h:mm tt"));
+		}
+
+		void CloseClicked (object sender, EventArgs args)
+		{
+			Hide ();
+			Destroy ();
+		}
+
+		int CompareLocalDates (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
+		{
+			Note note_a = (Note) model.GetValue (a, (int)Columns.LOCAL_NOTE);
+			Note note_b = (Note) model.GetValue (b, (int)Columns.LOCAL_NOTE);
+
+			if (note_a == null || note_b == null)
+				return -1;
+			else
+				return DateTime.Compare (note_a.ChangeDate, note_b.ChangeDate);
+		}
+
+		int CompareRemoteDates (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
+		{
+			string str_a =	(string) model.GetValue (a, (int)Columns.REMOTE_DATETIME);
+			string str_b = (string) model.GetValue (b, (int)Columns.REMOTE_DATETIME);
+			if (str_a == null || str_b == null)
+				return -1;
+			DateTime date_a = DateTime.Parse (str_a);
+			DateTime date_b = DateTime.Parse (str_b);
+			return DateTime.Compare (date_a, date_b);
+		}
+
+		void OnRowActivated (object sender, Gtk.RowActivatedArgs args)
+		{
+			Gtk.TreeIter iter;
+			if (!store.GetIter (out iter, args.Path)) 
+				return;
+
+			// Select if we want to open remote or local note
+			// FIXME can't add buttons to treeview ...
+
+			cur_lnote = (Note) store.GetValue (iter, (int)Columns.LOCAL_NOTE);
+			cur_rnote = (Note) store.GetValue (iter, (int)Columns.REMOTE_NOTE);
+
+			Gtk.Menu menu = new Gtk.Menu ();
+			Gtk.ImageMenuItem item;
+
+			item = new Gtk.ImageMenuItem (Catalog.GetString ("Show _Local Note"));
+			item.Image = new Gtk.Image (Stock.Open, Gtk.IconSize.Menu);
+			item.Activated += ShowLocalNote;
+			menu.Append (item);
+
+			item = new Gtk.ImageMenuItem (Catalog.GetString ("Show _Remote Note"));
+			item.Image = new Gtk.Image (Stock.Refresh, Gtk.IconSize.Menu);
+			item.Activated += ShowRemoteNote;
+			menu.Append (item);
+
+			item = new Gtk.ImageMenuItem (Catalog.GetString ("Show _Both Notes"));
+			item.Image = new Gtk.Image (Stock.Refresh, Gtk.IconSize.Menu);
+			item.Activated += ShowBothNotes;
+			menu.Append (item);
+
+			menu.ShowAll ();
+			menu.Popup ();
+			args.RetVal = true;
+		}
+
+		void ShowRemoteNote (object sender, EventArgs args)
+		{
+			if (cur_rnote != null)
+				cur_rnote.Window.Show ();
+		}
+
+		void ShowLocalNote (object sender, EventArgs args)
+		{
+			if (cur_lnote != null)
+				cur_lnote.Window.Present ();
+		}
+		void ShowBothNotes (object sender, EventArgs args)
+		{
+			ShowLocalNote (sender, args);
+			ShowRemoteNote (sender, args);
+		}
+	}
+}
Index: Tomboy/NoteManager.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/NoteManager.cs,v
retrieving revision 1.28
diff -U3 -r1.28 NoteManager.cs
--- Tomboy/NoteManager.cs	24 Jul 2006 09:12:02 -0000	1.28
+++ Tomboy/NoteManager.cs	24 Jul 2006 21:15:34 -0000
@@ -12,8 +12,10 @@
 	{
 		string notes_dir;
 		string backup_dir;
+		string network_dir;
 		ArrayList notes;
 		PluginManager plugin_mgr;
+		NetworkManager network_mgr;
 		TrieController trie_controller;
 
 		public NoteManager () : 
@@ -46,9 +48,19 @@
 				LoadNotes ();
 			}
 
+            // 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;
 		}
 
+        public string NetworkDir { get { return network_dir; } }
+
 		// Create & populate the Plugins dir. For overriding in test
 		// methods.
 		protected virtual PluginManager CreatePluginManager ()
@@ -148,6 +160,9 @@
 
 		void OnExitingEvent (object sender, EventArgs args)
 		{
+            // Shutdown network
+            network_mgr.Shutdown ();
+
 			Logger.Log ("Saving unsaved notes...");
 
 			foreach (Note note in notes) {
@@ -335,6 +350,13 @@
 		{
 			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.7
diff -U3 -r1.7 Preferences.cs
--- Tomboy/Preferences.cs	24 Jul 2006 07:26:57 -0000	1.7
+++ Tomboy/Preferences.cs	24 Jul 2006 21:15:34 -0000
@@ -23,6 +23,12 @@
 		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 @@
 			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 @@
 	public class PreferencesDialog : Gtk.Dialog
 	{
 		Gtk.Button font_button;
+		Gtk.CheckButton avahi_check;
 		Gtk.Label font_face;
 		Gtk.Label font_size;
 
@@ -136,6 +158,9 @@
 			notebook.AppendPage (MakeHotkeysPane (), 
 					     new Gtk.Label (Catalog.GetString ("Hotkeys")));
 
+            notebook.AppendPage (MakeNetworkPane (),
+                         new Gtk.Label (Catalog.GetString ("Network")));
+
 			VBox.PackStart (notebook, true, true, 0);
 
 
@@ -369,6 +394,71 @@
 			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
@@ -445,5 +535,15 @@
 							  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.4
diff -U3 -r1.4 tomboy.schemas.in
--- data/tomboy.schemas.in	27 May 2006 01:58:25 -0000	1.4
+++ data/tomboy.schemas.in	24 Jul 2006 21:15:35 -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>
