[banshee] Wikipedia: Delay loading webkit until needed



commit 3a60ae29c0899254be7845c774571011e7260667
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Apr 12 18:16:32 2011 -0500

    Wikipedia: Delay loading webkit until needed

 .../Banshee.Wikipedia/ContextPage.cs               |   13 +++++------
 .../Banshee.Wikipedia/WikipediaView.cs             |   21 +++++++++++++++----
 2 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs
index 5637252..61ffc05 100644
--- a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs
@@ -52,17 +52,16 @@ namespace Banshee.Wikipedia
             }
         }
 
+        internal void SetLoaded ()
+        {
+            State = ContextState.Loaded;
+        }
+
         private WikipediaView view;
         public override Widget Widget {
             get {
                 if (view == null) {
-                    view = new WikipediaView ();
-                    view.view.LoadStatusChanged += delegate {
-                        if (view.view.LoadStatus == Banshee.WebBrowser.OssiferLoadStatus.FirstVisuallyNonEmptyLayout) {
-                            State = ContextState.Loaded;
-                        }
-                    };
-                    view.ShowAll ();
+                    view = new WikipediaView (this);
                 }
                 return view;
             }
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs
index 82ec80e..0a5eb09 100644
--- a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs
@@ -35,6 +35,7 @@ using Hyena;
 using Banshee.ServiceStack;
 using Banshee.MediaEngine;
 using Banshee.Collection;
+using Banshee.ContextPane;
 
 using Banshee.Gui;
 
@@ -47,13 +48,12 @@ namespace Banshee.Wikipedia
         // Translators: this is used for looking up artist pages on Wikipedia; change to your wikipedia language if you want
         private string url_format = Catalog.GetString ("http://en.wikipedia.org/wiki/{0}";);
 
-        internal OssiferWebView view;
+        private OssiferWebView view;
+        private ContextPage page;
 
-        public WikipediaView ()
+        public WikipediaView (ContextPage page)
         {
-            view = new OssiferWebView ();
-
-            Add (view);
+            this.page = page;
         }
 
         private string last_artist;
@@ -75,6 +75,17 @@ namespace Banshee.Wikipedia
         private void OpenUrl (string uri)
         {
             Hyena.Log.DebugFormat ("Opening {0}", uri);
+
+            if (view == null) {
+                view = new OssiferWebView ();
+                view.LoadStatusChanged += delegate {
+                    if (view.LoadStatus == Banshee.WebBrowser.OssiferLoadStatus.FirstVisuallyNonEmptyLayout) {
+                        page.SetLoaded ();
+                    }
+                };
+                Add (view);
+                ShowAll ();
+            }
             view.LoadUri (uri);
         }
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]