diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2010-01-22 10:20:42 +0300 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2010-01-22 10:20:42 +0300 |
commit | 743fb05a412c01ea9cd22a07efbfbeb922d0c3ba (patch) | |
tree | 67643f260668fdb213c17674fae13564545833ec /docbrowser | |
parent | f4267d1e9fb2ef687c934485b9ed5459257f00a9 (diff) |
Enable the IGE main menu and global key handlers
svn path=/trunk/mono-tools/; revision=150045
Diffstat (limited to 'docbrowser')
-rw-r--r-- | docbrowser/browser.cs | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/docbrowser/browser.cs b/docbrowser/browser.cs index 6033a5be..2b26ec37 100644 --- a/docbrowser/browser.cs +++ b/docbrowser/browser.cs @@ -292,7 +292,11 @@ public class Browser { public Browser (string basedir, IEnumerable<string> sources, string engine) { #if MACOS - InitMacAppHandlers(); + try { + InitMacAppHandlers(); + } catch (Exception ex) { + Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex); + } #endif this.engine = engine; @@ -400,17 +404,27 @@ public class Browser { index_browser = IndexBrowser.MakeIndexBrowser (this); MainWindow.ShowAll(); -#if false && MACOS - ((MenuBar)ui["menubar1"]).Hide (); - IgeMacIntegration.IgeMacMenu.MenuBar = (MenuBar) ui["menubar1"]; - IgeMacIntegration.IgeMacMenu.QuitMenuItem = (MenuItem) ui["quit1"]; - var appGroup = IgeMacIntegration.IgeMacMenu.AddAppMenuGroup (); - appGroup.AddMenuItem ((MenuItem)ui["quit1"], null); - appGroup.AddMenuItem ((MenuItem)ui["about1"], null); +#if MACOS + try { + InstallMacMainMenu (); + ((MenuBar)ui["menubar1"]).Hide (); + } catch (Exception ex) { + Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex); + } #endif } #if MACOS + void InstallMacMainMenu () + { + IgeMacIntegration.IgeMacMenuGlobal.SetGlobalKeyHandlerEnabled (true); + IgeMacIntegration.IgeMacMenu.MenuBar = (MenuBar) ui["menubar1"]; + IgeMacIntegration.IgeMacMenu.QuitMenuItem = (MenuItem) ui["quit1"]; + var appGroup = IgeMacIntegration.IgeMacMenu.AddAppMenuGroup (); + appGroup.AddMenuItem ((MenuItem)ui["quit1"], null); + appGroup.AddMenuItem ((MenuItem)ui["about1"], null); + } + void InitMacAppHandlers () { ApplicationEvents.Quit += delegate (object sender, ApplicationEventArgs e) { |