log: fix coding style and whitespace
This commit is contained in:
parent
9901ca56ba
commit
a38442caf6
|
@ -50,7 +50,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleLog (string path) : base ("")
|
public SparkleLog (string path) : base ("")
|
||||||
{
|
{
|
||||||
|
|
||||||
LocalPath = path;
|
LocalPath = path;
|
||||||
|
|
||||||
string name = System.IO.Path.GetFileName (LocalPath);
|
string name = System.IO.Path.GetFileName (LocalPath);
|
||||||
|
@ -78,12 +77,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
CreateEventLog ();
|
CreateEventLog ();
|
||||||
UpdateEventLog ();
|
UpdateEventLog ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CreateEventLog () {
|
private void CreateEventLog ()
|
||||||
|
{
|
||||||
LogContent = new EventBox ();
|
LogContent = new EventBox ();
|
||||||
VBox layout_vertical = new VBox (false, 0);
|
VBox layout_vertical = new VBox (false, 0);
|
||||||
|
|
||||||
|
@ -97,21 +95,16 @@ namespace SparkleShare {
|
||||||
LinkStatus = args.Link;
|
LinkStatus = args.Link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: Use the right event, waiting for newer webkit bindings
|
||||||
WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) {
|
WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) {
|
||||||
|
|
||||||
if (args.Request.Uri == LinkStatus) {
|
if (args.Request.Uri == LinkStatus) {
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "xdg-open";
|
process.StartInfo.FileName = "xdg-open";
|
||||||
process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters
|
process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
// FIXME: Use the right event, waiting for newer webkit bindings
|
|
||||||
|
|
||||||
UpdateEventLog ();
|
UpdateEventLog ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ScrolledWindow.AddWithViewport (WebView);
|
ScrolledWindow.AddWithViewport (WebView);
|
||||||
|
@ -119,7 +112,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
layout_vertical.PackStart (LogContent, true, true, 0);
|
layout_vertical.PackStart (LogContent, true, true, 0);
|
||||||
|
|
||||||
|
|
||||||
HButtonBox dialog_buttons = new HButtonBox {
|
HButtonBox dialog_buttons = new HButtonBox {
|
||||||
Layout = ButtonBoxStyle.Edge,
|
Layout = ButtonBoxStyle.Edge,
|
||||||
BorderWidth = 12
|
BorderWidth = 12
|
||||||
|
@ -130,12 +122,10 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "xdg-open";
|
process.StartInfo.FileName = "xdg-open";
|
||||||
process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters
|
process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Button close_button = new Button (Stock.Close);
|
Button close_button = new Button (Stock.Close);
|
||||||
|
@ -154,38 +144,29 @@ namespace SparkleShare {
|
||||||
Add (layout_vertical);
|
Add (layout_vertical);
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateEventLog ()
|
public void UpdateEventLog ()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (HTML == null) { // TODO: there may be a race condition here
|
if (HTML == null) { // TODO: there may be a race condition here
|
||||||
|
|
||||||
LogContent.Remove (LogContent.Child);
|
LogContent.Remove (LogContent.Child);
|
||||||
Spinner = new SparkleSpinner (22);
|
Spinner = new SparkleSpinner (22);
|
||||||
LogContent.Add (Spinner);
|
LogContent.Add (Spinner);
|
||||||
LogContent.ShowAll ();
|
LogContent.ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ()
|
||||||
|
{
|
||||||
HTML = SparkleShare.Controller.GetHTMLLog (System.IO.Path.GetFileName (LocalPath));
|
HTML = SparkleShare.Controller.GetHTMLLog (System.IO.Path.GetFileName (LocalPath));
|
||||||
|
|
||||||
HTML = HTML.Replace ("<!-- $body-font-size -->", (double) (Style.FontDescription.Size / 1024 + 3) + "px");
|
HTML = HTML.Replace ("<!-- $body-font-size -->", (double) (Style.FontDescription.Size / 1024 + 3) + "px");
|
||||||
|
@ -201,15 +182,12 @@ namespace SparkleShare {
|
||||||
HTML = HTML.Replace ("<!-- $no-buddy-icon-background-image -->", "file://" +
|
HTML = HTML.Replace ("<!-- $no-buddy-icon-background-image -->", "file://" +
|
||||||
SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons",
|
SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons",
|
||||||
"hicolor", "32x32", "status", "avatar-default.png"));
|
"hicolor", "32x32", "status", "avatar-default.png"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AddHTML ()
|
private void AddHTML ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
|
||||||
Spinner.Stop ();
|
Spinner.Stop ();
|
||||||
LogContent.Remove (LogContent.Child);
|
LogContent.Remove (LogContent.Child);
|
||||||
|
|
||||||
|
@ -228,25 +206,20 @@ namespace SparkleShare {
|
||||||
|
|
||||||
LogContent.Add (ScrolledWindow);
|
LogContent.Add (ScrolledWindow);
|
||||||
LogContent.ShowAll ();
|
LogContent.ShowAll ();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Close (object o, DeleteEventArgs args)
|
public void Close (object o, DeleteEventArgs args)
|
||||||
{
|
{
|
||||||
|
|
||||||
HideAll ();
|
HideAll ();
|
||||||
args.RetVal = true;
|
args.RetVal = true;
|
||||||
// FIXME: window positions aren't saved
|
// TODO: window positions aren't saved
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private MenuBar CreateShortcutsBar () {
|
private MenuBar CreateShortcutsBar ()
|
||||||
|
{
|
||||||
// Adds a hidden menubar that contains to enable keyboard
|
// Adds a hidden menubar that contains to enable keyboard
|
||||||
// shortcuts to close the log
|
// shortcuts to close the log
|
||||||
MenuBar = new MenuBar ();
|
MenuBar = new MenuBar ();
|
||||||
|
@ -286,10 +259,6 @@ namespace SparkleShare {
|
||||||
MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal));
|
MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal));
|
||||||
|
|
||||||
return MenuBar;
|
return MenuBar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue