From 65fe137b25c0e442183899a473948605fe27ed44 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 20 May 2010 20:38:10 +0100 Subject: [PATCH] fix bug where all repo menu items open the same window --- SparkleShare/SparkleStatusIcon.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 97c56335..f93175c0 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -30,6 +30,13 @@ namespace SparkleShare { return Catalog.GetString (s); } + public EventHandler CreateWindowDelegate (SparkleRepo SparkleRepo) { + return delegate { + SparkleWindow SparkleWindow = new SparkleWindow (SparkleRepo); + SparkleWindow.ShowAll (); + }; + } + public SparkleStatusIcon () : base () { Activate += delegate { @@ -44,15 +51,10 @@ namespace SparkleShare { MenuItem [] FolderItems = new MenuItem [SparkleShare.Repositories.Length]; - // TODO: For some strange reason both entries - // open the same repo... int i = 0; foreach (SparkleRepo SparkleRepo in SparkleShare.Repositories) { FolderItems [i] = new MenuItem (SparkleRepo.Name); - FolderItems [i].Activated += delegate { - SparkleWindow SparkleWindow = new SparkleWindow (SparkleRepo); - SparkleWindow.ShowAll (); - }; + FolderItems [i].Activated += CreateWindowDelegate (SparkleRepo); Menu.Add (FolderItems [i]); i++; }