[about] actually check for new versions
This commit is contained in:
parent
a426195925
commit
53f27b2025
|
@ -67,9 +67,11 @@ namespace SparkleShare {
|
|||
InvokeOnMainThread (delegate {
|
||||
UpdatesTextField.StringValue = "You are running the latest version.";
|
||||
UpdatesTextField.TextColor =
|
||||
NSColor.FromCalibratedRgba (0.45f, 0.82f, 0.09f, 1.0f); // Tango Chameleon #2
|
||||
NSColor.FromCalibratedRgba (0.31f, 0.60f, 0.02f, 1.0f); // Tango Chameleon #3
|
||||
});
|
||||
};
|
||||
|
||||
SparkleShare.Controller.CheckForNewVersion ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,7 @@ namespace SparkleShare {
|
|||
|
||||
public SparkleAbout () : base ("")
|
||||
{
|
||||
|
||||
DefaultSize = new Gdk.Size (360, 260);
|
||||
|
||||
BorderWidth = 0;
|
||||
IconName = "folder-sparkleshare";
|
||||
WindowPosition = WindowPosition.Center;
|
||||
|
@ -50,29 +48,22 @@ namespace SparkleShare {
|
|||
Resizable = false;
|
||||
|
||||
CreateAbout ();
|
||||
SparkleShare.Controller.CheckForNewVersion ();
|
||||
|
||||
SparkleShare.Controller.NewVersionAvailable += delegate (string new_version) {
|
||||
|
||||
Application.Invoke (delegate {
|
||||
Version.Markup = "<small><span fgcolor='#f57900'>A newer version (" + new_version + ") is available!</span></small>";
|
||||
Version.ShowAll ();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
SparkleShare.Controller.VersionUpToDate += delegate {
|
||||
|
||||
Application.Invoke (delegate {
|
||||
|
||||
Version.Markup = "<small><span fgcolor='#73d216'>You are running the latest version.</span></small>";
|
||||
Version.Markup = "<small><span fgcolor='#4e9a06'>You are running the latest version.</span></small>";
|
||||
Version.ShowAll ();
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
SparkleShare.Controller.CheckForNewVersion ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1293,9 +1293,8 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
private void CheckForNewVersion ()
|
||||
public void CheckForNewVersion ()
|
||||
{
|
||||
|
||||
string new_version_file_path = System.IO.Path.Combine (SparklePaths.SparkleTmpPath,
|
||||
"version");
|
||||
|
||||
|
@ -1308,22 +1307,18 @@ namespace SparkleShare {
|
|||
web_client.DownloadFileCompleted += delegate {
|
||||
|
||||
if (new FileInfo (new_version_file_path).Length > 0) {
|
||||
|
||||
StreamReader reader = new StreamReader (new_version_file_path);
|
||||
string downloaded_version_number = reader.ReadToEnd ().Trim ();
|
||||
|
||||
if (!Defines.VERSION.Equals (downloaded_version_number)) {
|
||||
|
||||
if (NewVersionAvailable != null)
|
||||
NewVersionAvailable (downloaded_version_number);
|
||||
|
||||
} else {
|
||||
if (Defines.VERSION.Equals (downloaded_version_number)) {
|
||||
|
||||
if (VersionUpToDate != null)
|
||||
VersionUpToDate ();
|
||||
} else {
|
||||
|
||||
if (NewVersionAvailable != null)
|
||||
NewVersionAvailable (downloaded_version_number);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue