mac: use NSCaution icon instead of NSFolder in the status menu when the folder is unsynced
This commit is contained in:
parent
85be7121ab
commit
2d980d0c53
|
@ -85,7 +85,7 @@ namespace SparkleShare {
|
|||
SparkleShare.Controller.OnIdle += delegate {
|
||||
InvokeOnMainThread (delegate {
|
||||
SetNormalState ();
|
||||
UpdateMenu ();
|
||||
CreateMenu ();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace SparkleShare {
|
|||
SparkleShare.Controller.OnError += delegate {
|
||||
InvokeOnMainThread (delegate {
|
||||
SetNormalState (true);
|
||||
UpdateMenu ();
|
||||
CreateMenu ();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -172,19 +172,18 @@ namespace SparkleShare {
|
|||
Tasks = new EventHandler [SparkleShare.Controller.Folders.Count];
|
||||
|
||||
int i = 0;
|
||||
foreach (string path in SparkleShare.Controller.Folders) {
|
||||
|
||||
/* TODO
|
||||
if (repo.HasUnsyncedChanges)
|
||||
folder_action.IconName = "dialog-error"; */
|
||||
|
||||
foreach (string folder_name in SparkleShare.Controller.Folders) {
|
||||
NSMenuItem item = new NSMenuItem ();
|
||||
|
||||
item.Title = System.IO.Path.GetFileName (path);
|
||||
item.Image = NSImage.ImageNamed ("NSFolder");
|
||||
item.Image.Size = new SizeF (16, 16);
|
||||
item.Title = folder_name;
|
||||
|
||||
Tasks [i] = OpenEventLogDelegate (path);
|
||||
if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name))
|
||||
item.Image = NSImage.ImageNamed ("NSCaution");
|
||||
else
|
||||
item.Image = NSImage.ImageNamed ("NSFolder");
|
||||
|
||||
item.Image.Size = new SizeF (16, 16);
|
||||
Tasks [i] = OpenEventLogDelegate (folder_name);
|
||||
|
||||
FolderMenuItems [i] = item;
|
||||
FolderMenuItems [i].Activated += Tasks [i];
|
||||
|
@ -192,6 +191,9 @@ namespace SparkleShare {
|
|||
|
||||
i++;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
FolderMenuItems = new NSMenuItem [1];
|
||||
|
||||
|
@ -290,6 +292,9 @@ namespace SparkleShare {
|
|||
// The state when there's nothing going on
|
||||
private void SetNormalState ()
|
||||
{
|
||||
if (SparkleShare.Controller.UnsyncedFolders.Count > 0)
|
||||
SetNormalState (true);
|
||||
else
|
||||
SetNormalState (false);
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,20 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public List<string> UnsyncedFolders {
|
||||
get {
|
||||
List<string> unsynced_folders = new List<string> ();
|
||||
|
||||
foreach (SparkleRepoBase repo in Repositories) {
|
||||
if (repo.HasUnsyncedChanges)
|
||||
unsynced_folders.Add (repo.Name);
|
||||
}
|
||||
|
||||
return unsynced_folders;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List <SparkleChangeSet> GetLog (string name)
|
||||
{
|
||||
string path = Path.Combine (SparklePaths.SparklePath, name);
|
||||
|
|
Loading…
Reference in a new issue