diff --git a/SparkleShare/Linux/SparkleAbout.cs b/SparkleShare/Linux/SparkleAbout.cs
index 1cb6dc61..b97dcf8e 100755
--- a/SparkleShare/Linux/SparkleAbout.cs
+++ b/SparkleShare/Linux/SparkleAbout.cs
@@ -55,6 +55,7 @@ namespace SparkleShare {
CreateAbout ();
+
Controller.HideWindowEvent += delegate {
Application.Invoke (delegate {
HideAll ();
@@ -68,29 +69,9 @@ namespace SparkleShare {
});
};
- Controller.NewVersionEvent += delegate (string new_version) {
+ Controller.UpdateLabelEvent += delegate (string text) {
Application.Invoke (delegate {
- this.updates.Markup = String.Format ("{0}",
- string.Format ("A newer version ({0}) is available!", new_version));
-
- this.updates.ShowAll ();
- });
- };
-
- Controller.VersionUpToDateEvent += delegate {
- Application.Invoke (delegate {
- this.updates.Markup = String.Format ("{0}",
- "You are running the latest version.");
-
- this.updates.ShowAll ();
- });
- };
-
- Controller.CheckingForNewVersionEvent += delegate {
- Application.Invoke (delegate {
- this.updates.Markup = String.Format ("{0}",
- "Checking for updates...");
-
+ this.updates.Markup = String.Format ("{0}", text);
this.updates.ShowAll ();
});
};
diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/SparkleAbout.cs
index 1403a76a..f654d7ec 100755
--- a/SparkleShare/Mac/SparkleAbout.cs
+++ b/SparkleShare/Mac/SparkleAbout.cs
@@ -59,9 +59,7 @@ namespace SparkleShare {
CreateAbout ();
- this.hidden_close_button.Activated += delegate {
- Controller.WindowClosed ();
- };
+ this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); };
Controller.HideWindowEvent += delegate {
Program.Controller.Invoke (() => PerformClose (this));
@@ -71,22 +69,8 @@ namespace SparkleShare {
Program.Controller.Invoke (() => OrderFrontRegardless ());
};
- Controller.NewVersionEvent += delegate (string new_version) {
- Program.Controller.Invoke (() => {
- this.updates_text_field.StringValue = "A newer version (" + new_version + ") is available!";
- });
- };
-
- Controller.VersionUpToDateEvent += delegate {
- Program.Controller.Invoke (() => {
- this.updates_text_field.StringValue = "You are running the latest version.";
- });
- };
-
- Controller.CheckingForNewVersionEvent += delegate {
- Program.Controller.Invoke (() => {
- this.updates_text_field.StringValue = "Checking for updates...";
- });
+ Controller.UpdateLabelEvent += delegate (string text) {
+ Program.Controller.Invoke (() => { this.updates_text_field.StringValue = text; });
};
diff --git a/SparkleShare/Mac/SparkleBubbles.cs b/SparkleShare/Mac/SparkleBubbles.cs
index 971e7e22..601fdaa1 100755
--- a/SparkleShare/Mac/SparkleBubbles.cs
+++ b/SparkleShare/Mac/SparkleBubbles.cs
@@ -30,11 +30,10 @@ namespace SparkleShare {
public SparkleBubbles ()
{
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
- // Notification center was introduced in Mountain Lion
if (Environment.OSVersion.Version.Major < 12)
- return;
+ return; // The notification center was introduced in Mountain Lion
- InvokeOnMainThread (delegate {
+ InvokeOnMainThread (() => {
NSUserNotification notification = new NSUserNotification () {
Title = title,
InformativeText = subtext,
@@ -43,7 +42,7 @@ namespace SparkleShare {
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
center.ShouldPresentNotification = delegate { return true; };
- center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
+ center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
center.ScheduleNotification (notification);
});
diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs
index 10a35252..1222cbfc 100755
--- a/SparkleShare/Mac/SparkleStatusIcon.cs
+++ b/SparkleShare/Mac/SparkleStatusIcon.cs
@@ -53,9 +53,9 @@ namespace SparkleShare {
public SparkleStatusIcon ()
{
- this.status_item.HighlightMode = true;
- this.status_item.Image = this.syncing_idle_image;
- this.status_item.AlternateImage = this.syncing_idle_image_active;
+ this.status_item.HighlightMode = true;
+ this.status_item.Image = this.syncing_idle_image;
+ this.status_item.AlternateImage = this.syncing_idle_image_active;
CreateMenu ();
diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs
index 657a6aee..febec364 100755
--- a/SparkleShare/SparkleAboutController.cs
+++ b/SparkleShare/SparkleAboutController.cs
@@ -25,11 +25,9 @@ namespace SparkleShare {
public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { };
- public event Action VersionUpToDateEvent = delegate { };
- public event Action CheckingForNewVersionEvent = delegate { };
- public event NewVersionEventDelegate NewVersionEvent = delegate { };
- public delegate void NewVersionEventDelegate (string new_version_string);
+ public event UpdateLabelEventDelegate UpdateLabelEvent = delegate { };
+ public delegate void UpdateLabelEventDelegate (string text);
public readonly string WebsiteLinkAddress = "http://www.sparkleshare.org/";
public readonly string CreditsLinkAddress = "http://www.github.com/hbons/SparkleShare/tree/master/legal/AUTHORS";
@@ -60,7 +58,7 @@ namespace SparkleShare {
private void CheckForNewVersion ()
{
- CheckingForNewVersionEvent ();
+ UpdateLabelEvent ("Checking for updates...");
Thread.Sleep (500);
WebClient web_client = new WebClient ();
@@ -70,9 +68,9 @@ namespace SparkleShare {
string latest_version = web_client.DownloadString (uri);
if (new Version (latest_version) > new Version (RunningVersion))
- NewVersionEvent (latest_version);
+ UpdateLabelEvent ("A newer version (" + latest_version + ") is available!");
else
- VersionUpToDateEvent ();
+ UpdateLabelEvent ("You are running the latest version.");
} catch {
}
diff --git a/SparkleShare/SparklePlugin.cs b/SparkleShare/SparklePlugin.cs
index 7cfd438b..07a6548a 100644
--- a/SparkleShare/SparklePlugin.cs
+++ b/SparkleShare/SparklePlugin.cs
@@ -22,14 +22,14 @@ using IO = System.IO;
namespace SparkleShare {
- public class SparklePlugin {
+ public class SparklePlugin : XmlDocument {
public static string PluginsPath = "";
public static string LocalPluginsPath = IO.Path.Combine (
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins");
- public string Name { get { return GetValue ("info", "name"); } }
+ new public string Name { get { return GetValue ("info", "name"); } }
public string Description { get { return GetValue ("info", "description"); } }
public string Backend { get { return GetValue ("info", "backend"); } }
public string Fingerprint { get { return GetValue ("info", "fingerprint"); } }
@@ -62,14 +62,13 @@ namespace SparkleShare {
}
}
- private XmlDocument xml = new XmlDocument ();
private string plugin_directory;
public SparklePlugin (string plugin_path)
{
this.plugin_directory = System.IO.Path.GetDirectoryName (plugin_path);
- this.xml.Load (plugin_path);
+ Load (plugin_path);
}
@@ -107,14 +106,13 @@ namespace SparkleShare {
IO.Directory.CreateDirectory (LocalPluginsPath);
IO.File.WriteAllText (plugin_path, plugin_xml);
-
return new SparklePlugin (plugin_path);
}
private string GetValue (string a, string b)
{
- XmlNode node = this.xml.SelectSingleNode ("/sparkleshare/plugin/" + a + "/" + b + "/text()");
+ XmlNode node = SelectSingleNode ("/sparkleshare/plugin/" + a + "/" + b + "/text()");
if (node != null && !string.IsNullOrEmpty (node.Value))
return node.Value;
diff --git a/SparkleShare/Windows/SparkleAbout.cs b/SparkleShare/Windows/SparkleAbout.cs
index 4ff4b3cc..5d59931e 100644
--- a/SparkleShare/Windows/SparkleAbout.cs
+++ b/SparkleShare/Windows/SparkleAbout.cs
@@ -56,28 +56,14 @@ namespace SparkleShare {
};
Controller.HideWindowEvent += delegate {
- Dispatcher.BeginInvoke((Action)delegate {
+ Dispatcher.BeginInvoke ((Action) delegate {
Hide ();
});
};
- Controller.NewVersionEvent += delegate (string new_version) {
- Dispatcher.BeginInvoke((Action)delegate {
- this.updates.Content = "A newer version (" + new_version + ") is available!";
- this.updates.UpdateLayout ();
- });
- };
-
- Controller.VersionUpToDateEvent += delegate {
+ Controller.UpdateLabelEvent += delegate (string text) {
Dispatcher.BeginInvoke ((Action) delegate {
- this.updates.Content = "You are running the latest version.";
- this.updates.UpdateLayout ();
- });
- };
-
- Controller.CheckingForNewVersionEvent += delegate {
- Dispatcher.BeginInvoke ((Action) delegate {
- this.updates.Content = "Checking for updates...";
+ this.updates.Content = text;
this.updates.UpdateLayout ();
});
};