eventlog: removing some now redundant threading logic

This commit is contained in:
Hylke Bons 2012-10-22 14:01:47 +01:00
parent 1530c9a9af
commit c7eefd9d4e
3 changed files with 87 additions and 134 deletions

View file

@ -262,10 +262,8 @@ namespace SparkleShare {
public void UpdateContent (string html)
{
Thread thread = new Thread (() => {
string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps");
string icons_path = new string [] {SparkleUI.AssetsPath, "icons",
"hicolor", "12x12", "status"}.Combine ();
string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
html = html.Replace ("<!-- $body-font-size -->", (double) (Style.FontDescription.Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
@ -278,23 +276,12 @@ namespace SparkleShare {
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
html = html.Replace ("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
html = html.Replace ("<!-- $small-font-size -->", "85%");
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
html = html.Replace ("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-added.png"));
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-edited.png"));
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png"));
html = html.Replace ("<!-- $document-added-background-image -->",
"file://" + IO.Path.Combine (icons_path, "document-added.png"));
html = html.Replace ("<!-- $document-edited-background-image -->",
"file://" + IO.Path.Combine (icons_path, "document-edited.png"));
html = html.Replace ("<!-- $document-deleted-background-image -->",
"file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
html = html.Replace ("<!-- $document-moved-background-image -->",
"file://" + IO.Path.Combine (icons_path, "document-moved.png"));
Application.Invoke (delegate {
this.spinner.Stop ();
this.web_view.NavigationRequested -= WebViewNavigationRequested;
@ -304,10 +291,6 @@ namespace SparkleShare {
this.content_wrapper.Remove (this.content_wrapper.Child);
this.content_wrapper.Add (this.scrolled_window);
this.content_wrapper.ShowAll ();
});
});
thread.Start ();
}
}
}

View file

@ -368,7 +368,6 @@ namespace SparkleShare {
public void UpdateContent (string html)
{
new Thread (() => {
using (var a = new NSAutoreleasePool ())
{
string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps");
@ -382,22 +381,12 @@ namespace SparkleShare {
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
html = html.Replace ("<!-- $document-added-background-image -->", pixmaps_path + "/document-added-12.png");
html = html.Replace ("<!-- $document-deleted-background-image -->", pixmaps_path + "/document-deleted-12.png");
html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png");
html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png");
html = html.Replace ("<!-- $document-added-background-image -->",
pixmaps_path + "/document-added-12.png");
html = html.Replace ("<!-- $document-deleted-background-image -->",
pixmaps_path + "/document-deleted-12.png");
html = html.Replace ("<!-- $document-edited-background-image -->",
pixmaps_path + "/document-edited-12.png");
html = html.Replace ("<!-- $document-moved-background-image -->",
pixmaps_path + "/document-moved-12.png");
InvokeOnMainThread (delegate {
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
Frame = new RectangleF (new PointF (0, 0),
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
@ -417,10 +406,7 @@ namespace SparkleShare {
};
this.progress_indicator.Hidden = true;
});
}
}).Start ();
}

View file

@ -273,10 +273,7 @@ namespace SparkleShare {
public void UpdateContent (string html)
{
new Thread (() => {
string pixmaps_path = Path.Combine (
SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
string pixmaps_path = Path.Combine (SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
pixmaps_path = pixmaps_path.Replace ("\\", "/");
html = html.Replace ("<a href=", "<a class='windows' href=");
@ -289,22 +286,12 @@ namespace SparkleShare {
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
html = html.Replace ("<!-- $document-added-background-image -->", pixmaps_path + "/document-added-12.png");
html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png");
html = html.Replace ("<!-- $document-deleted-background-image -->", pixmaps_path + "/document-deleted-12.png");
html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png");
html = html.Replace ("<!-- $document-added-background-image -->",
pixmaps_path + "/document-added-12.png");
html = html.Replace ("<!-- $document-edited-background-image -->",
pixmaps_path + "/document-edited-12.png");
html = html.Replace ("<!-- $document-deleted-background-image -->",
pixmaps_path + "/document-deleted-12.png");
html = html.Replace ("<!-- $document-moved-background-image -->",
pixmaps_path + "/document-moved-12.png");
Dispatcher.BeginInvoke ((Action) delegate {
this.spinner.Stop ();
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
@ -315,9 +302,6 @@ namespace SparkleShare {
Canvas.SetLeft (this.web_browser, 0);
Canvas.SetTop (this.web_browser, 36);
}
});
}).Start ();
}