diff --git a/SparkleShare/Linux/SparkleEventLog.cs b/SparkleShare/Linux/SparkleEventLog.cs index 30a0d390..85b3ebbe 100755 --- a/SparkleShare/Linux/SparkleEventLog.cs +++ b/SparkleShare/Linux/SparkleEventLog.cs @@ -262,52 +262,35 @@ 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 pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps"); + string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine (); - html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); - html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); - html = html.Replace ("", "#0085cf"); - html = html.Replace ("", "#009ff8"); - html = html.Replace ("", "\"" + Style.FontDescription.Family + "\""); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - html = html.Replace ("", "85%"); - - html = html.Replace ("", pixmaps_path); - - html = html.Replace ("", - "file://" + IO.Path.Combine (icons_path, "document-added.png")); + html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); + html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); + html = html.Replace ("", "#0085cf"); + html = html.Replace ("", "#009ff8"); + html = html.Replace ("", "\"" + Style.FontDescription.Family + "\""); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + html = html.Replace ("", "85%"); + html = html.Replace ("", pixmaps_path); + html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-added.png")); + html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-edited.png")); + html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-deleted.png")); + html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-moved.png")); + + this.spinner.Stop (); - html = html.Replace ("", - "file://" + IO.Path.Combine (icons_path, "document-edited.png")); - - html = html.Replace ("", - "file://" + IO.Path.Combine (icons_path, "document-deleted.png")); - - html = html.Replace ("", - "file://" + IO.Path.Combine (icons_path, "document-moved.png")); - - - Application.Invoke (delegate { - this.spinner.Stop (); + this.web_view.NavigationRequested -= WebViewNavigationRequested; + this.web_view.LoadHtmlString (html, "file://"); + this.web_view.NavigationRequested += WebViewNavigationRequested; - this.web_view.NavigationRequested -= WebViewNavigationRequested; - this.web_view.LoadHtmlString (html, "file://"); - this.web_view.NavigationRequested += WebViewNavigationRequested; - - this.content_wrapper.Remove (this.content_wrapper.Child); - this.content_wrapper.Add (this.scrolled_window); - this.content_wrapper.ShowAll (); - }); - }); - - thread.Start (); + this.content_wrapper.Remove (this.content_wrapper.Child); + this.content_wrapper.Add (this.scrolled_window); + this.content_wrapper.ShowAll (); } } } diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 7c2cde07..03d6a8a0 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -368,59 +368,45 @@ namespace SparkleShare { public void UpdateContent (string html) { - new Thread (() => { - using (var a = new NSAutoreleasePool ()) - { - string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps"); - - html = html.Replace ("", "Lucida Grande"); - html = html.Replace ("", "13.6px"); - html = html.Replace ("", "13.4px"); - html = html.Replace ("", "#bbb"); - html = html.Replace ("", "#ddd"); - html = html.Replace ("", "10px"); - html = html.Replace ("", "#f5f5f5"); - html = html.Replace ("", "#0085cf"); - html = html.Replace ("", "#009ff8"); - - html = html.Replace ("", pixmaps_path); - - html = html.Replace ("", - pixmaps_path + "/document-added-12.png"); - - html = html.Replace ("", - pixmaps_path + "/document-deleted-12.png"); - - html = html.Replace ("", - pixmaps_path + "/document-edited-12.png"); + using (var a = new NSAutoreleasePool ()) + { + string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps"); + + html = html.Replace ("", "Lucida Grande"); + html = html.Replace ("", "13.6px"); + html = html.Replace ("", "13.4px"); + html = html.Replace ("", "#bbb"); + html = html.Replace ("", "#ddd"); + html = html.Replace ("", "10px"); + html = html.Replace ("", "#f5f5f5"); + html = html.Replace ("", "#0085cf"); + html = html.Replace ("", "#009ff8"); + html = html.Replace ("", pixmaps_path); + html = html.Replace ("", pixmaps_path + "/document-added-12.png"); + html = html.Replace ("", pixmaps_path + "/document-deleted-12.png"); + html = html.Replace ("", pixmaps_path + "/document-edited-12.png"); + html = html.Replace ("", pixmaps_path + "/document-moved-12.png"); + + 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)) + }; - html = html.Replace ("", - 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.MainFrame.LoadHtmlString (html, new NSUrl ("")); + this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate (); + ContentView.AddSubview (this.web_view); - this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate (); - ContentView.AddSubview (this.web_view); + (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked += + delegate (string href) { + if (href.StartsWith ("file:///")) + href = href.Substring (7); - (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked += - delegate (string href) { - if (href.StartsWith ("file:///")) - href = href.Substring (7); + Controller.LinkClicked (href); + }; - Controller.LinkClicked (href); - }; - - this.progress_indicator.Hidden = true; - }); - } - - }).Start (); + this.progress_indicator.Hidden = true; + } } diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index c77bc074..423de842 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -273,51 +273,35 @@ namespace SparkleShare { public void UpdateContent (string html) { - new Thread (() => { - string pixmaps_path = Path.Combine ( - SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps"); - - pixmaps_path = pixmaps_path.Replace ("\\", "/"); - - html = html.Replace ("", "'Segoe UI', sans-serif"); - html = html.Replace ("", "13px"); - html = html.Replace ("", "12px"); - html = html.Replace ("", "#bbb"); - html = html.Replace ("", "#ddd"); - html = html.Replace ("", "90%"); - html = html.Replace ("", "#f5f5f5"); - html = html.Replace ("", "#0085cf"); - html = html.Replace ("", "#009ff8"); + string pixmaps_path = Path.Combine (SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps"); + pixmaps_path = pixmaps_path.Replace ("\\", "/"); - html = html.Replace ("", pixmaps_path); - - html = html.Replace ("", - pixmaps_path + "/document-added-12.png"); - - html = html.Replace ("", - pixmaps_path + "/document-edited-12.png"); - - html = html.Replace ("", - pixmaps_path + "/document-deleted-12.png"); - - html = html.Replace ("", - pixmaps_path + "/document-moved-12.png"); + html = html.Replace ("", "'Segoe UI', sans-serif"); + html = html.Replace ("", "13px"); + html = html.Replace ("", "12px"); + html = html.Replace ("", "#bbb"); + html = html.Replace ("", "#ddd"); + html = html.Replace ("", "90%"); + html = html.Replace ("", "#f5f5f5"); + html = html.Replace ("", "#0085cf"); + html = html.Replace ("", "#009ff8"); + html = html.Replace ("", pixmaps_path); + html = html.Replace ("", pixmaps_path + "/document-added-12.png"); + html = html.Replace ("", pixmaps_path + "/document-edited-12.png"); + html = html.Replace ("", pixmaps_path + "/document-deleted-12.png"); + html = html.Replace ("", pixmaps_path + "/document-moved-12.png"); - Dispatcher.BeginInvoke ((Action) delegate { - this.spinner.Stop (); - - this.web_browser.ObjectForScripting = new SparkleScriptingObject (); - this.web_browser.NavigateToString (html); - - if (!this.canvas.Children.Contains (this.web_browser)) { - this.canvas.Children.Add (this.web_browser); - Canvas.SetLeft (this.web_browser, 0); - Canvas.SetTop (this.web_browser, 36); - } - }); - - }).Start (); + this.spinner.Stop (); + + this.web_browser.ObjectForScripting = new SparkleScriptingObject (); + this.web_browser.NavigateToString (html); + + if (!this.canvas.Children.Contains (this.web_browser)) { + this.canvas.Children.Add (this.web_browser); + Canvas.SetLeft (this.web_browser, 0); + Canvas.SetTop (this.web_browser, 36); + } }