mac: open event log when dock icon with badge is clicked

This commit is contained in:
Hylke Bons 2012-03-01 21:02:18 +00:00
parent 84413d2c53
commit f2d6daeda2
4 changed files with 678 additions and 669 deletions

View file

@ -68,6 +68,7 @@ namespace SparkleShare {
[Export("growlNotificationWasClicked")] [Export("growlNotificationWasClicked")]
public override void GrowlNotificationWasClicked (NSObject o) public override void GrowlNotificationWasClicked (NSObject o)
{ {
NSApplication.SharedApplication.DockTile.BadgeLabel = null;
SparkleUI.Bubbles.Controller.BubbleClicked (); SparkleUI.Bubbles.Controller.BubbleClicked ();
} }
} }

View file

@ -78,6 +78,8 @@ namespace SparkleShare {
}; };
Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
Reset (); Reset ();
@ -770,6 +772,7 @@ namespace SparkleShare {
ShowAll (); ShowAll ();
}); });
}
}; };
} }
} }

View file

@ -92,18 +92,23 @@ namespace SparkleShare {
Menu.Delegate = new SparkleStatusIconMenuDelegate (); Menu.Delegate = new SparkleStatusIconMenuDelegate ();
} }
Controller.UpdateQuitItemEvent += delegate (bool quit_item_enabled) { Controller.UpdateQuitItemEvent += delegate (bool quit_item_enabled) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (QuitMenuItem != null) { if (QuitMenuItem != null) {
QuitMenuItem.Enabled = quit_item_enabled; QuitMenuItem.Enabled = quit_item_enabled;
StatusItem.Menu.Update (); StatusItem.Menu.Update ();
} }
}); });
}
}; };
Controller.UpdateMenuEvent += delegate (IconState state) { Controller.UpdateMenuEvent += delegate (IconState state) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
using (var a = new NSAutoreleasePool ()) {
switch (state) { switch (state) {
case IconState.Idle: case IconState.Idle:
@ -149,8 +154,8 @@ namespace SparkleShare {
} }
StatusItem.Menu.Update (); StatusItem.Menu.Update ();
}
}); });
}
}; };
} }

View file

@ -116,12 +116,9 @@ namespace SparkleShare {
private void ShowDockIcon () private void ShowDockIcon ()
{
using (var a = new NSAutoreleasePool ())
{ {
NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;
} }
}
[Export("registrationDictionaryForGrowl")] [Export("registrationDictionaryForGrowl")]
@ -137,8 +134,11 @@ namespace SparkleShare {
public override void WillBecomeActive (NSNotification notification) public override void WillBecomeActive (NSNotification notification)
{ {
if (NSApplication.SharedApplication.DockTile.BadgeLabel != null) {
Program.Controller.ShowEventLogWindow ();
NSApplication.SharedApplication.DockTile.BadgeLabel = null; NSApplication.SharedApplication.DockTile.BadgeLabel = null;
} }
}
public override void WillTerminate (NSNotification notification) public override void WillTerminate (NSNotification notification)