[banshee: 21/27] [lastfm] Auto-enable streaming if the user is a subscriber



commit eaf98241b1aca5b125d3df0ccd4cd3d9d31db39e
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat May 22 15:39:49 2010 +0200

    [lastfm] Auto-enable streaming if the user is a subscriber
    
    At the end of the authentication process, automatically enable the
    Last.fm streaming extension if the user is a subscriber. Do not disable
    it automatically, to avoid potential confusion.

 .../Banshee.Lastfm/LastfmPreferences.cs            |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmPreferences.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmPreferences.cs
index 4a4846f..6090fb0 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmPreferences.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmPreferences.cs
@@ -25,8 +25,10 @@
 // THE SOFTWARE.
 
 using System;
+using System.Linq;
 using Gtk;
 using Mono.Unix;
+using Mono.Addins;
 
 using Lastfm.Gui;
 
@@ -213,6 +215,13 @@ namespace Banshee.Lastfm
                 LastfmSource.LastSessionKeySchema.Set (source.Account.SessionKey);
                 source.Account.UserName = LastfmSource.LastUserSchema.Get ();
                 source.Account.Save ();
+                var streaming_addin = AddinManager.Registry.GetAddins ()
+                    .Single (a => a.LocalId.Equals("Banshee.LastFmStreaming"));
+                if (source.Account.Subscriber &&
+                    streaming_addin != null &&
+                    !streaming_addin.Enabled) {
+                    streaming_addin.Enabled = true;
+                }
                 GetSignInState ();
             } else {
                 SignOut ();



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