mac window: fix coding style and whitespace

This commit is contained in:
Hylke Bons 2011-05-13 00:58:39 +01:00
parent 24e58b1e25
commit de5f86b3a4
3 changed files with 103 additions and 124 deletions

View file

@ -30,20 +30,18 @@ namespace SparkleShare {
public class SparkleWindow : NSWindow { public class SparkleWindow : NSWindow {
private NSImage SideSplash;
private NSImageView SideSplashView;
public List <NSButton> Buttons; public List <NSButton> Buttons;
public string Header; public string Header;
public string Description; public string Description;
private NSImage SideSplash;
private NSImageView SideSplashView;
private NSTextField HeaderTextField; private NSTextField HeaderTextField;
private NSTextField DescriptionTextField; private NSTextField DescriptionTextField;
public SparkleWindow () : base () public SparkleWindow () : base ()
{ {
SetFrame (new RectangleF (0, 0, 640, 380), true); SetFrame (new RectangleF (0, 0, 640, 380), true);
StyleMask = NSWindowStyle.Titled; StyleMask = NSWindowStyle.Titled;
@ -66,10 +64,8 @@ namespace SparkleShare {
Frame = new RectangleF (0, 0, 150, 407) Frame = new RectangleF (0, 0, 150, 407)
}; };
Buttons = new List <NSButton> (); Buttons = new List <NSButton> ();
HeaderTextField = new NSTextField () { HeaderTextField = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48), Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48),
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
@ -87,28 +83,24 @@ namespace SparkleShare {
Font = SparkleUI.Font Font = SparkleUI.Font
}; };
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
MakeKeyAndOrderFront (this); MakeKeyAndOrderFront (this);
OrderFrontRegardless (); OrderFrontRegardless ();
} }
public void Reset () { public void Reset ()
{
ContentView.Subviews = new NSView [0]; ContentView.Subviews = new NSView [0];
Buttons = new List <NSButton> (); Buttons = new List <NSButton> ();
Header = ""; Header = "";
Description = ""; Description = "";
} }
public void ShowAll () { public void ShowAll ()
{
HeaderTextField.StringValue = Header; HeaderTextField.StringValue = Header;
DescriptionTextField.StringValue = Description; DescriptionTextField.StringValue = Description;
@ -120,50 +112,38 @@ namespace SparkleShare {
ContentView.AddSubview (SideSplashView); ContentView.AddSubview (SideSplashView);
int i = 1; int i = 1;
if (Buttons.Count > 0) { if (Buttons.Count > 0) {
DefaultButtonCell = Buttons [0].Cell; DefaultButtonCell = Buttons [0].Cell;
foreach (NSButton button in Buttons) { foreach (NSButton button in Buttons) {
button.BezelStyle = NSBezelStyle.Rounded; button.BezelStyle = NSBezelStyle.Rounded;
button.Frame = new RectangleF (Frame.Width - 15 - (105 * i), 12, 105, 32); button.Frame = new RectangleF (Frame.Width - 15 - (105 * i), 12, 105, 32);
// Make the button a bit wider if the text is
// likely to be longer
if (button.Title.Contains (" ")) if (button.Title.Contains (" "))
button.Frame = new RectangleF (Frame.Width - 30 - (105 * i), 12, 120, 32); button.Frame = new RectangleF (Frame.Width - 30 - (105 * i), 12, 120, 32);
button.Font = SparkleUI.Font; button.Font = SparkleUI.Font;
ContentView.AddSubview (button); ContentView.AddSubview (button);
i++; i++;
} }
} }
} }
public override void OrderFrontRegardless () public override void OrderFrontRegardless ()
{ {
NSApplication.SharedApplication.AddWindowsItem (this, "SparkleShare Setup", false); NSApplication.SharedApplication.AddWindowsItem (this, "SparkleShare Setup", false);
base.OrderFrontRegardless (); base.OrderFrontRegardless ();
} }
public override void PerformClose (NSObject sender) public override void PerformClose (NSObject sender)
{ {
OrderOut (this); OrderOut (this);
NSApplication.SharedApplication.RemoveWindowsItem (this); NSApplication.SharedApplication.RemoveWindowsItem (this);
return; return;
} }
} }
} }

View file

@ -182,7 +182,6 @@ namespace SparkleShare {
// TODO: remove this later // TODO: remove this later
private void MigrateConfig () { private void MigrateConfig () {
string global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config.xml");
string old_global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config"); string old_global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config");
StreamReader reader = new StreamReader (old_global_config_file_path); StreamReader reader = new StreamReader (old_global_config_file_path);