[about] hook up VersionUpToDate event
This commit is contained in:
parent
2f4922d5b7
commit
86b1f3fcac
|
@ -34,6 +34,7 @@ namespace SparkleShare {
|
||||||
private NSBox Box;
|
private NSBox Box;
|
||||||
private NSTextField HeaderTextField;
|
private NSTextField HeaderTextField;
|
||||||
private NSTextField VersionTextField;
|
private NSTextField VersionTextField;
|
||||||
|
private NSTextField UpdatesTextField;
|
||||||
private NSTextField CreditsTextField;
|
private NSTextField CreditsTextField;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,20 +42,37 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleAbout () : base ()
|
public SparkleAbout () : base ()
|
||||||
{
|
{
|
||||||
|
SetFrame (new RectangleF (0, 0, 360, 288), true);
|
||||||
SetFrame (new RectangleF (0, 0, 360, 260), true);
|
|
||||||
Center ();
|
Center ();
|
||||||
|
|
||||||
StyleMask = (NSWindowStyle.Closable |
|
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled);
|
||||||
NSWindowStyle.Titled);
|
Title = "About SparkleShare";
|
||||||
|
MaxSize = new SizeF (360, 288);
|
||||||
Title = "About SparkleShare";
|
MinSize = new SizeF (360, 288);
|
||||||
|
|
||||||
MaxSize = new SizeF (360, 260);
|
|
||||||
MinSize = new SizeF (360, 260);
|
|
||||||
HasShadow = true;
|
HasShadow = true;
|
||||||
BackingType = NSBackingStore.Buffered;
|
BackingType = NSBackingStore.Buffered;
|
||||||
|
|
||||||
|
CreateAbout ();
|
||||||
|
MakeKeyAndOrderFront (this);
|
||||||
|
|
||||||
|
SparkleShare.Controller.NewVersionAvailable += delegate (string new_version) {
|
||||||
|
InvokeOnMainThread (delegate {
|
||||||
|
UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!";
|
||||||
|
UpdatesTextField.TextColor = NSColor.FromCalibratedRgba (0.96f, 0.47f, 0.0f, 1.0f); // Tango Orange #2
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
SparkleShare.Controller.VersionUpToDate += delegate {
|
||||||
|
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
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CreateAbout ()
|
||||||
|
{
|
||||||
Box = new NSBox () {
|
Box = new NSBox () {
|
||||||
FillColor = NSColor.White,
|
FillColor = NSColor.White,
|
||||||
Frame = new RectangleF (-1, Frame.Height - 105, Frame.Width + 2, 105),
|
Frame = new RectangleF (-1, Frame.Height - 105, Frame.Width + 2, 105),
|
||||||
|
@ -82,13 +100,24 @@ namespace SparkleShare {
|
||||||
TextColor = NSColor.DisabledControlText
|
TextColor = NSColor.DisabledControlText
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UpdatesTextField = new NSTextField () {
|
||||||
|
StringValue = "Checking for updates...",
|
||||||
|
Frame = new RectangleF (22, Frame.Height - 222, 318, 98),
|
||||||
|
BackgroundColor = NSColor.WindowBackground,
|
||||||
|
Bordered = false,
|
||||||
|
Editable = false,
|
||||||
|
Font = NSFontManager.SharedFontManager.FontWithFamily
|
||||||
|
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
|
||||||
|
TextColor = NSColor.DisabledControlText
|
||||||
|
};
|
||||||
|
|
||||||
CreditsTextField = new NSTextField () {
|
CreditsTextField = new NSTextField () {
|
||||||
StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" +
|
StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it " +
|
"SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it " +
|
||||||
"under the GNU General Public License version 3 or later.",
|
"under the GNU General Public License version 3 or later.",
|
||||||
Frame = new RectangleF (22, Frame.Height - 222, 318, 98),
|
Frame = new RectangleF (22, Frame.Height - 250, 318, 98),
|
||||||
BackgroundColor = NSColor.WindowBackground,
|
BackgroundColor = NSColor.WindowBackground,
|
||||||
Bordered = false,
|
Bordered = false,
|
||||||
Editable = false,
|
Editable = false,
|
||||||
|
@ -127,12 +156,10 @@ namespace SparkleShare {
|
||||||
ContentView.AddSubview (Box);
|
ContentView.AddSubview (Box);
|
||||||
ContentView.AddSubview (HeaderTextField);
|
ContentView.AddSubview (HeaderTextField);
|
||||||
ContentView.AddSubview (VersionTextField);
|
ContentView.AddSubview (VersionTextField);
|
||||||
|
ContentView.AddSubview (UpdatesTextField);
|
||||||
ContentView.AddSubview (CreditsTextField);
|
ContentView.AddSubview (CreditsTextField);
|
||||||
ContentView.AddSubview (CreditsButton);
|
ContentView.AddSubview (CreditsButton);
|
||||||
ContentView.AddSubview (WebsiteButton);
|
ContentView.AddSubview (WebsiteButton);
|
||||||
|
|
||||||
MakeKeyAndOrderFront (this);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Font = NSFontManager.SharedFontManager.FontWithFamily
|
Font = NSFontManager.SharedFontManager.FontWithFamily
|
||||||
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
||||||
|
|
||||||
|
// new SparkleAbout ();
|
||||||
|
|
||||||
OpenLogs = new List <SparkleLog> ();
|
OpenLogs = new List <SparkleLog> ();
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
|
|
|
@ -50,17 +50,29 @@ namespace SparkleShare {
|
||||||
Resizable = false;
|
Resizable = false;
|
||||||
|
|
||||||
CreateAbout ();
|
CreateAbout ();
|
||||||
|
|
||||||
SparkleShare.Controller.CheckForNewVersion ();
|
SparkleShare.Controller.CheckForNewVersion ();
|
||||||
|
|
||||||
SparkleShare.Controller.NewVersionAvailable += delegate (string new_version) {
|
SparkleShare.Controller.NewVersionAvailable += delegate (string new_version) {
|
||||||
|
|
||||||
ApplicationId.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
|
||||||
Version.Markup = "<small><span fgcolor='#f57900'>A newer version (" + new_version + ") is available!</span></small>";
|
Version.Markup = "<small><span fgcolor='#f57900'>A newer version (" + new_version + ") is available!</span></small>";
|
||||||
Version.ShowAll ();
|
Version.ShowAll ();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
SparkleShare.Controller.VersionUpToDate += delegate {
|
||||||
|
|
||||||
|
Application.Invoke (delegate {
|
||||||
|
|
||||||
|
Version.Markup = "<small><span fgcolor='#73d216'>You are running the latest version.</span></small>";
|
||||||
|
Version.ShowAll ();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,7 +93,6 @@ namespace SparkleShare {
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
Xpad = 18,
|
Xpad = 18,
|
||||||
Ypad = 18
|
Ypad = 18
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
box.Add (header);
|
box.Add (header);
|
||||||
|
|
Loading…
Reference in a new issue