banshee r3268 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions/Banshee.Lastfm src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Extensions/Banshee.Lastfm/Resources tests



Author: abock
Date: Tue Feb 19 00:03:47 2008
New Revision: 3268
URL: http://svn.gnome.org/viewvc/banshee?rev=3268&view=rev

Log:
2008-02-18  Aaron Bockover  <abock gnome org>

    * src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs:
    Implement love/hate actions

    * src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml: Add love/hate
    buttons to the header

    * src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs: Allow
    new theme icons to be mapped into stock publicly



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs
   trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
   trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp
   trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am
   trunk/banshee/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml
   trunk/banshee/tests/tests.mdp

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeIconFactory.cs	Tue Feb 19 00:03:47 2008
@@ -56,6 +56,10 @@
             /* Other */
             "cd-action-burn",
             "cd-action-rip",
+            
+            /* Emotes */
+            "face-smile",
+            "face-sad"
         };    
 
         public BansheeIconFactory ()
@@ -79,6 +83,19 @@
             iconSet.AddSource (source);
         }
         
+        public void AddThemeIcon (string iconName)
+        {
+            StockItem item = new StockItem (iconName, null, 0, Gdk.ModifierType.ShiftMask, null);
+            IconSet icon_set = new IconSet ();
+            
+            AddThemeIconToIconSet (iconName, IconSize.Menu, icon_set);
+            AddThemeIconToIconSet (iconName, IconSize.SmallToolbar, icon_set);
+            AddThemeIconToIconSet (iconName, IconSize.Dialog, icon_set);
+            
+            Add (iconName, icon_set);
+            StockManager.Add (item);
+        }
+        
         private void AddThemeIconToIconSet (string stockId, IconSize iconSize, IconSet iconSet)
         {
             try {

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs	Tue Feb 19 00:03:47 2008
@@ -44,6 +44,8 @@
 using Banshee.Configuration;
 using Banshee.ServiceStack;
 using Banshee.Gui;
+using Banshee.MediaEngine;
+using Banshee.Collection;
 
 namespace Banshee.Lastfm.Radio
 {
@@ -63,6 +65,8 @@
         {
             action_service = ServiceManager.Get<InterfaceActionService> ();
             this.lastfm = lastfm;
+            
+            ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
 
             AddImportant (
                 new ActionEntry (
@@ -123,37 +127,11 @@
             actions_id = action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
 
             lastfm.Connection.StateChanged += HandleConnectionStateChanged;
-
-            /*Globals.ActionManager["LastfmLoveAction"].IsImportant = true;
-            Globals.ActionManager["LastfmHateAction"].IsImportant = true;
-            Globals.ActionManager["LastfmLoveAction"].Visible = false;
-            Globals.ActionManager["LastfmHateAction"].Visible = false;
-            ActionButton love_button = new ActionButton (actions.GetAction ("LastfmLoveAction"));
-            love_button.Pixbuf = IconThemeUtils.LoadIcon ("face-smile", 22);
-            love_button.Padding = 1;
-            ActionButton hate_button = new ActionButton (actions.GetAction ("LastfmHateAction"));
-            hate_button.Pixbuf = IconThemeUtils.LoadIcon ("face-sad", 22);
-            hate_button.Padding = 1;
-            InterfaceElements.ActionButtonBox.PackStart (love_button, false, false, 0);
-            InterfaceElements.ActionButtonBox.PackStart (hate_button, false, false, 0);*/
-
-            /*PlayerEngineCore.EventChanged += delegate (object o, PlayerEngineEventArgs args) {
-                if (args.Event == PlayerEngineEvent.TrackInfoUpdated) {
-                    if (PlayerEngineCore.CurrentTrack is LastfmTrackInfo) {
-                        if (!last_track_was_lastfm) {
-                            this["LastfmLoveAction"].Visible = true;
-                            this["LastfmHateAction"].Visible = true;
-                            last_track_was_lastfm = true;
-                        }
-                    } else {
-                        if (last_track_was_lastfm) {
-                            this["LastfmLoveAction"].Visible = false;
-                            this["LastfmHateAction"].Visible = false;
-                            last_track_was_lastfm = false;
-                        }
-                    }
-                }
-            };*/
+            
+            this["LastfmLoveAction"].Visible = false;
+            this["LastfmHateAction"].Visible = false;
+            this["LastfmLoveAction"].IsImportant = true;
+            this["LastfmHateAction"].IsImportant = true;
 
             UpdateActions ();
 
@@ -164,13 +142,7 @@
 
         public override void Dispose ()
         {
-            //InterfaceElements.ActionButtonBox.Remove (love_button);
-            //InterfaceElements.ActionButtonBox.Remove (hate_button);
-
-            //Globals.ActionManager.UI.RemoveUi (actions_id);
-            //Globals.ActionManager.UI.RemoveActionGroup (actions);
             actions = null;
-
             base.Dispose ();
         }
 
@@ -211,8 +183,8 @@
 
         private void OnLoved (object sender, EventArgs args)
         {
-            LastfmTrackInfo track = null;//PlayerEngineCore.CurrentTrack as LastfmTrackInfo;
-            if (track == null)
+            LastfmTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as LastfmTrackInfo;
+            if (track == null) 
                 return;
 
             track.Love ();
@@ -220,12 +192,12 @@
 
         private void OnHated (object sender, EventArgs args)
         {
-            LastfmTrackInfo track = null; //PlayerEngineCore.CurrentTrack as LastfmTrackInfo;
+            LastfmTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as LastfmTrackInfo;
             if (track == null)
                 return;
 
             track.Ban ();
-            action_service.GlobalActions ["NextAction"].Activate ();
+            ServiceManager.PlaybackController.Next ();
         }
 
         public void ShowLoginDialog ()
@@ -241,6 +213,16 @@
 
 #endregion
 
+        private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+        { 
+            if (args.Event == PlayerEngineEvent.EndOfStream || args.Event == PlayerEngineEvent.StartOfStream) {
+                TrackInfo current_track = ServiceManager.PlayerEngine.CurrentTrack;
+                this["LastfmLoveAction"].Visible = current_track is LastfmTrackInfo;
+                this["LastfmHateAction"].Visible = current_track is LastfmTrackInfo;
+                this["LastfmAddAction"].IsImportant = !(current_track is LastfmTrackInfo);
+            }
+        }
+
         private void HandleConnectionStateChanged (object sender, ConnectionStateChangedArgs args)
         {
             UpdateActions ();

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp	Tue Feb 19 00:03:47 2008
@@ -1,4 +1,4 @@
-<Project name="Banshee.Plugins.LastFM" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+<Project name="Banshee.Plugins.Lastfm" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
       <Output directory="." assembly="Banshee.Plugins.LastFM" />
@@ -14,13 +14,13 @@
     <File name="Banshee.Lastfm.Radio/StationEditor.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Lastfm.Radio/StationSource.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Lastfm.Radio/StationType.cs" subtype="Code" buildaction="Compile" />
-    <File name="Resources/Actions.xml" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Resources/lastfm.glade" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Resources/audioscrobbler.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Resources/loved.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Resources/people.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Resources/person.png" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Resources/recommended.png" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Banshee.Lastfm.Radio/LastfmTrackListModel.cs" subtype="Code" buildaction="Compile" />
+    <File name="Resources/Banshee.Lastfm.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/ActiveSourceUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
@@ -32,7 +32,20 @@
     <ProjectReference type="Project" localcopy="False" refto="Banshee.Widgets" />
     <ProjectReference type="Project" localcopy="True" refto="Lastfm" />
     <ProjectReference type="Project" localcopy="True" refto="Lastfm.Gui" />
+    <ProjectReference type="Gac" localcopy="True" refto="Banshee.Base, Version=0.13.2.36411, Culture=neutral, PublicKeyToken=null" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
   </References>
+  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
+    <BuildFilesVar Sync="True" Name="SOURCES" />
+    <DeployFilesVar />
+    <ResourcesVar Sync="True" Name="RESOURCES" />
+    <OthersVar />
+    <GacRefVar />
+    <AsmRefVar />
+    <ProjectRefVar />
+  </MonoDevelop.Autotools.MakefileInfo>
   <DeploymentInformation strategy="File">
     <excludeFiles />
   </DeploymentInformation>

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am	Tue Feb 19 00:03:47 2008
@@ -2,7 +2,7 @@
 TARGET = library
 LINK = $(REF_EXTENSION_LASTFM)
 
-SOURCES = \
+SOURCES =  \
 	Banshee.Lastfm.Radio/Connection.cs \
 	Banshee.Lastfm.Radio/LastfmActions.cs \
 	Banshee.Lastfm.Radio/LastfmSource.cs \
@@ -13,11 +13,11 @@
 	Banshee.Lastfm.Radio/StationType.cs
 
 RESOURCES =  \
-	Resources/Banshee.Lastfm.addin.xml \
-	Resources/lastfm.glade \
 	Resources/ActiveSourceUI.xml \
-	Resources/GlobalUI.xml \
 	Resources/audioscrobbler.png \
+	Resources/Banshee.Lastfm.addin.xml \
+	Resources/GlobalUI.xml \
+	Resources/lastfm.glade \
 	Resources/recommended.png
 
 include $(top_srcdir)/build/build.mk

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml	Tue Feb 19 00:03:47 2008
@@ -20,8 +20,15 @@
 
     <popup name="TrackContextMenu" action="TrackContextMenuAction">
         <placeholder name="BelowAddToPlaylist">
-            <menuitem name="LastfmLove" action="LastfmLoveAction"></menuitem>
-            <menuitem name="LastfmHate" action="LastfmHateAction"></menuitem>
+            <menuitem name="LastfmLove" action="LastfmLoveAction"/>
+            <menuitem name="LastfmHate" action="LastfmHateAction"/>
         </placeholder>
     </popup>
+    
+    <toolbar name="HeaderToolbar">
+        <placeholder name="SourceActions">
+            <toolitem name="LastfmLove" action="LastfmLoveAction"/>
+            <toolitem name="LastfmHate" action="LastfmHateAction"/>
+        </placeholder>
+    </toolbar>
 </ui>

Modified: trunk/banshee/tests/tests.mdp
==============================================================================
--- trunk/banshee/tests/tests.mdp	(original)
+++ trunk/banshee/tests/tests.mdp	Tue Feb 19 00:03:47 2008
@@ -13,6 +13,7 @@
     <File name="Banshee.Services/Xspf/Xspf.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Services/PlaylistFormatTests.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena/RangeCollectionTests.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hyena/CryptoUtilTests.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="False" refto="Banshee.Core" />



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