[banshee: 3/27] [lastfm] Move parts of UI XML to LastfmStreaming



commit c7244f930b54c70c0831891caa22bb3aad8d0cb2
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Jan 23 21:38:59 2010 +0100

    [lastfm] Move parts of UI XML to LastfmStreaming

 .../Banshee.Lastfm.Radio/LastfmSource.cs           |    2 -
 .../Banshee.Lastfm/Banshee.Lastfm.csproj           |    2 -
 src/Extensions/Banshee.Lastfm/Makefile.am          |    1 -
 .../Banshee.Lastfm/Resources/GlobalUI.xml          |   30 --------------
 .../LastfmStreamingService.cs                      |   19 ++++++---
 .../Banshee.LastfmStreaming.csproj                 |    8 +++-
 src/Extensions/Banshee.LastfmStreaming/Makefile.am |    5 ++-
 .../Resources/ActiveSourceUI.xml                   |    0
 .../Banshee.LastfmStreaming/Resources/GlobalUI.xml |   43 ++++++++++++++++++++
 9 files changed, 67 insertions(+), 43 deletions(-)
---
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSource.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSource.cs
index f0037f5..ab7db5a 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSource.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmSource.cs
@@ -96,8 +96,6 @@ namespace Banshee.Lastfm.Radio
             Connection.StateChanged += HandleConnectionStateChanged;
             UpdateUI ();
 
-            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
-            Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
             Properties.SetString ("GtkActionPath", "/LastfmSourcePopup");
             Properties.SetString ("Icon.Name", "lastfm-audioscrobbler");
             Properties.SetString ("SortChildrenActionLabel", Catalog.GetString ("Sort Stations by"));
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.csproj b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.csproj
index ffa8057..949e65b 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.csproj
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.csproj
@@ -102,8 +102,6 @@
     <EmbeddedResource Include="Banshee.Lastfm.addin.xml">
       <LogicalName>Banshee.Lastfm.addin.xml</LogicalName>
     </EmbeddedResource>
-    <EmbeddedResource Include="Resources\ActiveSourceUI.xml">
-      <LogicalName>ActiveSourceUI.xml</LogicalName>
     </EmbeddedResource>
     <EmbeddedResource Include="Resources\GlobalUI.xml">
       <LogicalName>GlobalUI.xml</LogicalName>
diff --git a/src/Extensions/Banshee.Lastfm/Makefile.am b/src/Extensions/Banshee.Lastfm/Makefile.am
index 8584585..79fe095 100644
--- a/src/Extensions/Banshee.Lastfm/Makefile.am
+++ b/src/Extensions/Banshee.Lastfm/Makefile.am
@@ -18,7 +18,6 @@ SOURCES =  \
 
 RESOURCES =  \
 	Banshee.Lastfm.addin.xml \
-	Resources/ActiveSourceUI.xml \
 	Resources/AudioscrobblerMenu.xml \
 	Resources/GlobalUI.xml \
 	Resources/LastfmTrackActions.xml \
diff --git a/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml b/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml
index 50025e0..08220ba 100644
--- a/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml
+++ b/src/Extensions/Banshee.Lastfm/Resources/GlobalUI.xml
@@ -1,41 +1,15 @@
 <ui>
     <popup name="LastfmSourcePopup" action="LastfmSourcePopupAction">
-        <menuitem name="LastfmAdd" action="LastfmAddAction" />
         <menuitem name="Connect" action="LastfmConnectAction" />
         <menu name='SortChildren' action='SortChildrenAction' />
         <separator />
         <menuitem name="SourcePreferences" action="SourcePreferencesAction"/>
     </popup>
 
-    <popup name="LastfmStationSourcePopup" action="LastfmStationSourcePopupAction">
-        <menuitem name="RefreshSource" action="RefreshSourceAction" />
-        <separator />
-        <menuitem name="RenameSource" action="RenameSourceAction" />
-        <menuitem name="UnmapSource" action="UnmapSourceAction" />
-        <separator />
-        <menuitem name="SourceProperties" action="SourcePropertiesAction" />
-    </popup>
-
-    <!--<popup name="TrackContextMenu" action="TrackContextMenuAction">
-        <placeholder name="BelowAddToPlaylist">
-            <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>
-
     <popup name="LastfmArtistPopup" action="LastfmArtistPopup">
         <menuitem name="LastfmArtistVisitLastfm" action="LastfmArtistVisitLastfmAction" />
         <menuitem name="LastfmArtistVisitWikipedia" action="LastfmArtistVisitWikipediaAction" />
         <!--<menuitem name="LastfmArtistVisitAmazon" action="LastfmArtistVisitAmazonAction" />-->
-        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
-        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
         <menuitem name="LastfmArtistRecommend" action="LastfmArtistRecommendAction" />
     </popup>
 
@@ -43,8 +17,6 @@
         <menuitem name="LastfmAlbumVisitLastfm" action="LastfmAlbumVisitLastfmAction" />
         <menuitem name="LastfmArtistVisitWikipedia" action="LastfmArtistVisitWikipediaAction" />
         <!--<menuitem name="LastfmAlbumVisitAmazon" action="LastfmAlbumVisitAmazonAction" />-->
-        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
-        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
         <menuitem name="LastfmAlbumRecommend" action="LastfmAlbumRecommendAction" />
     </popup>
 
@@ -53,8 +25,6 @@
         <menuitem name="LastfmArtistViewVideos" action="LastfmArtistViewVideosAction" />
         <menuitem name="LastfmArtistVisitWikipedia" action="LastfmArtistVisitWikipediaAction" />
         <!--<menuitem name="LastfmAlbumVisitAmazon" action="LastfmAlbumVisitAmazonAction" />-->
