[tomboy] Make mallard help actually work



commit c0b1f136f88b59b610512bf8932475c32586a2da
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon Jun 28 12:01:33 2010 -0700

    Make mallard help actually work

 Tomboy/Addins/Tasks/TaskListWindow.cs |    2 +-
 Tomboy/Applet.cs                      |    2 +-
 Tomboy/GnomeApplication.cs            |   21 +++++++++++++++++++--
 Tomboy/MacApplication.cs              |    5 ++---
 Tomboy/NativeApplication.cs           |    2 +-
 Tomboy/NoteWindow.cs                  |    2 +-
 Tomboy/Tomboy.cs                      |    2 +-
 Tomboy/Utils.cs                       |    5 +++--
 Tomboy/WindowsApplication.cs          |    5 ++---
 9 files changed, 31 insertions(+), 15 deletions(-)
---
diff --git a/Tomboy/Addins/Tasks/TaskListWindow.cs b/Tomboy/Addins/Tasks/TaskListWindow.cs
index 25a236a..dfd4f33 100644
--- a/Tomboy/Addins/Tasks/TaskListWindow.cs
+++ b/Tomboy/Addins/Tasks/TaskListWindow.cs
@@ -758,7 +758,7 @@ enum SortColumn :
 
 		void OnShowHelp (object sender, EventArgs args)
 		{
-			GuiUtils.ShowHelp ("tomboy.xml", "tasks", Screen, this);
+			GuiUtils.ShowHelp ("tomboy", "tasks", Screen, this);
 		}
 
 		void OnCloseWindow (object sender, EventArgs args)
diff --git a/Tomboy/Applet.cs b/Tomboy/Applet.cs
index 6905f9d..41e2e41 100644
--- a/Tomboy/Applet.cs
+++ b/Tomboy/Applet.cs
@@ -97,7 +97,7 @@ namespace Tomboy
 		{
 			// Don't use the ActionManager in this case because
 			// the handler won't know about the Screen.
-			GuiUtils.ShowHelp ("ghelp:tomboy", Screen, null);
+			GuiUtils.ShowHelp ("tomboy", null, Screen, null);
 		}
 
 		void ShowAboutVerb ()
diff --git a/Tomboy/GnomeApplication.cs b/Tomboy/GnomeApplication.cs
index 756b6b3..70efc6d 100644
--- a/Tomboy/GnomeApplication.cs
+++ b/Tomboy/GnomeApplication.cs
@@ -181,10 +181,27 @@ namespace Tomboy
 		{
 			GtkBeans.Global.ShowUri (screen, url);
 		}
+
+		[DllImport ("glib-2.0.dll")]
+		static extern IntPtr g_get_language_names ();
 		
-		public void DisplayHelp (string help_uri, Gdk.Screen screen)
+		public void DisplayHelp (string project, string page, Gdk.Screen screen)
 		{
-			GtkBeans.Global.ShowUri (screen, help_uri);
+			string helpUrl = string.Format("http://library.gnome.org/users/{0}/";, project);
+
+			var langsPtr = g_get_language_names ();
+			var langs = GLib.Marshaller.NullTermPtrToStringArray (langsPtr, false);
+			var baseHelpDir = Path.Combine (Path.Combine (Defines.DATADIR, "gnome/help"), project);
+			if (Directory.Exists (baseHelpDir)) {
+				foreach (var lang in langs) {
+					var langHelpDir = Path.Combine (baseHelpDir, lang);
+					if (Directory.Exists (langHelpDir))
+						// TODO:Support page
+						helpUrl = String.Format ("ghelp://{0}", langHelpDir);
+				}
+			}
+
+			OpenUrl (helpUrl, screen);
 		}
 		
 		public string DataDirectory {
diff --git a/Tomboy/MacApplication.cs b/Tomboy/MacApplication.cs
index aafe302..e33e611 100644
--- a/Tomboy/MacApplication.cs
+++ b/Tomboy/MacApplication.cs
@@ -286,10 +286,9 @@ namespace Tomboy
 			system ("open \"" + url + "\"");
 		}
 
