mac: only use notification center on Mountain Lion and above

This commit is contained in:
Hylke Bons 2012-11-05 23:07:35 +00:00
parent 6e35c81422
commit 621712a436
2 changed files with 34 additions and 29 deletions

View file

@ -31,6 +31,10 @@ namespace SparkleShare {
public SparkleBubbles ()
{
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
// Notification center was introduced in Mountain Lion
if (Environment.OSVersion.Version.Major < 12)
return;
InvokeOnMainThread (delegate {
NSUserNotification notification = new NSUserNotification () {
Title = title,
@ -39,7 +43,7 @@ namespace SparkleShare {
};
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
center.ShouldPresentNotification = (c, n) => { return true; };
center.ShouldPresentNotification = delegate { return true; };
center.DidActivateNotification += delegate {
Controller.BubbleClicked ();

View file

@ -166,6 +166,7 @@ namespace SparkleShare {
public override void OpenFolder (string path)
{
path = Uri.UnescapeDataString (path);
NSWorkspace.SharedWorkspace.OpenFile (path);
}