diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index bfecb958..e7274414 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -62,9 +62,10 @@ namespace SparkleShare { this.watcher.Changed += OnFilesChanged; } - private void OnFilesChanged(List changed_files_in_basedir) + + private void OnFilesChanged (List changed_files_in_basedir) { - Dictionary> change_dict = new Dictionary> (); + List triggered_repos = new List (); foreach (string file in changed_files_in_basedir) { string repo_name; @@ -76,31 +77,20 @@ namespace SparkleShare { repo_name = file; repo_name = Path.GetFileNameWithoutExtension (repo_name); - SparkleRepoBase repo = GetRepositoryByName (repo_name); + if (repo == null) continue; - List changes; + if (!triggered_repos.Contains (repo_name)) { + triggered_repos.Add (repo_name); - if (change_dict.ContainsKey (repo)) - changes = change_dict [repo]; - else { - changes = new List (); - change_dict.Add (repo, changes); - } - - changes.Add (Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, file)); - } - - foreach (SparkleRepoBase repo in change_dict.Keys) { - foreach (string file in change_dict[repo]) { - FileActivityTask task = MacActivityTask ( - repo, - new FileSystemEventArgs(WatcherChangeTypes.Changed, file, "unknown") - ); + FileActivityTask task = MacActivityTask (repo, + new FileSystemEventArgs (WatcherChangeTypes.Changed, file, "Unknown")); + task (); } + } } diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 0d6cf797..0046cb30 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -40,7 +40,7 @@ namespace SparkleShare { public sealed class SparkleMacWatcher : IDisposable { - public delegate void ChangedEventHandler (List path); + public delegate void ChangedEventHandler (List paths); public event ChangedEventHandler Changed; public string BasePath { get; private set; }