Code cleanup
This commit is contained in:
parent
7155c3e816
commit
10fd77a9b8
|
@ -57,6 +57,8 @@ namespace SparkleShare {
|
||||||
OrderFrontRegardless ();
|
OrderFrontRegardless ();
|
||||||
MakeKeyAndOrderFront (this);
|
MakeKeyAndOrderFront (this);
|
||||||
|
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
|
|
||||||
Controller.NewVersionEvent += delegate (string new_version) {
|
Controller.NewVersionEvent += delegate (string new_version) {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!";
|
UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!";
|
||||||
|
@ -161,6 +163,8 @@ namespace SparkleShare {
|
||||||
public override bool WindowShouldClose (NSObject sender)
|
public override bool WindowShouldClose (NSObject sender)
|
||||||
{
|
{
|
||||||
(sender as SparkleAbout).OrderOut (this);
|
(sender as SparkleAbout).OrderOut (this);
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ using MonoMac.WebKit;
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleEventLog : NSWindow {
|
public class SparkleEventLog : NSWindow {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
||||||
|
|
||||||
|
@ -53,7 +51,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// TODO: Window needs to be made resizable
|
// TODO: Window needs to be made resizable
|
||||||
public SparkleEventLog () : base ()
|
public SparkleEventLog () : base ()
|
||||||
{
|
{
|
||||||
Title = "Recent Events";
|
Title = "Recent Events";
|
||||||
Delegate = new SparkleEventsDelegate ();
|
Delegate = new SparkleEventsDelegate ();
|
||||||
|
|
||||||
|
@ -132,6 +130,7 @@ namespace SparkleShare {
|
||||||
UpdateChooser (null);
|
UpdateChooser (null);
|
||||||
OrderFrontRegardless ();
|
OrderFrontRegardless ();
|
||||||
|
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
|
|
||||||
// Hook up the controller events
|
// Hook up the controller events
|
||||||
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||||
|
@ -242,6 +241,8 @@ namespace SparkleShare {
|
||||||
public override bool WindowShouldClose (NSObject sender)
|
public override bool WindowShouldClose (NSObject sender)
|
||||||
{
|
{
|
||||||
(sender as SparkleEventLog).OrderOut (this);
|
(sender as SparkleEventLog).OrderOut (this);
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ namespace SparkleShare {
|
||||||
MakeKeyAndOrderFront (this);
|
MakeKeyAndOrderFront (this);
|
||||||
|
|
||||||
OrderFrontRegardless ();
|
OrderFrontRegardless ();
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,6 +146,8 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
base.OrderOut (this);
|
base.OrderOut (this);
|
||||||
NSApplication.SharedApplication.RemoveWindowsItem (this);
|
NSApplication.SharedApplication.RemoveWindowsItem (this);
|
||||||
|
Program.UI.UpdateDockIconVisibility ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
SparkleShare/Mac/SparkleShare.csproj
Normal file → Executable file
4
SparkleShare/Mac/SparkleShare.csproj
Normal file → Executable file
|
@ -6,7 +6,7 @@
|
||||||
<ProductVersion>10.0.0</ProductVersion>
|
<ProductVersion>10.0.0</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}</ProjectGuid>
|
<ProjectGuid>{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{1C533B1C-72DD-4CB1-9F6B-BF11D93BCFBE};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>SparkleShare</RootNamespace>
|
<RootNamespace>SparkleShare</RootNamespace>
|
||||||
<AssemblyName>SparkleShare</AssemblyName>
|
<AssemblyName>SparkleShare</AssemblyName>
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<InterfaceDefinition Include="MainMenu.xib" xmlns="" />
|
<Page Include="MainMenu.xib" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Info.plist" />
|
<None Include="Info.plist" />
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace SparkleShare {
|
||||||
private NSMenuItem AboutMenuItem;
|
private NSMenuItem AboutMenuItem;
|
||||||
private NSMenuItem NotificationsMenuItem;
|
private NSMenuItem NotificationsMenuItem;
|
||||||
private NSMenuItem RecentEventsMenuItem;
|
private NSMenuItem RecentEventsMenuItem;
|
||||||
private NSMenuItem QuitAppMenuItem;
|
private NSMenuItem QuitMenuItem;
|
||||||
private NSImage [] AnimationFrames;
|
private NSImage [] AnimationFrames;
|
||||||
private NSImage [] AnimationFramesActive;
|
private NSImage [] AnimationFramesActive;
|
||||||
private NSImage ErrorImage;
|
private NSImage ErrorImage;
|
||||||
|
@ -252,9 +252,6 @@ namespace SparkleShare {
|
||||||
if (Controller.Folders.Length > 0) {
|
if (Controller.Folders.Length > 0) {
|
||||||
RecentEventsMenuItem.Activated += delegate {
|
RecentEventsMenuItem.Activated += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
//Show the icon in Dock
|
|
||||||
Program.UI.SetRegularActivationPolicy();
|
|
||||||
|
|
||||||
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
|
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
|
||||||
|
|
||||||
if (SparkleUI.EventLog == null)
|
if (SparkleUI.EventLog == null)
|
||||||
|
@ -312,21 +309,17 @@ namespace SparkleShare {
|
||||||
Menu.AddItem (NSMenuItem.SeparatorItem);
|
Menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
|
||||||
QuitAppMenuItem = new NSMenuItem () {
|
QuitMenuItem = new NSMenuItem () {
|
||||||
Title = "Quit SparkleShare",
|
Title = "Quit",
|
||||||
Enabled = true
|
Enabled = true
|
||||||
};
|
};
|
||||||
|
|
||||||
QuitAppMenuItem.Activated += delegate {
|
QuitMenuItem.Activated += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
Program.Controller.Quit ();
|
||||||
NSApplication.SharedApplication.Terminate(this);
|
};
|
||||||
|
|
||||||
|
Menu.AddItem (QuitMenuItem);
|
||||||
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Menu.AddItem (QuitAppMenuItem);
|
|
||||||
|
|
||||||
StatusItem.Menu = Menu;
|
StatusItem.Menu = Menu;
|
||||||
StatusItem.Menu.Update ();
|
StatusItem.Menu.Update ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,6 @@ namespace SparkleShare {
|
||||||
Bubbles = new SparkleBubbles ();
|
Bubbles = new SparkleBubbles ();
|
||||||
|
|
||||||
if (Program.Controller.FirstRun) {
|
if (Program.Controller.FirstRun) {
|
||||||
//Show Icon in Dock
|
|
||||||
this.SetRegularActivationPolicy();
|
|
||||||
Setup = new SparkleSetup ();
|
Setup = new SparkleSetup ();
|
||||||
Setup.Controller.ShowSetupPage ();
|
Setup.Controller.ShowSetupPage ();
|
||||||
}
|
}
|
||||||
|
@ -92,11 +90,29 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
NSApplication.Main (new string [0]);
|
NSApplication.Main (new string [0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRegularActivationPolicy()
|
|
||||||
{
|
public void UpdateDockIconVisibility ()
|
||||||
NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;
|
{
|
||||||
}
|
if (true) { // TODO: check for open windows
|
||||||
|
|
||||||
|
ShowDockIcon ();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
HideDockIcon ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void HideDockIcon () {
|
||||||
|
// Currently not supported, here for completeness sake (see Apple's docs)
|
||||||
|
// NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ShowDockIcon () {
|
||||||
|
NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[Export("registrationDictionaryForGrowl")]
|
[Export("registrationDictionaryForGrowl")]
|
||||||
|
|
Loading…
Reference in a new issue