eventlog: removing some now redundant threading logic
This commit is contained in:
parent
1530c9a9af
commit
c7eefd9d4e
|
@ -262,52 +262,35 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void UpdateContent (string html)
|
public void UpdateContent (string html)
|
||||||
{
|
{
|
||||||
Thread thread = new Thread (() => {
|
string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps");
|
||||||
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 ("<!-- $body-font-size -->", (double) (Style.FontDescription.Size / 1024 + 3) + "px");
|
||||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
|
html = html.Replace ("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
|
||||||
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
||||||
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
||||||
html = html.Replace ("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
|
html = html.Replace ("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
|
||||||
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal)));
|
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal)));
|
||||||
html = html.Replace ("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal)));
|
html = html.Replace ("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal)));
|
||||||
html = html.Replace ("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal)));
|
html = html.Replace ("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal)));
|
||||||
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
|
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-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
|
||||||
html = html.Replace ("<!-- $small-font-size -->", "85%");
|
html = html.Replace ("<!-- $small-font-size -->", "85%");
|
||||||
|
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
|
||||||
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-added-background-image -->",
|
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
|
||||||
"file://" + IO.Path.Combine (icons_path, "document-added.png"));
|
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png"));
|
||||||
|
|
||||||
|
this.spinner.Stop ();
|
||||||
|
|
||||||
html = html.Replace ("<!-- $document-edited-background-image -->",
|
this.web_view.NavigationRequested -= WebViewNavigationRequested;
|
||||||
"file://" + IO.Path.Combine (icons_path, "document-edited.png"));
|
this.web_view.LoadHtmlString (html, "file://");
|
||||||
|
this.web_view.NavigationRequested += WebViewNavigationRequested;
|
||||||
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;
|
this.content_wrapper.Remove (this.content_wrapper.Child);
|
||||||
this.web_view.LoadHtmlString (html, "file://");
|
this.content_wrapper.Add (this.scrolled_window);
|
||||||
this.web_view.NavigationRequested += WebViewNavigationRequested;
|
this.content_wrapper.ShowAll ();
|
||||||
|
|
||||||
this.content_wrapper.Remove (this.content_wrapper.Child);
|
|
||||||
this.content_wrapper.Add (this.scrolled_window);
|
|
||||||
this.content_wrapper.ShowAll ();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
thread.Start ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,59 +368,45 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void UpdateContent (string html)
|
public void UpdateContent (string html)
|
||||||
{
|
{
|
||||||
new Thread (() => {
|
using (var a = new NSAutoreleasePool ())
|
||||||
using (var a = new NSAutoreleasePool ())
|
{
|
||||||
{
|
string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps");
|
||||||
string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps");
|
|
||||||
|
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
||||||
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
html = html.Replace ("<!-- $body-font-size -->", "13.4px");
|
||||||
html = html.Replace ("<!-- $body-font-size -->", "13.4px");
|
html = html.Replace ("<!-- $secondary-font-color -->", "#bbb");
|
||||||
html = html.Replace ("<!-- $secondary-font-color -->", "#bbb");
|
html = html.Replace ("<!-- $small-color -->", "#ddd");
|
||||||
html = html.Replace ("<!-- $small-color -->", "#ddd");
|
html = html.Replace ("<!-- $small-font-size -->", "10px");
|
||||||
html = html.Replace ("<!-- $small-font-size -->", "10px");
|
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
|
||||||
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
|
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
||||||
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
||||||
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 ("<!-- $pixmaps-path -->", pixmaps_path);
|
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-added-background-image -->",
|
html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png");
|
||||||
pixmaps_path + "/document-added-12.png");
|
|
||||||
|
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
|
||||||
html = html.Replace ("<!-- $document-deleted-background-image -->",
|
Frame = new RectangleF (new PointF (0, 0),
|
||||||
pixmaps_path + "/document-deleted-12.png");
|
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||||
|
};
|
||||||
html = html.Replace ("<!-- $document-edited-background-image -->",
|
|
||||||
pixmaps_path + "/document-edited-12.png");
|
|
||||||
|
|
||||||
html = html.Replace ("<!-- $document-moved-background-image -->",
|
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
||||||
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))
|
|
||||||
};
|
|
||||||
|
|
||||||
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate ();
|
||||||
|
ContentView.AddSubview (this.web_view);
|
||||||
|
|
||||||
this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate ();
|
(this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked +=
|
||||||
ContentView.AddSubview (this.web_view);
|
delegate (string href) {
|
||||||
|
if (href.StartsWith ("file:///"))
|
||||||
|
href = href.Substring (7);
|
||||||
|
|
||||||
(this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked +=
|
Controller.LinkClicked (href);
|
||||||
delegate (string href) {
|
};
|
||||||
if (href.StartsWith ("file:///"))
|
|
||||||
href = href.Substring (7);
|
|
||||||
|
|
||||||
Controller.LinkClicked (href);
|
this.progress_indicator.Hidden = true;
|
||||||
};
|
}
|
||||||
|
|
||||||
this.progress_indicator.Hidden = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}).Start ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -273,51 +273,35 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void UpdateContent (string html)
|
public void UpdateContent (string html)
|
||||||
{
|
{
|
||||||
new Thread (() => {
|
string pixmaps_path = Path.Combine (SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
|
||||||
string pixmaps_path = Path.Combine (
|
pixmaps_path = pixmaps_path.Replace ("\\", "/");
|
||||||
SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
|
|
||||||
|
|
||||||
pixmaps_path = pixmaps_path.Replace ("\\", "/");
|
|
||||||
|
|
||||||
html = html.Replace ("<a href=", "<a class='windows' href=");
|
|
||||||
html = html.Replace ("<!-- $body-font-family -->", "'Segoe UI', sans-serif");
|
|
||||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13px");
|
|
||||||
html = html.Replace ("<!-- $body-font-size -->", "12px");
|
|
||||||
html = html.Replace ("<!-- $secondary-font-color -->", "#bbb");
|
|
||||||
html = html.Replace ("<!-- $small-color -->", "#ddd");
|
|
||||||
html = html.Replace ("<!-- $small-font-size -->", "90%");
|
|
||||||
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 ("<a href=", "<a class='windows' href=");
|
||||||
|
html = html.Replace ("<!-- $body-font-family -->", "'Segoe UI', sans-serif");
|
||||||
html = html.Replace ("<!-- $document-added-background-image -->",
|
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13px");
|
||||||
pixmaps_path + "/document-added-12.png");
|
html = html.Replace ("<!-- $body-font-size -->", "12px");
|
||||||
|
html = html.Replace ("<!-- $secondary-font-color -->", "#bbb");
|
||||||
html = html.Replace ("<!-- $document-edited-background-image -->",
|
html = html.Replace ("<!-- $small-color -->", "#ddd");
|
||||||
pixmaps_path + "/document-edited-12.png");
|
html = html.Replace ("<!-- $small-font-size -->", "90%");
|
||||||
|
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
|
||||||
html = html.Replace ("<!-- $document-deleted-background-image -->",
|
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
||||||
pixmaps_path + "/document-deleted-12.png");
|
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
||||||
|
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
|
||||||
html = html.Replace ("<!-- $document-moved-background-image -->",
|
html = html.Replace ("<!-- $document-added-background-image -->", pixmaps_path + "/document-added-12.png");
|
||||||
pixmaps_path + "/document-moved-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.spinner.Stop ();
|
|
||||||
|
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
|
||||||
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
|
this.web_browser.NavigateToString (html);
|
||||||
this.web_browser.NavigateToString (html);
|
|
||||||
|
if (!this.canvas.Children.Contains (this.web_browser)) {
|
||||||
if (!this.canvas.Children.Contains (this.web_browser)) {
|
this.canvas.Children.Add (this.web_browser);
|
||||||
this.canvas.Children.Add (this.web_browser);
|
Canvas.SetLeft (this.web_browser, 0);
|
||||||
Canvas.SetLeft (this.web_browser, 0);
|
Canvas.SetTop (this.web_browser, 36);
|
||||||
Canvas.SetTop (this.web_browser, 36);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}).Start ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue