[controller] Prevent some crashes clicking logs byy only showing them once the list is done loading

This commit is contained in:
Hylke Bons 2011-03-25 10:24:46 +00:00
parent 52d98d4175
commit 85626a6da2

View file

@ -131,11 +131,22 @@ namespace SparkleShare {
RemoveRepository (args.FullPath); RemoveRepository (args.FullPath);
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
}; };
// Add the repository when a create event occurs // Add the repository when a create event occurs
watcher.Created += delegate (object o, FileSystemEventArgs args) { watcher.Created += delegate (object o, FileSystemEventArgs args) {
// TODO: Needs to wait until the copying over is done
// Handle invitations when the user saves an // Handle invitations when the user saves an
// invitation into the SparkleShare folder // invitation into the SparkleShare folder
if (args.Name.EndsWith (".sparkle") && !FirstRun) { if (args.Name.EndsWith (".sparkle") && !FirstRun) {
@ -147,15 +158,22 @@ namespace SparkleShare {
string folder = xml_doc.GetElementsByTagName ("folder") [0].InnerText; string folder = xml_doc.GetElementsByTagName ("folder") [0].InnerText;
string token = xml_doc.GetElementsByTagName ("token") [0].InnerText; string token = xml_doc.GetElementsByTagName ("token") [0].InnerText;
// TODO: this is broken :\ // FIXME: this is broken :\
if (OnInvitation != null) if (OnInvitation != null)
OnInvitation (server, folder, token); OnInvitation (server, folder, token);
// FIXME: big repos seem to often fail because they don't pass this test
} else if (SparkleRepo.IsRepo (args.FullPath)) { } else if (SparkleRepo.IsRepo (args.FullPath)) {
AddRepository (args.FullPath); AddRepository (args.FullPath);
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }
}; };
@ -583,16 +601,6 @@ namespace SparkleShare {
Repositories.Add (repo); Repositories.Add (repo);
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }
@ -618,16 +626,6 @@ namespace SparkleShare {
} }
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }
@ -641,6 +639,15 @@ namespace SparkleShare {
foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath)) foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath))
AddRepository (folder_path); AddRepository (folder_path);
if (FolderListChanged != null)
FolderListChanged ();
FolderSize = GetFolderSize ();
if (FolderSizeChanged != null)
FolderSizeChanged (FolderSize);
} }