From 864e58c1a91e73360e5d1947750ffa760cf55f49 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 4 Dec 2011 11:37:38 +0100 Subject: [PATCH] statusicon: syncing state is more important than error state. Also check all repos first --- SparkleShare/SparkleControllerBase.cs | 34 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 1552d5ca..4bd64c69 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -532,31 +532,39 @@ namespace SparkleShare { // Fires events for the current syncing state public void UpdateState () { + bool has_syncing_repos = false; + bool has_unsynced_repos = false; + foreach (SparkleRepoBase repo in Repositories) { if (repo.Status == SyncStatus.SyncDown || repo.Status == SyncStatus.SyncUp || repo.IsBuffering) { - if (OnSyncing != null) - OnSyncing (); - - return; + has_syncing_repos = true; } else if (repo.HasUnsyncedChanges) { - if (OnError != null) - OnError (); - - return; + has_unsynced_repos = true; } } - if (OnIdle != null) - OnIdle (); - FolderSize = GetFolderSize (); + if (has_syncing_repos) { + if (OnSyncing != null) + OnSyncing (); - if (FolderSizeChanged != null) - FolderSizeChanged (FolderSize); + } else if (has_unsynced_repos) { + if (OnError != null) + OnError (); + + } else { + if (OnIdle != null) + OnIdle (); + + FolderSize = GetFolderSize (); + + if (FolderSizeChanged != null) + FolderSizeChanged (FolderSize); + } }