From f0af9bf24fcb1f9fbab7b1cfdaaef6a9b0d230ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Laval?= Date: Tue, 11 Dec 2012 10:05:03 +0100 Subject: [macdoc] Check for lion or better --- AppDelegate.cs | 7 ++++--- WebViewExtraordinaire.cs | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/AppDelegate.cs b/AppDelegate.cs index 2a43a8c..f612061 100644 --- a/AppDelegate.cs +++ b/AppDelegate.cs @@ -65,10 +65,11 @@ namespace macdoc ExtractImages (); controller = new MonodocDocumentController (); - // Some UI feature we use rely on Lion, so special case it + // Some UI feature we use rely on Lion or better, so special case it try { var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist"); - isOnLion = version.ObjectForKey (new NSString ("ProductVersion")).ToString ().StartsWith ("10.7"); + var osxVersion = Version.Parse (version.ObjectForKey (new NSString ("ProductVersion")).ToString ()); + isOnLion = osxVersion.Major == 10 && osxVersion.Minor >= 7; } catch {} // Load documentation @@ -171,7 +172,7 @@ namespace macdoc private set; } - public static bool IsOnLion { + public static bool IsOnLionOrBetter { get { return isOnLion; } diff --git a/WebViewExtraordinaire.cs b/WebViewExtraordinaire.cs index dc004a4..b5ac6d2 100644 --- a/WebViewExtraordinaire.cs +++ b/WebViewExtraordinaire.cs @@ -43,7 +43,7 @@ namespace macdoc void Initialize () { // The initializations we do here are Lion-specific - if (!AppDelegate.IsOnLion) + if (!AppDelegate.IsOnLionOrBetter) return; findBarController = new FindBarExtraordinaireController (); IsSwipeEnabled = NSEvent.IsSwipeTrackingFromScrollEventsEnabled; @@ -83,7 +83,7 @@ namespace macdoc public override bool AcceptsFirstResponder () { - return AppDelegate.IsOnLion; + return AppDelegate.IsOnLionOrBetter; } void FireSwipeEvent (SwipeSide side) @@ -102,7 +102,7 @@ namespace macdoc public override void PerformFindPanelAction (NSObject sender) { - if (!AppDelegate.IsOnLion) + if (!AppDelegate.IsOnLionOrBetter) return; var ctrl = sender as NSMenuItem; -- cgit v1.2.3