// A method reference that makes sure that opening the // event log for each repository works correctly private EventHandler OpenEventLogDelegate(string path) { return(delegate { InvokeOnMainThread(delegate { NSApplication.SharedApplication.ActivateIgnoringOtherApps(true); SparkleLog log = SparkleUI.OpenLogs.Find(delegate(SparkleLog l) { return l.LocalPath.Equals(path); }); // Check whether the log is already open, create a new one if // that's not the case or present it to the user if it is if (log == null) { SparkleUI.OpenLogs.Add(new SparkleLog(path)); SparkleUI.OpenLogs [SparkleUI.OpenLogs.Count - 1].MakeKeyAndOrderFront(this); } else { log.OrderFrontRegardless(); log.MakeKeyAndOrderFront(this); } }); }); }
public void AddEventLog(string path) { SparkleLog log = SparkleUI.OpenLogs.Find(delegate(SparkleLog l) { return(l.LocalPath.Equals(path)); }); // Check whether the log is already open, create a new one if // that's not the case or present it to the user if it is if (log == null) { OpenLogs.Add(new SparkleLog(path)); OpenLogs [OpenLogs.Count - 1].ShowAll(); OpenLogs [OpenLogs.Count - 1].Present(); } else { log.ShowAll(); log.Present(); } }
// Shows a notification bubble when someone // made a change to the repository public void ShowNewCommitBubble(string author, string email, string message, string repository_name) { string notify_settings_file = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "sparkleshare.notify"); if (File.Exists (notify_settings_file)) { SparkleBubble bubble = new SparkleBubble (author, message) { Icon = SparkleUIHelpers.GetAvatar (email, 32) }; bubble.AddAction ("", "Show Events", delegate { string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, repository_name); SparkleLog log = new SparkleLog (path); log.ShowAll (); }); bubble.Show (); } }
// A method reference that makes sure that // opening the event log for each repository // works correctly. private EventHandler OpenLogDelegate(string path) { return delegate { SparkleLog log = new SparkleLog (path); log.ShowAll (); log.Present (); }; }
// A method reference that makes sure that opening the // event log for each repository works correctly private EventHandler OpenEventLogDelegate(string path) { return delegate { SparkleLog log = SparkleUI.OpenLogs.Find (delegate (SparkleLog l) { return l.LocalPath.Equals (path); }); // Check whether the log is already open, create a new one if //that's not the case or present it to the user if it is if (log == null) { log = new SparkleLog (path); log.Hidden += delegate { SparkleUI.OpenLogs.Remove (log); log.Destroy (); }; SparkleUI.OpenLogs.Add (log); } log.ShowAll (); log.Present (); }; }
public SparkleUI() { // Initialize the application Application.Init (); // Create the statusicon StatusIcon = new SparkleStatusIcon (); // Keep track of event logs are open SparkleUI.OpenLogs = new List <SparkleLog> (); SparkleShare.Controller.OnFirstRun += delegate { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowAll (); }); }; SparkleShare.Controller.OnInvitation += delegate (string invitation_file_path) { Application.Invoke (delegate { SparkleInvitation invitation = new SparkleInvitation (invitation_file_path); invitation.Present (); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate (string author, string email, string message, string repository_path) { Application.Invoke (delegate { SparkleBubble bubble = new SparkleBubble (author, message) { Icon = SparkleUIHelpers.GetAvatar (email, 32) }; bubble.AddAction ("", "Show Events", delegate { SparkleLog log = new SparkleLog (repository_path); log.ShowAll (); }); bubble.Show (); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke (delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); SparkleBubble bubble = new SparkleBubble(title, subtext); bubble.Show (); }); }; }