mac ui: remove leaking messages
This commit is contained in:
parent
9ad2335c99
commit
2526311a6c
|
@ -32,26 +32,19 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override void WillBecomeActive (NSNotification notification)
|
public override void WillBecomeActive (NSNotification notification)
|
||||||
{
|
{
|
||||||
|
|
||||||
NSApplication.SharedApplication.DockTile.BadgeLabel = null;
|
NSApplication.SharedApplication.DockTile.BadgeLabel = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OrderFrontStandardAboutPanel (NSObject sender)
|
public override void OrderFrontStandardAboutPanel (NSObject sender)
|
||||||
{
|
{
|
||||||
|
|
||||||
// FIXME: Doesn't work
|
// FIXME: Doesn't work
|
||||||
new SparkleAbout ();
|
new SparkleAbout ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WillTerminate (NSNotification notification)
|
public override void WillTerminate (NSNotification notification)
|
||||||
{
|
{
|
||||||
|
|
||||||
SparkleShare.Controller.Quit ();
|
SparkleShare.Controller.Quit ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,50 +55,42 @@ namespace SparkleShare {
|
||||||
public static SparkleIntro Intro;
|
public static SparkleIntro Intro;
|
||||||
public static NSFont Font;
|
public static NSFont Font;
|
||||||
|
|
||||||
private NSAlert Alert;
|
private NSAlert alert;
|
||||||
|
|
||||||
|
|
||||||
public SparkleUI ()
|
public SparkleUI ()
|
||||||
{
|
{
|
||||||
|
|
||||||
NSApplication.Init ();
|
NSApplication.Init ();
|
||||||
|
|
||||||
|
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
|
||||||
SetSparkleIcon ();
|
SetSparkleIcon ();
|
||||||
|
|
||||||
// TODO: Getting crashes when I remove this
|
// TODO: Getting crashes when I remove this
|
||||||
NSApplication.SharedApplication.ApplicationIconImage
|
NSApplication.SharedApplication.ApplicationIconImage
|
||||||
= NSImage.ImageNamed ("sparkleshare.icns");
|
= NSImage.ImageNamed ("sparkleshare.icns");
|
||||||
|
|
||||||
|
|
||||||
if (!SparkleShare.Controller.BackendIsPresent) {
|
if (!SparkleShare.Controller.BackendIsPresent) {
|
||||||
|
this.alert = new SparkleAlert ();
|
||||||
Alert = new SparkleAlert ();
|
this.alert.RunModal ();
|
||||||
Alert.RunModal ();
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Font = NSFontManager.SharedFontManager.FontWithFamily
|
Font = NSFontManager.SharedFontManager.FontWithFamily
|
||||||
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
||||||
|
|
||||||
// new SparkleAbout ();
|
|
||||||
|
|
||||||
OpenLogs = new List <SparkleLog> ();
|
OpenLogs = new List <SparkleLog> ();
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
}
|
||||||
|
|
||||||
SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
|
SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
|
||||||
string message, string repository_path) {
|
string message, string repository_path) {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
|
|
||||||
foreach (SparkleLog log in OpenLogs) {
|
foreach (SparkleLog log in OpenLogs) {
|
||||||
if (log.LocalPath.Equals (repository_path))
|
if (log.LocalPath.Equals (repository_path))
|
||||||
log.UpdateEventLog ();
|
log.UpdateEventLog ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SparkleShare.Controller.NotificationsEnabled) {
|
if (SparkleShare.Controller.NotificationsEnabled) {
|
||||||
|
|
||||||
if (NSApplication.SharedApplication.DockTile.BadgeLabel == null)
|
if (NSApplication.SharedApplication.DockTile.BadgeLabel == null)
|
||||||
NSApplication.SharedApplication.DockTile.BadgeLabel = "1";
|
NSApplication.SharedApplication.DockTile.BadgeLabel = "1";
|
||||||
else
|
else
|
||||||
|
@ -114,51 +99,36 @@ namespace SparkleShare {
|
||||||
|
|
||||||
NSApplication.SharedApplication.RequestUserAttention
|
NSApplication.SharedApplication.RequestUserAttention
|
||||||
(NSRequestUserAttentionType.InformationalRequest);
|
(NSRequestUserAttentionType.InformationalRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SparkleShare.Controller.AvatarFetched += delegate {
|
SparkleShare.Controller.AvatarFetched += delegate {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
|
|
||||||
foreach (SparkleLog log in SparkleUI.OpenLogs)
|
foreach (SparkleLog log in SparkleUI.OpenLogs)
|
||||||
log.UpdateEventLog ();
|
log.UpdateEventLog ();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SparkleShare.Controller.OnIdle += delegate {
|
SparkleShare.Controller.OnIdle += delegate {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
|
|
||||||
foreach (SparkleLog log in SparkleUI.OpenLogs)
|
foreach (SparkleLog log in SparkleUI.OpenLogs)
|
||||||
log.UpdateEventLog ();
|
log.UpdateEventLog ();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (SparkleShare.Controller.FirstRun) {
|
if (SparkleShare.Controller.FirstRun) {
|
||||||
|
|
||||||
Intro = new SparkleIntro ();
|
Intro = new SparkleIntro ();
|
||||||
Intro.ShowAccountForm ();
|
Intro.ShowAccountForm ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetSparkleIcon ()
|
public void SetSparkleIcon ()
|
||||||
{
|
{
|
||||||
|
|
||||||
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
|
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||||
"sparkleshare-mac.icns");
|
"sparkleshare-mac.icns");
|
||||||
|
|
||||||
|
@ -166,20 +136,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon,
|
NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon,
|
||||||
SparkleShare.Controller.SparklePath, 0);
|
SparkleShare.Controller.SparklePath, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Run ()
|
public void Run ()
|
||||||
{
|
{
|
||||||
|
|
||||||
NSApplication.Main (new string [0]);
|
NSApplication.Main (new string [0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue