[banshee/better-now-playing: 1/16] [NowPlaying] Get context pane into now playing contents



commit d74328cfd2f4195e064cbcf797587a6046df2b43
Author: Alex Launi <alex launi gmail com>
Date:   Fri May 28 12:49:23 2010 -0400

    [NowPlaying] Get context pane into now playing contents
    
    Make clicking a now-playing context button set the now
    playing contents to the context pane.

 .../Banshee.ThickClient/Banshee.ThickClient.csproj |   11 ++++++++
 .../Banshee.NowPlaying/Actions.cs                  |   27 +++++++++++++++----
 .../Banshee.NowPlaying/NowPlayingContents.cs       |    1 +
 .../Banshee.NowPlaying/NowPlayingInterface.cs      |    2 +-
 .../Banshee.NowPlaying/NowPlayingSource.cs         |   10 +++---
 5 files changed, 39 insertions(+), 12 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
index c2802b5..b389433 100644
--- a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
+++ b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
@@ -61,18 +61,23 @@
   <ItemGroup>
     <Reference Include="atk-sharp">
       <SpecificVersion>False</SpecificVersion>
+      <Package>gtk-sharp-2.0</Package>
     </Reference>
     <Reference Include="gdk-sharp">
       <SpecificVersion>False</SpecificVersion>
+      <Package>gtk-sharp-2.0</Package>
     </Reference>
     <Reference Include="glib-sharp">
       <SpecificVersion>False</SpecificVersion>
+      <Package>glib-sharp-2.0</Package>
     </Reference>
     <Reference Include="gtk-sharp">
       <SpecificVersion>False</SpecificVersion>
+      <Package>gtk-sharp-2.0</Package>
     </Reference>
     <Reference Include="pango-sharp">
       <SpecificVersion>False</SpecificVersion>
+      <Package>gtk-sharp-2.0</Package>
     </Reference>
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -87,26 +92,32 @@
     <Reference Include="Mono.Addins">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\Mono.Addins.dll</HintPath>
+      <Package>mono-addins</Package>
     </Reference>
     <Reference Include="Mono.Addins.Gui">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\Mono.Addins.Gui.dll</HintPath>
+      <Package>mono-addins-gui</Package>
     </Reference>
     <Reference Include="Mono.Addins.Setup">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\Mono.Addins.Setup.dll</HintPath>
+      <Package>mono-addins-setup</Package>
     </Reference>
     <Reference Include="NDesk.DBus">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\NDesk.DBus.dll</HintPath>
+      <Package>ndesk-dbus-1.0</Package>
     </Reference>
     <Reference Include="NDesk.DBus.GLib">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\NDesk.DBus.GLib.dll</HintPath>
+      <Package>ndesk-dbus-glib-1.0</Package>
     </Reference>
     <Reference Include="taglib-sharp">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\bin\taglib-sharp.dll</HintPath>
+      <Package>taglib-sharp</Package>
     </Reference>
     <Reference Include="ICSharpCode.SharpZipLib">
       <SpecificVersion>False</SpecificVersion>
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs
index 24c82b1..770d135 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs
@@ -36,30 +36,45 @@ using Hyena.Widgets;
 
 using Banshee.ServiceStack;
 using Banshee.Collection.Database;
+using Banshee.ContextPane;
 using Banshee.Gui;
 
 namespace Banshee.NowPlaying
 {
     public class Actions : BansheeActionGroup
     {
-        public Actions () : base ("NowPlaying")
+        private NowPlayingSource now_playing_source;
+
+        public Actions (NowPlayingSource nowPlayingSource) : base ("NowPlaying")
         {
+            now_playing_source = nowPlayingSource;
+
             Add (new RadioActionEntry [] {
-                new RadioActionEntry ("StandardNpOpen", null, null, null, "Now Playing"),
-                new RadioActionEntry ("LastFmOpen", null, null, null, "Last.fm recommendations"),
-                new RadioActionEntry ("WikipediaOpen", null, null, null, "Wikipedia")
-            }, 2, OnChanged);
+                new RadioActionEntry ("StandardNpOpen", null, null, null, "Now Playing", 0),
+                new RadioActionEntry ("LastFmOpen", null, null, null, "Last.fm recommendations", 1),
+                new RadioActionEntry ("WikipediaOpen", null, null, null, "Wikipedia", 2)
+            }, 0, OnChanged);
 
             this["StandardNpOpen"].IconName = "applications-multimedia";
             this["LastFmOpen"].IconName = "lastfm-audioscrobbler";
             this["WikipediaOpen"].IconName = "wikipedia";
 
             Register ();
+
+            ContextPane = new ContextPane.ContextPane ();
         }
 
         public void OnChanged (System.Object o, ChangedArgs args)
         {
-            Log.DebugFormat ("Changed to {0}", args.Current.CurrentValue);
+            Log.DebugFormat ("There are {0} actions. {1} is current", this.ListActions().Count (), args.Current.CurrentValue);
+
+            if (args.Current.CurrentValue == 0) {
+                now_playing_source.SetSubstituteAudioDisplay (null);
+            } else {
+                now_playing_source.SetSubstituteAudioDisplay (ContextPane);
+            }
         }
+
+        private ContextPane.ContextPane ContextPane { get; set; }
     }
 }
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingContents.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingContents.cs
index 04721af..8716ff8 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingContents.cs
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingContents.cs
@@ -29,6 +29,7 @@
 using System;
 using Gtk;
 
+using Banshee.ContextPane;
 using Banshee.Gui.Widgets;
 
 namespace Banshee.NowPlaying
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
index 3d4261d..7c03469 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
@@ -52,7 +52,7 @@ namespace Banshee.NowPlaying
 
         public NowPlayingInterface ()
         {
-            primary_window = (ServiceManager.Get<GtkElementsService> ()).PrimaryWindow;
+            primary_window = ServiceManager.Get<GtkElementsService> ().PrimaryWindow;
 
             Contents = new NowPlayingContents ();
             Contents.ButtonPressEvent += (o, a) => {
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
index 5a9e0cc..fbbd9bc 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
@@ -73,13 +73,13 @@ namespace Banshee.NowPlaying
             ServiceManager.PlayerEngine.ConnectEvent (OnTrackInfoUpdated, PlayerEvent.TrackInfoUpdated);
             ServiceManager.PlayerEngine.ConnectEvent (OnCreateVideoWindow, PlayerEvent.PrepareVideoWindow);
 
-            Actions = new Actions ();
+            Actions = new Actions (this);
             Actions.Visible = ServiceManager.SourceManager.ActiveSource == this;
 
-            ui_manager = ((InterfaceActionService) ServiceManager.Get<InterfaceActionService> ()).UIManager;
-            ui_manager.AddUiFromString (string.Format (button_xml, "StandardNpOpen"));
-            ui_manager.AddUiFromString (string.Format (button_xml, "LastFmOpen"));
-            ui_manager.AddUiFromString (string.Format (button_xml, "WikipediaOpen"));
+            ui_manager = ServiceManager.Get<InterfaceActionService> ().UIManager;
+            ui_manager.AddUiFromString (String.Format (button_xml, "StandardNpOpen"));
+            ui_manager.AddUiFromString (String.Format (button_xml, "LastFmOpen"));
+            ui_manager.AddUiFromString (String.Format (button_xml, "WikipediaOpen"));
         }
 
         void OnActiveSourceChanged (SourceEventArgs args)



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