[osx] Implement elegant log window managing
This commit is contained in:
parent
87f53cc30c
commit
7502358d69
|
@ -38,6 +38,7 @@ namespace SparkleShare {
|
|||
|
||||
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,20 +85,7 @@ namespace SparkleShare {
|
|||
string name = System.IO.Path.GetFileName (LocalPath);
|
||||
Title = String.Format ("Recent Events in ‘{0}’", name);
|
||||
|
||||
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
|
||||
MakeKeyAndOrderFront (this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void PerformClose (NSObject sender)
|
||||
{
|
||||
|
||||
InvokeOnMainThread (delegate {
|
||||
Console.WriteLine ("!!!!!!!!!!");
|
||||
SparkleUI.OpenLogs.Remove ((SparkleLog) this);
|
||||
base.PerformClose (this);
|
||||
});
|
||||
OrderFrontRegardless ();
|
||||
|
||||
}
|
||||
|
||||
|
@ -120,4 +110,18 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
<Content Include="Pixmaps\idle3.png" />
|
||||
<Content Include="Pixmaps\sparkleshare-idle.png" />
|
||||
<Content Include="Pixmaps\sparkleshare-idle-focus.png" />
|
||||
<Content Include="Pixmaps\sparkleshare.icns" />
|
||||
<Content Include="..\..\..\data\side-splash.png">
|
||||
<Link>Pixmaps\side-splash.png</Link>
|
||||
</Content>
|
||||
|
@ -94,7 +95,4 @@
|
|||
<ItemGroup>
|
||||
<Folder Include="Pixmaps\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Pixmaps\sparkleshare.icns" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -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 ();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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 <SparkleLog> ();
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
|
|
Loading…
Reference in a new issue