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 {
|
SparkleShare.Controller.OnIdle += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
SetNormalState ();
|
SetNormalState ();
|
||||||
UpdateMenu ();
|
CreateMenu ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ namespace SparkleShare {
|
||||||
SparkleShare.Controller.OnError += delegate {
|
SparkleShare.Controller.OnError += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
SetNormalState (true);
|
SetNormalState (true);
|
||||||
UpdateMenu ();
|
CreateMenu ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -172,19 +172,18 @@ namespace SparkleShare {
|
||||||
Tasks = new EventHandler [SparkleShare.Controller.Folders.Count];
|
Tasks = new EventHandler [SparkleShare.Controller.Folders.Count];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (string path in SparkleShare.Controller.Folders) {
|
foreach (string folder_name in SparkleShare.Controller.Folders) {
|
||||||
|
|
||||||
/* TODO
|
|
||||||
if (repo.HasUnsyncedChanges)
|
|
||||||
folder_action.IconName = "dialog-error"; */
|
|
||||||
|
|
||||||
NSMenuItem item = new NSMenuItem ();
|
NSMenuItem item = new NSMenuItem ();
|
||||||
|
|
||||||
item.Title = System.IO.Path.GetFileName (path);
|
|
||||||
item.Image = NSImage.ImageNamed ("NSFolder");
|
|
||||||
item.Image.Size = new SizeF (16, 16);
|
|
||||||
|
|
||||||
Tasks [i] = OpenEventLogDelegate (path);
|
item.Title = folder_name;
|
||||||
|
|
||||||
|
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] = item;
|
||||||
FolderMenuItems [i].Activated += Tasks [i];
|
FolderMenuItems [i].Activated += Tasks [i];
|
||||||
|
@ -192,6 +191,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FolderMenuItems = new NSMenuItem [1];
|
FolderMenuItems = new NSMenuItem [1];
|
||||||
|
|
||||||
|
@ -290,7 +292,10 @@ namespace SparkleShare {
|
||||||
// The state when there's nothing going on
|
// The state when there's nothing going on
|
||||||
private void SetNormalState ()
|
private void SetNormalState ()
|
||||||
{
|
{
|
||||||
SetNormalState (false);
|
if (SparkleShare.Controller.UnsyncedFolders.Count > 0)
|
||||||
|
SetNormalState (true);
|
||||||
|
else
|
||||||
|
SetNormalState (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,20 @@ namespace SparkleShare {
|
||||||
return SparkleConfig.DefaultConfig.Folders;
|
return SparkleConfig.DefaultConfig.Folders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
public List <SparkleChangeSet> GetLog (string name)
|
||||||
|
|
Loading…
Reference in a new issue