-        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
-        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
         <!--<menuitem name="LastfmTrackRecommend" action="LastfmTrackRecommendAction" />-->
     </popup>
 </ui>
diff --git a/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.Radio/LastfmStreamingService.cs b/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.Radio/LastfmStreamingService.cs
index d2b7c9b..d04ce7e 100644
--- a/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.Radio/LastfmStreamingService.cs
+++ b/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.Radio/LastfmStreamingService.cs
@@ -24,11 +24,6 @@ namespace Banshee.LastfmStreaming.Radio
             }
         }
         
-        public void Dispose ()
-        {
-            ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
-        }
-
         private void OnSourceAdded (SourceAddedArgs args)
         {
             if (ServiceStartup ()) {
@@ -38,6 +33,10 @@ namespace Banshee.LastfmStreaming.Radio
 
         private bool ServiceStartup ()
         {
+            if (lastfm_source != null) {
+                return true;
+            }
+
             foreach (var src in ServiceManager.SourceManager.FindSources<LastfmSource> ()) {
                 lastfm_source = src;
                 break;
@@ -46,7 +45,7 @@ namespace Banshee.LastfmStreaming.Radio
             if (lastfm_source == null) {
                 return false;
             }
-            
+
             lastfm_source.ClearChildSources ();
             //lastfm_source.PauseSorting ();
             foreach (StationSource child in StationSource.LoadAll (lastfm_source, lastfm_source.Account.UserName)) {
@@ -54,9 +53,17 @@ namespace Banshee.LastfmStreaming.Radio
             }
             //lastfm_source.ResumeSorting ();
             lastfm_source.SortChildSources ();
+            lastfm_source.Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
+            lastfm_source.Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
+            
             return true;
         }
 
+        public void Dispose ()
+        {
+            ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
+        }
+
         private void OnCommandLineArgument (string uri, object value, bool isFile)
         {
             if (!isFile || String.IsNullOrEmpty (uri)) {
diff --git a/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.csproj b/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.csproj
index a80c6cf..6a16e7a 100644
--- a/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.csproj
+++ b/src/Extensions/Banshee.LastfmStreaming/Banshee.LastfmStreaming.csproj
@@ -46,6 +46,12 @@
     <EmbeddedResource Include="Banshee.LastfmStreaming.addin.xml">
       <LogicalName>Banshee.LastfmStreaming.addin.xml</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="Resources\ActiveSourceUI.xml">
+      <LogicalName>ActiveSourceUI.xml</LogicalName>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Resources\GlobalUI.xml">
+      <LogicalName>GlobalUI.xml</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
@@ -81,4 +87,4 @@
       <Name>Banshee.Core</Name>
     </ProjectReference>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/Extensions/Banshee.LastfmStreaming/Makefile.am b/src/Extensions/Banshee.LastfmStreaming/Makefile.am
index 487ebe5..8368284 100644
--- a/src/Extensions/Banshee.LastfmStreaming/Makefile.am
+++ b/src/Extensions/Banshee.LastfmStreaming/Makefile.am
@@ -11,7 +11,10 @@ SOURCES =  \
 	Banshee.LastfmStreaming.Radio/StationSource.cs \
 	Banshee.LastfmStreaming.Radio/StationType.cs
 
-RESOURCES = Banshee.LastfmStreaming.addin.xml
+RESOURCES =  \
+	Banshee.LastfmStreaming.addin.xml \
+	Resources/ActiveSourceUI.xml \
+	Resources/GlobalUI.xml
 
 include $(top_srcdir)/build/build.mk
 
diff --git a/src/Extensions/Banshee.Lastfm/Resources/ActiveSourceUI.xml b/src/Extensions/Banshee.LastfmStreaming/Resources/ActiveSourceUI.xml
similarity index 100%
rename from src/Extensions/Banshee.Lastfm/Resources/ActiveSourceUI.xml
rename to src/Extensions/Banshee.LastfmStreaming/Resources/ActiveSourceUI.xml
diff --git a/src/Extensions/Banshee.LastfmStreaming/Resources/GlobalUI.xml b/src/Extensions/Banshee.LastfmStreaming/Resources/GlobalUI.xml
new file mode 100644
index 0000000..1deaa8a
--- /dev/null
+++ b/src/Extensions/Banshee.LastfmStreaming/Resources/GlobalUI.xml
@@ -0,0 +1,43 @@
+<ui>
+    <popup name="LastfmSourcePopup" action="LastfmSourcePopupAction">
+        <menuitem name="LastfmAdd" action="LastfmAddAction" />
+    </popup>
+
+    <popup name="LastfmStationSourcePopup" action="LastfmStationSourcePopupAction">
+        <menuitem name="RefreshSource" action="RefreshSourceAction" />
+        <separator />
+        <menuitem name="RenameSource" action="RenameSourceAction" />
+        <menuitem name="UnmapSource" action="UnmapSourceAction" />
+        <separator />
+        <menuitem name="SourceProperties" action="SourcePropertiesAction" />
+    </popup>
+
+    <!--<popup name="TrackContextMenu" action="TrackContextMenuAction">
+        <placeholder name="BelowAddToPlaylist">
+            <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>
+
+    <popup name="LastfmArtistPopup" action="LastfmArtistPopup">
+        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
+        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
+    </popup>
+
+    <popup name="LastfmAlbumPopup" action="LastfmAlbumPopup">
+        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
+        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
+    </popup>
+
+    <popup name="LastfmTrackPopup" action="LastfmTrackPopup">
+        <menuitem name="LastfmArtistPlayFanRadio" action="LastfmArtistPlayFanRadioAction" />
+        <menuitem name="LastfmArtistPlaySimilarRadio" action="LastfmArtistPlaySimilarRadioAction" />
+    </popup>
+</ui>



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