[banshee] [help] Add Help -> Help menu item



commit b1d2d8949a6cee0940ebba776e1c61dd7a67c376
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Aug 10 17:07:49 2010 -0700

    [help] Add Help -> Help menu item

 .../Banshee.ServiceStack/Application.cs            |   27 ++++++++++++++++++++
 src/Core/Banshee.Services/Makefile.am              |    2 +
 .../Banshee.Gui/GlobalActions.cs                   |    3 ++
 .../Resources/core-ui-actions-layout.xml           |    1 +
 4 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
index 25a4b8e..5ec65c9 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
@@ -169,6 +169,33 @@ namespace Banshee.ServiceStack
             }
         }
 
+        [DllImport ("libglib-2.0-0.dll")]
+        static extern IntPtr g_get_language_names ();
+
+        public static void DisplayHelp (string page)
+        {
+            DisplayHelp ("banshee", page);
+        }
+
+        private static void DisplayHelp (string project, string page)
+        {
+            bool shown = false;
+
+            foreach (var lang in GLib.Marshaller.NullTermPtrToStringArray (g_get_language_names (), false)) {
+                string path = String.Format ("{0}/gnome/help/{1}/{2}",
+                    Paths.InstalledApplicationDataRoot, project, lang);
+
+                if (System.IO.Directory.Exists (path)) {
+                    shown = Banshee.Web.Browser.Open (String.Format ("ghelp:/{0}", path), false);
+                    break;
+                }
+            }
+
+            if (!shown) {
+                Banshee.Web.Browser.Open (String.Format ("http://library.gnome.org/users/{0}/{1}/";, project, Version));
+            }
+        }
+
         private static bool OnShutdownRequested ()
         {
             ShutdownRequestHandler handler = ShutdownRequested;
diff --git a/src/Core/Banshee.Services/Makefile.am b/src/Core/Banshee.Services/Makefile.am
index 89c6189..10ea428 100644
--- a/src/Core/Banshee.Services/Makefile.am
+++ b/src/Core/Banshee.Services/Makefile.am
@@ -230,3 +230,5 @@ module_DATA = Banshee.Services.addins
 
 include $(top_srcdir)/build/build.mk
 
+EXTRA_DIST += Banshee.Services.dll.config
+module_SCRIPTS += Banshee.Services.dll.config
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
index 8a9f6c4..d1e4b5b 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GlobalActions.cs
@@ -91,6 +91,9 @@ namespace Banshee.Gui
                 new ActionEntry ("HelpMenuAction", null,
                     Catalog.GetString ("_Help"), null, null, null),
 
+                new ActionEntry ("UserHelp", Gtk.Stock.Help,
+                    null, null, null, delegate { Banshee.ServiceStack.Application.DisplayHelp (null); }),
+
                 new ActionEntry ("WebMenuAction", null,
                     Catalog.GetString ("_Web Resources"), null, null, null),
 
diff --git a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
index b155bff..77ce3b9 100644
--- a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
+++ b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
@@ -115,6 +115,7 @@
     </menu>
 
     <menu name="HelpMenu" action="HelpMenuAction">
+      <menuitem action="UserHelp"/>
       <menu name="WebMenu" action="WebMenuAction">
         <menuitem name="WikiGuide" action="WikiGuideAction"/>
         <menuitem name="WikiSearchHelp" action="WikiSearchHelpAction"/>



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