statusicon: Limit paused unsynced items list to 10
This commit is contained in:
parent
bfa3dd2bec
commit
320c74c9f4
|
@ -1136,10 +1136,6 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.Add (change);
|
changes.Add (change);
|
||||||
|
|
||||||
count++;
|
|
||||||
if (count == 10)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git_status.StandardOutput.ReadToEnd ();
|
git_status.StandardOutput.ReadToEnd ();
|
||||||
|
|
|
@ -157,6 +157,12 @@ namespace SparkleShare {
|
||||||
Sensitive = false
|
Sensitive = false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty (project.MoreUnsyncedChanges)) {
|
||||||
|
(item.Submenu as Menu).Add (new MenuItem (MoreUnsyncedChanges) {
|
||||||
|
Sensitive = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
||||||
resume_item = new MenuItem ("Sync and Resume…");
|
resume_item = new MenuItem ("Sync and Resume…");
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,9 @@ namespace SparkleShare {
|
||||||
Image = NSImage.ImageNamed (pair.Value)
|
Image = NSImage.ImageNamed (pair.Value)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty (project.MoreUnsyncedChanges))
|
||||||
|
item.Submenu.AddItem (new NSMenuItem (project.MoreUnsyncedChanges));
|
||||||
|
|
||||||
item.Submenu.AddItem (NSMenuItem.SeparatorItem);
|
item.Submenu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
this.resume_menu_items [i] = new NSMenuItem ("Sync and Resume…");
|
this.resume_menu_items [i] = new NSMenuItem ("Sync and Resume…");
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,19 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string MoreUnsyncedChanges = "";
|
||||||
|
|
||||||
public Dictionary<string, string> UnsyncedChangesInfo {
|
public Dictionary<string, string> UnsyncedChangesInfo {
|
||||||
get {
|
get {
|
||||||
Dictionary<string, string> changes_info = new Dictionary<string, string> ();
|
Dictionary<string, string> changes_info = new Dictionary<string, string> ();
|
||||||
|
|
||||||
|
int changes_count = 0;
|
||||||
foreach (SparkleChange change in repo.UnsyncedChanges) {
|
foreach (SparkleChange change in repo.UnsyncedChanges) {
|
||||||
|
changes_count++;
|
||||||
|
|
||||||
|
if (changes_count > 10)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (change.Type) {
|
switch (change.Type) {
|
||||||
case SparkleChangeType.Added: changes_info [change.Path] = "document-added-12.png"; break;
|
case SparkleChangeType.Added: changes_info [change.Path] = "document-added-12.png"; break;
|
||||||
case SparkleChangeType.Edited: changes_info [change.Path] = "document-edited-12.png"; break;
|
case SparkleChangeType.Edited: changes_info [change.Path] = "document-edited-12.png"; break;
|
||||||
|
@ -92,6 +100,9 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changes_count > 10)
|
||||||
|
MoreUnsyncedChanges = string.Format ("and {0} more", changes_count - 10);
|
||||||
|
|
||||||
return changes_info;
|
return changes_info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,13 @@ namespace SparkleShare {
|
||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty (project.MoreUnsyncedChanges)) {
|
||||||
|
item.Items.Add (new SparkleMenuItem () {
|
||||||
|
Header = project.MoreUnsyncedChanges,
|
||||||
|
IsEnabled = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
item.Items.Add (new Separator ());
|
item.Items.Add (new Separator ());
|
||||||
resume_item = new SparkleMenuItem () { Header = "Sync and Resume…" };
|
resume_item = new SparkleMenuItem () { Header = "Sync and Resume…" };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue