From b947908a46188f88f98158785c4ca5302a8fba30 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 13 Mar 2011 02:07:47 +0000 Subject: [PATCH] Fix notifications --- SparkleLib/SparkleListener.cs | 4 ++-- SparkleLib/SparkleRepo.cs | 4 ++-- SparkleShare/Mac/SparkleUI.cs | 41 +++++++++++++++++++---------------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/SparkleLib/SparkleListener.cs b/SparkleLib/SparkleListener.cs index c0fce5bf..2c57850f 100644 --- a/SparkleLib/SparkleListener.cs +++ b/SparkleLib/SparkleListener.cs @@ -53,8 +53,8 @@ namespace SparkleLib { Nick = GetSHA1 (DateTime.Now.ToString () + "sparkles"); Nick = "s" + Nick.Substring (0, 7); - Channel = "#" + GetSHA1 (server + folder_name); - + Channel = "#" + GetSHA1 (server + folder_name + "sparkles"); + Client = new IrcClient () { PingTimeout = 180, PingInterval = 90 diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index 829803ce..76af6845 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -256,8 +256,8 @@ namespace SparkleLib { LocalPath = path; Name = Path.GetFileName (LocalPath); - RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl); RemoteOriginUrl = Config ["remote.origin.url"]; + RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl); Domain = GetDomain (RemoteOriginUrl); Description = GetDescription (); UserName = Config ["user.name"]; @@ -307,7 +307,7 @@ namespace SparkleLib { // Listen to the irc channel on the server... - Listener = new SparkleListener (Domain, "#" + RemoteName, UserEmail); + Listener = new SparkleListener (Domain, RemoteName, UserEmail); // ...fetch remote changes every 60 seconds if that fails RemoteTimer = new Timer () { diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index 41bf899a..8438ba2a 100644 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -30,11 +30,25 @@ namespace SparkleShare { public partial class AppDelegate : NSApplicationDelegate { + public override void WillBecomeActive (NSNotification notification) + { + + NSApplication.SharedApplication.DockTile.BadgeLabel = null; + + } + + public override void OrderFrontStandardAboutPanel (NSObject sender) + { + + // FIXME: Doesn't work + new SparkleAbout (); + + } + } - public class SparkleUI : AppDelegate - { + public class SparkleUI : AppDelegate { public static SparkleStatusIcon StatusIcon; public static List OpenLogs; @@ -45,6 +59,7 @@ namespace SparkleShare { private SparkleAbout About; private NSAlert Alert; + public SparkleUI () { @@ -78,8 +93,11 @@ namespace SparkleShare { InvokeOnMainThread (delegate { - NewEvents++; - NSApplication.SharedApplication.DockTile.BadgeLabel = NewEvents.ToString (); + if (NSApplication.SharedApplication.DockTile.BadgeLabel == null) + NSApplication.SharedApplication.DockTile.BadgeLabel = "1"; + else + NSApplication.SharedApplication.DockTile.BadgeLabel = + (int.Parse (NSApplication.SharedApplication.DockTile.BadgeLabel) + 1).ToString (); foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); @@ -147,22 +165,7 @@ namespace SparkleShare { } - public override void WillBecomeActive (NSNotification notification) - { - NewEvents = 0; - NSApplication.SharedApplication.DockTile.BadgeLabel = null; - - } - - public override void OrderFrontStandardAboutPanel (NSObject sender) - { - - // FIXME: Doesn't work - About = new SparkleAbout (); - About.Update (); - - } }