[bubble] don't open a new event log if one already exists

This commit is contained in:
Hylke Bons 2011-03-16 14:47:30 +00:00
parent 2c79a4b24d
commit 35bca303ba
2 changed files with 28 additions and 23 deletions

View file

@ -273,24 +273,7 @@ namespace SparkleShare {
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) {
SparkleUI.OpenLogs.Add (new SparkleLog (path));
SparkleUI.OpenLogs [SparkleUI.OpenLogs.Count - 1].ShowAll ();
SparkleUI.OpenLogs [SparkleUI.OpenLogs.Count - 1].Present ();
} else {
log.ShowAll ();
log.Present ();
}
SparkleShare.UI.AddEventLog (path);
};
@ -390,7 +373,7 @@ namespace SparkleShare {
}
class SparkleMenuItem : ImageMenuItem {
public class SparkleMenuItem : ImageMenuItem {
public SparkleMenuItem (string text) : base (text)
{

View file

@ -150,10 +150,7 @@ namespace SparkleShare {
bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32);
bubble.AddAction ("", "Show Events", delegate {
SparkleLog log = new SparkleLog (repository_path);
log.ShowAll ();
AddEventLog (repository_path);
});
bubble.Show ();
@ -202,6 +199,31 @@ namespace SparkleShare {
}
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 ();
}
}
// Runs the application
public void Run ()
{