[bubble] don't open a new event log if one already exists
This commit is contained in:
parent
2255d72aa2
commit
3368d40ec8
|
@ -273,24 +273,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
return delegate {
|
return delegate {
|
||||||
|
|
||||||
SparkleLog log = SparkleUI.OpenLogs.Find (delegate (SparkleLog l) {
|
SparkleShare.UI.AddEventLog (path);
|
||||||
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 ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -390,7 +373,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SparkleMenuItem : ImageMenuItem {
|
public class SparkleMenuItem : ImageMenuItem {
|
||||||
|
|
||||||
public SparkleMenuItem (string text) : base (text)
|
public SparkleMenuItem (string text) : base (text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,10 +150,7 @@ namespace SparkleShare {
|
||||||
bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32);
|
bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32);
|
||||||
|
|
||||||
bubble.AddAction ("", "Show Events", delegate {
|
bubble.AddAction ("", "Show Events", delegate {
|
||||||
|
AddEventLog (repository_path);
|
||||||
SparkleLog log = new SparkleLog (repository_path);
|
|
||||||
log.ShowAll ();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bubble.Show ();
|
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
|
// Runs the application
|
||||||
public void Run ()
|
public void Run ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue