mac: only use notification center on Mountain Lion and above
This commit is contained in:
parent
6e35c81422
commit
621712a436
|
@ -31,6 +31,10 @@ namespace SparkleShare {
|
||||||
public SparkleBubbles ()
|
public SparkleBubbles ()
|
||||||
{
|
{
|
||||||
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
|
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 {
|
InvokeOnMainThread (delegate {
|
||||||
NSUserNotification notification = new NSUserNotification () {
|
NSUserNotification notification = new NSUserNotification () {
|
||||||
Title = title,
|
Title = title,
|
||||||
|
@ -39,7 +43,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
|
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
|
||||||
center.ShouldPresentNotification = (c, n) => { return true; };
|
center.ShouldPresentNotification = delegate { return true; };
|
||||||
|
|
||||||
center.DidActivateNotification += delegate {
|
center.DidActivateNotification += delegate {
|
||||||
Controller.BubbleClicked ();
|
Controller.BubbleClicked ();
|
||||||
|
|
|
@ -166,6 +166,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override void OpenFolder (string path)
|
public override void OpenFolder (string path)
|
||||||
{
|
{
|
||||||
|
path = Uri.UnescapeDataString (path);
|
||||||
NSWorkspace.SharedWorkspace.OpenFile (path);
|
NSWorkspace.SharedWorkspace.OpenFile (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue