diff --git a/SparkleShare/Mac/SparkleShare/SparkleLog.cs b/SparkleShare/Mac/SparkleShare/SparkleLog.cs index e666792a..a5203ebe 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleLog.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleLog.cs @@ -32,12 +32,13 @@ namespace SparkleShare { private NSButton CloseButton; private NSButton OpenFolderButton; - + public SparkleLog (string path) : base () { LocalPath = path; + Delegate = new LogDelegate (); SetFrame (new RectangleF (0, 0, 480, 640), true); @@ -73,7 +74,9 @@ namespace SparkleShare { }; CloseButton.Activated += delegate { - PerformClose (this); + InvokeOnMainThread (delegate { + PerformClose (this); + }); }; ContentView.AddSubview (CloseButton); @@ -82,23 +85,10 @@ namespace SparkleShare { string name = System.IO.Path.GetFileName (LocalPath); Title = String.Format ("Recent Events in ‘{0}’", name); - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - MakeKeyAndOrderFront (this); + OrderFrontRegardless (); } - - public override void PerformClose (NSObject sender) - { - - InvokeOnMainThread (delegate { - Console.WriteLine ("!!!!!!!!!!"); - SparkleUI.OpenLogs.Remove ((SparkleLog) this); - base.PerformClose (this); - }); - - } - public void UpdateEventLog () { @@ -119,5 +109,19 @@ namespace SparkleShare { } } + + + public class LogDelegate : NSWindowDelegate { + + public override void WillClose (NSNotification notification) + { + + Console.WriteLine ("CLOSING " + (notification.Object as SparkleLog).LocalPath); + + SparkleUI.OpenLogs.Remove ((SparkleLog) notification.Object); + + } + + } } diff --git a/SparkleShare/Mac/SparkleShare/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare/SparkleShare.csproj index bc6e4845..cc4f415f 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare/SparkleShare.csproj @@ -81,6 +81,7 @@ + Pixmaps\side-splash.png @@ -94,7 +95,4 @@ - - - \ No newline at end of file diff --git a/SparkleShare/Mac/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleShare/SparkleStatusIcon.cs index a279f94f..75c66227 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleStatusIcon.cs @@ -270,15 +270,16 @@ namespace SparkleShare { return delegate { - SparkleLog log = SparkleUI.OpenLogs.Find (delegate (SparkleLog l) { return l.LocalPath.Equals (path); }); - + SparkleLog log = SparkleUI.OpenLogs.Find (delegate (SparkleLog l) { + return l.LocalPath.Equals (path); + }); + // Check whether the log is already open, create a new one if // that's not the case or present it to the user if it is - if (log == null) { - + if (log == null) SparkleUI.OpenLogs.Add (new SparkleLog (path)); - - } + else + log.OrderFrontRegardless (); }; diff --git a/SparkleShare/Mac/SparkleShare/SparkleUI.cs b/SparkleShare/Mac/SparkleShare/SparkleUI.cs index 598cee4c..adb7913c 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleUI.cs @@ -43,7 +43,7 @@ namespace SparkleShare { NSApplication.Init (); NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - //NSApplication.SharedApplication.applicationIconImage = new NSImage (NSBundle.MainBundle.ResourcePath + "/Pixmaps/sparkeshare.icns"); + NSApplication.SharedApplication.applicationIconImage = new NSImage (NSBundle.MainBundle.ResourcePath + "/Pixmaps/sparkeshare.icns"); OpenLogs = new List (); StatusIcon = new SparkleStatusIcon ();