[rhythmbox] magnatune: Remove separate purchase action



commit a95213491fad615002e33ce30e36f59320820d40
Author: Adam Zimmerman <adamz src gnome org>
Date:   Thu Apr 1 11:16:48 2010 -0700

    magnatune: Remove separate purchase action
    
    Magnatune no longer supports purchasing individual downloads. This patch
    removes the "Purchase Album" button from the toolbar, and changes the
    behaviour of the "Download Album" button slightly: if the user does not have
    a download account, it redirects them to the purchase page on Magnatune's
    website.

 plugins/magnatune/magnatune/MagnatuneSource.py |   10 +++++++---
 plugins/magnatune/magnatune/__init__.py        |    6 ------
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/plugins/magnatune/magnatune/MagnatuneSource.py b/plugins/magnatune/magnatune/MagnatuneSource.py
index 44e6b51..eeecb33 100644
--- a/plugins/magnatune/magnatune/MagnatuneSource.py
+++ b/plugins/magnatune/magnatune/MagnatuneSource.py
@@ -123,8 +123,7 @@ class MagnatuneSource(rb.BrowserSource):
 			return (qm.compute_status_normal("%d song", "%d songs"), None, 0.0)
 
 	def do_impl_get_ui_actions(self):
-		return ["MagnatunePurchaseAlbum",
-			"MagnatuneDownloadAlbum",
+		return ["MagnatuneDownloadAlbum",
 			"MagnatuneArtistInfo",
 			"MagnatuneCancelDownload"]
 
@@ -201,7 +200,7 @@ class MagnatuneSource(rb.BrowserSource):
 				gtk.show_uri(screen, url, gtk.gdk.CURRENT_TIME)
 				urls.add(url)
 
-	def purchase_album(self):
+	def purchase_redirect(self):
 		screen = self.props.shell.props.window.get_screen()
 		tracks = self.get_entry_view().get_selected_entries()
 		urls = set([])
@@ -214,6 +213,11 @@ class MagnatuneSource(rb.BrowserSource):
 				urls.add(url)
 
 	def download_album(self):
+		if self.__client.get_string(self.__plugin.gconf_keys['account_type']) != 'download':
+			# The user doesn't have a download account, so redirect them to the purchase page.
+			self.purchase_redirect()
+			return
+
 		try:
 			library_location = self.__client.get_list("/apps/rhythmbox/library_locations", gconf.VALUE_STRING)[0] # Just use the first library location
 		except IndexError, e:
diff --git a/plugins/magnatune/magnatune/__init__.py b/plugins/magnatune/magnatune/__init__.py
index d5b2c40..9602d49 100644
--- a/plugins/magnatune/magnatune/__init__.py
+++ b/plugins/magnatune/magnatune/__init__.py
@@ -44,7 +44,6 @@ popup_ui = """
 <ui>
   <popup name="MagnatuneSourceViewPopup">
     <menuitem name="AddToQueueLibraryPopup" action="AddToQueue"/>
-    <menuitem name="MagnatunePurchaseAlbum" action="MagnatunePurchaseAlbum"/>
     <menuitem name="MagnatuneDownloadAlbum" action="MagnatuneDownloadAlbum"/>
     <menuitem name="MagnatuneArtistInfo" action="MagnatuneArtistInfo"/>
     <menuitem name="MagnatuneCancelDownload" action="MagnatuneCancelDownload"/>
@@ -109,11 +108,6 @@ class Magnatune(rb.Plugin):
 		# Add the popup menu actions
 		self.action_group = gtk.ActionGroup('MagnatunePluginActions')
 
-		action = gtk.Action('MagnatunePurchaseAlbum', _('Purchase Album'),
-				_("Purchase this album from Magnatune"),
-				'gtk-add')
-		action.connect('activate', lambda a: self.shell.get_property("selected-source").purchase_album())
-		self.action_group.add_action(action)
 		action = gtk.Action('MagnatuneDownloadAlbum', _('Download Album'),
 				_("Download this album from Magnatune"),
 				'gtk-save')



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