[banshee] Support page titles in the Amazon store



commit 8997347af7c13e13d4025723859cd34b179b88b3
Author: Aaron Bockover <abockover novell com>
Date:   Sat Jul 10 19:15:28 2010 -0400

    Support page titles in the Amazon store

 .../Banshee.AmazonMp3.Store.csproj                 |    2 +-
 .../Banshee.AmazonMp3.Store/WebBrowserShell.cs     |   31 +++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
index 4f2a432..58d8c0f 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
@@ -47,8 +47,8 @@
     <Reference Include="atk-sharp">
       <SpecificVersion>False</SpecificVersion>
     </Reference>
-    <Reference Include="webkit-sharp, Version=1.1.15.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745" />
     <Reference Include="Mono.Cairo" />
+    <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.AmazonMp3.Store.addin.xml">
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/WebBrowserShell.cs b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/WebBrowserShell.cs
index ae63a9c..2f535d7 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/WebBrowserShell.cs
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/WebBrowserShell.cs
@@ -27,6 +27,7 @@
 using System;
 
 using Gtk;
+using Mono.Unix;
 
 using Banshee.WebBrowser;
 
@@ -37,13 +38,29 @@ namespace Banshee.AmazonMp3.Store
         private ScrolledWindow store_view_scroll = new ScrolledWindow ();
         private StoreView store_view = new StoreView ();
         private NavigationControl navigation_control = new NavigationControl ();
+        private Label title = new Label ();
 
         public WebBrowserShell () : base (2, 1, false)
         {
+            store_view.LoadStatusChanged += (o, e) => {
+                if (store_view.LoadStatus == OssiferLoadStatus.FirstVisuallyNonEmptyLayout) {
+                    UpdateTitle (store_view.Title);
+                }
+            };
+
             navigation_control.WebView = store_view;
             navigation_control.GoHomeEvent += (o, e) => store_view.GoHome ();
 
             Attach (navigation_control, 0, 1, 0, 1,
+                AttachOptions.Shrink,
+                AttachOptions.Shrink,
+                0, 0);
+
+            title.Xalign = 0.0f;
+            title.Xpad = 10;
+            title.Ellipsize = Pango.EllipsizeMode.End;
+
+            Attach (title, 1, 2, 0, 1,
                 AttachOptions.Expand | AttachOptions.Fill,
                 AttachOptions.Shrink,
                 0, 0);
@@ -51,12 +68,24 @@ namespace Banshee.AmazonMp3.Store
             store_view_scroll.Add (store_view);
             store_view_scroll.ShadowType = ShadowType.In;
 
-            Attach (store_view_scroll, 0, 1, 1, 2,
+            Attach (store_view_scroll, 0, 2, 1, 2,
                 AttachOptions.Expand | AttachOptions.Fill,
                 AttachOptions.Expand | AttachOptions.Fill,
                 0, 0);
 
+            UpdateTitle (Catalog.GetString ("Loading Amazon MP3 Store..."));
+
             ShowAll ();
         }
+
+        private void UpdateTitle (string titleText)
+        {
+            if (store_view.Uri != "about:blank") {
+                if (String.IsNullOrEmpty (titleText)) {
+                    titleText = Catalog.GetString ("Amazon MP3 Store");
+                }
+                title.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (titleText));
+            }
+        }
     }
 }
\ No newline at end of file



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