[banshee/recs: 3/4] Moved TitltedList out of Banshee.Lastfm, and added override for Banshee.Web.Browser.Open to say if t



commit 75c1540e0a373766156b1030d9a3dea5ed6465fc
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Mon May 11 09:06:02 2009 -0500

    Moved TitltedList out of Banshee.Lastfm, and added override for Banshee.Web.Browser.Open to say if the url has already been escaped
---
 .../Banshee.Gui.Widgets/ContextPane.cs             |   10 ++-
 .../Banshee.Gui.Widgets/TitledList.cs              |   67 ++++++++++++++++++++
 .../Banshee.ThickClient/Banshee.ThickClient.csproj |    1 +
 src/Core/Banshee.ThickClient/Makefile.am           |    1 +
 .../Banshee.Lastfm.Radio/LastfmSourceContents.cs   |   32 +---------
 .../RecommendationPane.cs                          |    1 +
 6 files changed, 78 insertions(+), 34 deletions(-)

diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ContextPane.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ContextPane.cs
index fd9109a..c14a588 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ContextPane.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ContextPane.cs
@@ -61,6 +61,7 @@ namespace Banshee.Gui.Widgets
 
         private void OnExtensionChanged (object o, ExtensionNodeEventArgs args) 
         {
+            Hyena.Log.InformationFormat ("Got contextPanePage node {0}", args.Path);
             TypeExtensionNode node = (TypeExtensionNode)args.ExtensionNode;
             var page = (ContextPanePage) (node.GetInstance () ?? node.CreateInstance ());
             
@@ -83,7 +84,7 @@ namespace Banshee.Gui.Widgets
         private RadioButton radio_group = new RadioButton (null, "");
 
         private Dictionary<ContextPanePage, RadioButton> pane_tabs = new Dictionary<ContextPanePage, RadioButton> ();
-        //private Dictionary<
+        private Dictionary<ContextPanePage, Widget> pane_pages = new Dictionary<ContextPanePage, Widget> ();
         
         public ContextPane ()
         {
@@ -107,11 +108,13 @@ namespace Banshee.Gui.Widgets
 
         public void AddPage (ContextPanePage page)
         {
+            Hyena.Log.DebugFormat ("Adding context page {0}", page.Id);
             var frame = new Hyena.Widgets.RoundedFrame ();
             frame.Add (page.Widget);
             frame.Show ();
             page.Widget.Show ();
             notebook.AppendPage (frame, null);
+            pane_pages[page] = frame;
 
             var tab_image = new Image (IconThemeUtils.LoadIcon (22, page.IconNames));
             var toggle_button = new RadioButton (radio_group) {
@@ -119,7 +122,7 @@ namespace Banshee.Gui.Widgets
                 DrawIndicator = false
             };
             toggle_button.Relief = ReliefStyle.None;
-            toggle_button.Clicked += (s, e) => notebook.CurrentPage = notebook.PageNum (page.Widget);
+            toggle_button.Clicked += (s, e) => notebook.CurrentPage = notebook.PageNum (pane_pages[page]);
             
             TooltipSetter.Set (tooltip_host, toggle_button, page.Name);
 
@@ -134,9 +137,10 @@ namespace Banshee.Gui.Widgets
 
         public void RemovePage (ContextPanePage page)
         {
-            notebook.RemovePage (notebook.PageNum (page.Widget));
+            notebook.RemovePage (notebook.PageNum (pane_pages[page]));
             vbox.Remove (pane_tabs[page]);
             pane_tabs.Remove (page);
+            pane_pages.Remove (page);
         }
     }
 }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TitledList.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TitledList.cs
new file mode 100644
index 0000000..afc9e92
--- /dev/null
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TitledList.cs
@@ -0,0 +1,67 @@
+//
+// TitledList.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Gtk;
+
+namespace Banshee.Gui.Widgets
+{
+    public class TitledList : VBox
+    {
+        private Label title;
+
+        public string Title {
+            get { return title.Text; }
+            set {
+                title.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (value));
+            }
+        }
+
+        public int TitleWidthChars {
+            get { return title.WidthChars; }
+            set { title.WidthChars = value; }
+        }
+
+        public TitledList (string title_str) : base (false, 3)
+        {
+            title = new Label ();
+            title.Xalign = 0;
+            title.Ellipsize = Pango.EllipsizeMode.End;
+            Title = title_str;
+
+            PackStart (title, false, false, 0);
+            title.Show ();
+
+            StyleSet += delegate {
+                title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
+                title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
+            };
+        }
+    }
+}
diff --git a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
index b14d088..006334e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
+++ b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
@@ -229,6 +229,7 @@
     <Compile Include="Banshee.Preferences.Gui\PageComboBox.cs" />
     <Compile Include="Banshee.Gui.TrackEditor\LicenseEntry.cs" />
     <Compile Include="Banshee.Gui.Widgets\ContextPane.cs" />
+    <Compile Include="Banshee.Gui.Widgets\TitledList.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
diff --git a/src/Core/Banshee.ThickClient/Makefile.am b/src/Core/Banshee.ThickClient/Makefile.am
index 845b261..8afe5f0 100644
--- a/src/Core/Banshee.ThickClient/Makefile.am
+++ b/src/Core/Banshee.ThickClient/Makefile.am
@@ -92,6 +92,7 @@ SOURCES =  \
 	Banshee.Gui.Widgets/PlaylistMenuItem.cs \
 	Banshee.Gui.Widgets/RepeatActionButton.cs \
 	Banshee.Gui.Widgets/TaskStatusIcon.cs \
+	Banshee.Gui.Widgets/TitledList.cs \
 	Banshee.Gui.Widgets/TrackInfoDisplay.cs \
 	Banshee.Gui.Widgets/UserJobTile.cs \
 	Banshee.Gui.Widgets/UserJobTileHost.cs \
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
index a2c6786..3060521 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSourceContents.cs
@@ -11,6 +11,7 @@ using Banshee.ServiceStack;
 using Banshee.Collection;
 using Banshee.Collection.Gui;
 using Banshee.Gui;
+using Banshee.Gui.Widgets;
 using Banshee.Sources.Gui;
 using Banshee.Web;
 
@@ -267,36 +268,5 @@ namespace Banshee.Lastfm.Radio
         }
     }
 
-    public class TitledList : VBox
-    {
-        private Label title;
-
-        public string Title {
-            get { return title.Text; }
-            set {
-                title.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (value));
-            }
-        }
 
-        public int TitleWidthChars {
-            get { return title.WidthChars; }
-            set { title.WidthChars = value; }
-        }
-
-        public TitledList (string title_str) : base (false, 3)
-        {
-            title = new Label ();
-            title.Xalign = 0;
-            title.Ellipsize = Pango.EllipsizeMode.End;
-            Title = title_str;
-
-            PackStart (title, false, false, 0);
-            title.Show ();
-
-            StyleSet += delegate {
-                title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
-                title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
-            };
-        }
-    }
 }
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
index 5a824ee..3682c92 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Recommendations/RecommendationPane.cs
@@ -51,6 +51,7 @@ using Banshee.Base;
 using Banshee.Configuration;
 using Banshee.ServiceStack;
 using Banshee.Gui;
+using Banshee.Gui.Widgets;
 using Banshee.Networking;
 
 using Banshee.Collection;



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