-		public virtual void DisplayHelp (string help_uri, Gdk.Screen screen)
+		public virtual void DisplayHelp (string project, string page, Gdk.Screen screen)
 		{
-			Match version = Regex.Match (Defines.VERSION, @"^\d+\.\d+");
-			OpenUrl (string.Format ("http://library.gnome.org/users/tomboy/{0}/";, version.Value), screen);
+			OpenUrl (string.Format("http://library.gnome.org/users/{0}/";, project), screen);
 		}
 
 		#endregion
diff --git a/Tomboy/NativeApplication.cs b/Tomboy/NativeApplication.cs
index 6a9dca9..acfc5d5 100644
--- a/Tomboy/NativeApplication.cs
+++ b/Tomboy/NativeApplication.cs
@@ -30,6 +30,6 @@ namespace Tomboy
 
 		void OpenUrl (string url, Gdk.Screen screen);
 
-		void DisplayHelp (string help_uri, Gdk.Screen screen);
+		void DisplayHelp (string project, string page, Gdk.Screen screen);
 	}
 }
diff --git a/Tomboy/NoteWindow.cs b/Tomboy/NoteWindow.cs
index 890f07e..0f931c0 100644
--- a/Tomboy/NoteWindow.cs
+++ b/Tomboy/NoteWindow.cs
@@ -689,7 +689,7 @@ namespace Tomboy
 
 		void OpenHelpActivate (object sender, EventArgs args)
 		{
-			GuiUtils.ShowHelp ("ghelp:tomboy?editing-notes", Screen, this);
+			GuiUtils.ShowHelp ("tomboy", "editing-notes", Screen, this);
 		}
 
 		void CreateNewNote (object sender, EventArgs args)
diff --git a/Tomboy/Tomboy.cs b/Tomboy/Tomboy.cs
index 3b2b099..500c091 100644
--- a/Tomboy/Tomboy.cs
+++ b/Tomboy/Tomboy.cs
@@ -331,7 +331,7 @@ namespace Tomboy
 				tray_icon.GetGeometry (out screen, out area, out orientation);
 #endif
 			}
-			GuiUtils.ShowHelp ("ghelp:tomboy", screen, null);
+			GuiUtils.ShowHelp ("tomboy", null, screen, null);
 
 		}
 
diff --git a/Tomboy/Utils.cs b/Tomboy/Utils.cs
index 54e190a..52a9c6d 100644
--- a/Tomboy/Utils.cs
+++ b/Tomboy/Utils.cs
@@ -132,12 +132,13 @@ namespace Tomboy
 			return MakeImageButton (image, label);
 		}
 
-		public static void ShowHelp (string help_uri,
+		public static void ShowHelp (string project,
+		                             string page,
 		                             Gdk.Screen screen,
 		                             Gtk.Window parent)
 		{
 			try {
-				Services.NativeApplication.DisplayHelp (help_uri, screen);
+				Services.NativeApplication.DisplayHelp (project, page, screen);
 			} catch {
 				string message =
 					Catalog.GetString ("The \"Tomboy Notes Manual\" could " +
diff --git a/Tomboy/WindowsApplication.cs b/Tomboy/WindowsApplication.cs
index 6fa43d7..620a143 100644
--- a/Tomboy/WindowsApplication.cs
+++ b/Tomboy/WindowsApplication.cs
@@ -118,10 +118,9 @@ namespace Tomboy
 			}
 		}
 
-		public virtual void DisplayHelp (string help_uri, Gdk.Screen screen)
+		public virtual void DisplayHelp (string project, string page, Gdk.Screen screen)
 		{
-			Match version = Regex.Match (Defines.VERSION, @"^\d+\.\d+");
-			OpenUrl (string.Format("http://library.gnome.org/users/tomboy/{0}/";, version.Value), screen);
+			OpenUrl (string.Format("http://library.gnome.org/users/{0}/";, project), screen);
 		}
 
 		#endregion



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]