diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/SparkleAbout.cs
index 64a3fc93..27d5715b 100755
--- a/SparkleShare/Mac/SparkleAbout.cs
+++ b/SparkleShare/Mac/SparkleAbout.cs
@@ -57,6 +57,8 @@ namespace SparkleShare {
OrderFrontRegardless ();
MakeKeyAndOrderFront (this);
+ Program.UI.UpdateDockIconVisibility ();
+
Controller.NewVersionEvent += delegate (string new_version) {
InvokeOnMainThread (delegate {
UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!";
@@ -161,6 +163,8 @@ namespace SparkleShare {
public override bool WindowShouldClose (NSObject sender)
{
(sender as SparkleAbout).OrderOut (this);
+ Program.UI.UpdateDockIconVisibility ();
+
return false;
}
}
diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs
index ad9c40ab..38af8234 100755
--- a/SparkleShare/Mac/SparkleEventLog.cs
+++ b/SparkleShare/Mac/SparkleEventLog.cs
@@ -28,8 +28,6 @@ using MonoMac.WebKit;
namespace SparkleShare {
public class SparkleEventLog : NSWindow {
-
-
public SparkleEventLogController Controller = new SparkleEventLogController ();
@@ -53,7 +51,7 @@ namespace SparkleShare {
// TODO: Window needs to be made resizable
public SparkleEventLog () : base ()
- {
+ {
Title = "Recent Events";
Delegate = new SparkleEventsDelegate ();
@@ -132,6 +130,7 @@ namespace SparkleShare {
UpdateChooser (null);
OrderFrontRegardless ();
+ Program.UI.UpdateDockIconVisibility ();
// Hook up the controller events
Controller.UpdateChooserEvent += delegate (string [] folders) {
@@ -242,6 +241,8 @@ namespace SparkleShare {
public override bool WindowShouldClose (NSObject sender)
{
(sender as SparkleEventLog).OrderOut (this);
+ Program.UI.UpdateDockIconVisibility ();
+
return false;
}
}
diff --git a/SparkleShare/Mac/SparkleSetupWindow.cs b/SparkleShare/Mac/SparkleSetupWindow.cs
index e2bfa0c0..4aa27f42 100755
--- a/SparkleShare/Mac/SparkleSetupWindow.cs
+++ b/SparkleShare/Mac/SparkleSetupWindow.cs
@@ -87,6 +87,7 @@ namespace SparkleShare {
MakeKeyAndOrderFront (this);
OrderFrontRegardless ();
+ Program.UI.UpdateDockIconVisibility ();
}
@@ -145,6 +146,8 @@ namespace SparkleShare {
{
base.OrderOut (this);
NSApplication.SharedApplication.RemoveWindowsItem (this);
+ Program.UI.UpdateDockIconVisibility ();
+
return;
}
diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj
old mode 100644
new mode 100755
index 02ce4513..f7b1d6f1
--- a/SparkleShare/Mac/SparkleShare.csproj
+++ b/SparkleShare/Mac/SparkleShare.csproj
@@ -6,7 +6,7 @@
10.0.0
2.0
{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}
- {948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {1C533B1C-72DD-4CB1-9F6B-BF11D93BCFBE};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
Exe
SparkleShare
SparkleShare
@@ -116,7 +116,7 @@
-
+
diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs
index 530151df..d2d4a9cd 100755
--- a/SparkleShare/Mac/SparkleStatusIcon.cs
+++ b/SparkleShare/Mac/SparkleStatusIcon.cs
@@ -46,7 +46,7 @@ namespace SparkleShare {
private NSMenuItem AboutMenuItem;
private NSMenuItem NotificationsMenuItem;
private NSMenuItem RecentEventsMenuItem;
- private NSMenuItem QuitAppMenuItem;
+ private NSMenuItem QuitMenuItem;
private NSImage [] AnimationFrames;
private NSImage [] AnimationFramesActive;
private NSImage ErrorImage;
@@ -252,9 +252,6 @@ namespace SparkleShare {
if (Controller.Folders.Length > 0) {
RecentEventsMenuItem.Activated += delegate {
InvokeOnMainThread (delegate {
- //Show the icon in Dock
- Program.UI.SetRegularActivationPolicy();
-
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
if (SparkleUI.EventLog == null)
@@ -312,21 +309,17 @@ namespace SparkleShare {
Menu.AddItem (NSMenuItem.SeparatorItem);
- QuitAppMenuItem = new NSMenuItem () {
- Title = "Quit SparkleShare",
- Enabled = true
- };
+ QuitMenuItem = new NSMenuItem () {
+ Title = "Quit",
+ Enabled = true
+ };
- QuitAppMenuItem.Activated += delegate {
- InvokeOnMainThread (delegate {
- NSApplication.SharedApplication.Terminate(this);
+ QuitMenuItem.Activated += delegate {
+ Program.Controller.Quit ();
+ };
+
+ Menu.AddItem (QuitMenuItem);
- });
- };
-
-
- Menu.AddItem (QuitAppMenuItem);
-
StatusItem.Menu = Menu;
StatusItem.Menu.Update ();
}
diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs
index 3826148a..642cd6f3 100755
--- a/SparkleShare/Mac/SparkleUI.cs
+++ b/SparkleShare/Mac/SparkleUI.cs
@@ -67,8 +67,6 @@ namespace SparkleShare {
Bubbles = new SparkleBubbles ();
if (Program.Controller.FirstRun) {
- //Show Icon in Dock
- this.SetRegularActivationPolicy();
Setup = new SparkleSetup ();
Setup.Controller.ShowSetupPage ();
}
@@ -92,11 +90,29 @@ namespace SparkleShare {
{
NSApplication.Main (new string [0]);
}
-
- public void SetRegularActivationPolicy()
- {
- NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;
- }
+
+
+ public void UpdateDockIconVisibility ()
+ {
+ 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")]