[ui] be more efficient populating and fix threading issue

This commit is contained in:
Hylke Bons 2010-08-08 22:28:56 +01:00
parent 7dbab85b6a
commit 9c31c7f8e7

View file

@ -89,7 +89,7 @@ namespace SparkleShare {
CreateConfigurationFolders ();
UpdateRepositories ();
PopulateRepositories ();
// Don't create the window and status
// icon when --disable-gui was given
@ -358,7 +358,8 @@ namespace SparkleShare {
Repositories.Add (repo);
Application.Invoke (delegate { NotificationIcon.CreateMenu (); });
if (NotificationIcon != null)
Application.Invoke (delegate { NotificationIcon.CreateMenu (); });
}
@ -379,27 +380,22 @@ namespace SparkleShare {
}
Application.Invoke (delegate { NotificationIcon.CreateMenu (); });
if (NotificationIcon != null)
Application.Invoke (delegate { NotificationIcon.CreateMenu (); });
}
// Updates the list of repositories with all the
// folders in the SparkleShare folder
public void UpdateRepositories ()
public void PopulateRepositories ()
{
Repositories = new List <SparkleRepo> ();
foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath)) {
foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath))
AddRepository (folder_path);
}
// Update the list in the statusicon
if (NotificationIcon != null)
NotificationIcon.CreateMenu ();
}