mac about log: fix coding style and whitespace

This commit is contained in:
Hylke Bons 2011-05-13 01:08:42 +01:00
parent dfa4ab4675
commit e5fe9de192
2 changed files with 60 additions and 90 deletions

View file

@ -165,7 +165,5 @@ namespace SparkleShare {
ContentView.AddSubview (CreditsButton); ContentView.AddSubview (CreditsButton);
ContentView.AddSubview (WebsiteButton); ContentView.AddSubview (WebsiteButton);
} }
} }
} }

View file

@ -43,7 +43,6 @@ namespace SparkleShare {
public SparkleLog (string path) : base () public SparkleLog (string path) : base ()
{ {
LocalPath = path; LocalPath = path;
Delegate = new SparkleLogDelegate (); Delegate = new SparkleLogDelegate ();
@ -53,12 +52,10 @@ namespace SparkleShare {
// Open slightly off center for each consecutive window // Open slightly off center for each consecutive window
if (SparkleUI.OpenLogs.Count > 0) { if (SparkleUI.OpenLogs.Count > 0) {
RectangleF offset = new RectangleF (Frame.X + (SparkleUI.OpenLogs.Count * 20), RectangleF offset = new RectangleF (Frame.X + (SparkleUI.OpenLogs.Count * 20),
Frame.Y - (SparkleUI.OpenLogs.Count * 20), Frame.Width, Frame.Height); Frame.Y - (SparkleUI.OpenLogs.Count * 20), Frame.Width, Frame.Height);
SetFrame (offset, true); SetFrame (offset, true);
} }
StyleMask = (NSWindowStyle.Closable | StyleMask = (NSWindowStyle.Closable |
@ -74,13 +71,11 @@ namespace SparkleShare {
UpdateEventLog (); UpdateEventLog ();
OrderFrontRegardless (); OrderFrontRegardless ();
} }
private void CreateEventLog () private void CreateEventLog ()
{ {
OpenFolderButton = new NSButton (new RectangleF (16, 12, 120, 32)) { OpenFolderButton = new NSButton (new RectangleF (16, 12, 120, 32)) {
Title = "Open Folder", Title = "Open Folder",
BezelStyle = NSBezelStyle.Rounded , BezelStyle = NSBezelStyle.Rounded ,
@ -132,37 +127,27 @@ namespace SparkleShare {
}; };
Update (); Update ();
} }
public void UpdateEventLog () public void UpdateEventLog ()
{ {
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (HTML == null) if (HTML == null)
ContentView.AddSubview (ProgressIndicator); ContentView.AddSubview (ProgressIndicator);
}); });
Thread thread = new Thread (new ThreadStart (delegate { Thread thread = new Thread (new ThreadStart (delegate {
GenerateHTML (); GenerateHTML ();
AddHTML (); AddHTML ();
})); }));
thread.Start (); thread.Start ();
} }
private void GenerateHTML () private void GenerateHTML ()
{ {
string folder_name = Path.GetFileName (LocalPath); string folder_name = Path.GetFileName (LocalPath);
HTML = SparkleShare.Controller.GetHTMLLog (folder_name); HTML = SparkleShare.Controller.GetHTMLLog (folder_name);
@ -176,15 +161,12 @@ namespace SparkleShare {
HTML = HTML.Replace ("<!-- $a-hover-color -->", "#009ff8"); HTML = HTML.Replace ("<!-- $a-hover-color -->", "#009ff8");
HTML = HTML.Replace ("<!-- $no-buddy-icon-background-image -->", HTML = HTML.Replace ("<!-- $no-buddy-icon-background-image -->",
"file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "avatar-default.png")); "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "avatar-default.png"));
} }
private void AddHTML () private void AddHTML ()
{ {
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (ProgressIndicator.Superview == ContentView) if (ProgressIndicator.Superview == ContentView)
ProgressIndicator.RemoveFromSuperview (); ProgressIndicator.RemoveFromSuperview ();
@ -192,11 +174,8 @@ namespace SparkleShare {
ContentView.AddSubview (WebView); ContentView.AddSubview (WebView);
Update (); Update ();
}); });
} }
} }
@ -204,12 +183,9 @@ namespace SparkleShare {
public override bool WindowShouldClose (NSObject sender) public override bool WindowShouldClose (NSObject sender)
{ {
(sender as SparkleLog).OrderOut (this); (sender as SparkleLog).OrderOut (this);
return false; return false;
} }
} }
@ -218,14 +194,10 @@ namespace SparkleShare {
public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info, public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info,
NSUrlRequest request, WebFrame frame, NSObject decision_token) NSUrlRequest request, WebFrame frame, NSObject decision_token)
{ {
string file_path = request.Url.ToString (); string file_path = request.Url.ToString ();
file_path = file_path.Replace ("%20", " "); file_path = file_path.Replace ("%20", " ");
NSWorkspace.SharedWorkspace.OpenFile (file_path); NSWorkspace.SharedWorkspace.OpenFile (file_path);
} }
} }
} }