public Badge(Account account) : base(account.HomePageUrl) { image = new Image (); image.Pixbuf = pixbuf; image.Xalign = 0.0f; Image = image; }
void IExtensionService.Initialize () { account = LastfmCore.Account; if (account.UserName == null) { account.UserName = LastUserSchema.Get (); account.SessionKey = LastSessionKeySchema.Get (); account.ScrobbleUrl = LastScrobbleUrlSchema.Get (); } if (LastfmCore.UserAgent == null) { LastfmCore.UserAgent = Banshee.Web.Browser.UserAgent; } Browser.Open = Banshee.Web.Browser.Open; queue = new Queue (); LastfmCore.AudioscrobblerQueue = queue; connection = LastfmCore.Audioscrobbler; // Initialize with a reasonable value in case we miss the first StartOfStream event song_start_time = DateTime.Now; Network network = ServiceManager.Get<Network> (); connection.UpdateNetworkState (network.Connected); network.StateChanged += HandleNetworkStateChanged; // Update the Visit action menu item if we update our account info LastfmCore.Account.Updated += delegate (object o, EventArgs args) { actions["AudioscrobblerVisitAction"].Sensitive = String.IsNullOrEmpty (LastfmCore.Account.UserName); }; ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.Seek | PlayerEvent.Iterate); if (DeviceEnabled) { SubscribeForDeviceEvents (); } action_service = ServiceManager.Get<InterfaceActionService> (); InterfaceInitialize (); }
public AccountLoginForm(Account account) : base(1, 2, false) { this.account = account; BorderWidth = 5; RowSpacing = 5; ColumnSpacing = 5; Label username_label = new Label (Catalog.GetString ("Username:")); username_label.Xalign = 1.0f; username_label.Show (); username_entry = new Entry (); username_entry.Show (); Attach (username_label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); Attach (username_entry, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); username_entry.Text = account.UserName ?? String.Empty; }
public LastfmSource() : base(lastfm, lastfm, 210, lastfm) { account = LastfmCore.Account; // We don't automatically connect to Last.fm, but load the last Last.fm // account information if (account.UserName != null) { account.UserName = LastUserSchema.Get (); account.SessionKey = LastSessionKeySchema.Get (); account.Subscriber = LastIsSubscriberSchema.Get (); } if (LastfmCore.UserAgent == null) { LastfmCore.UserAgent = Banshee.Web.Browser.UserAgent; } Browser.Open = Banshee.Web.Browser.Open; connection = LastfmCore.Radio; Network network = ServiceManager.Get<Network> (); connection.UpdateNetworkState (network.Connected); network.StateChanged += HandleNetworkStateChanged; Connection.StateChanged += HandleConnectionStateChanged; UpdateUI (); Properties.SetString ("GtkActionPath", "/LastfmSourcePopup"); Properties.SetString ("Icon.Name", "lastfm-audioscrobbler"); Properties.Set<LastfmColumnController> ("TrackView.ColumnController", new LastfmColumnController ()); // Initialize DataCore's UserAgent and CachePath DataCore.UserAgent = Banshee.Web.Browser.UserAgent; DataCore.CachePath = System.IO.Path.Combine (Hyena.Paths.ExtensionCacheRoot, "lastfm"); // FIXME this is temporary until we split the GUI part from the non-GUI part Properties.Set<ISourceContents> ("Nereid.SourceContents", new LazyLoadSourceContents<LastfmSourceContents> ()); Properties.Set<bool> ("Nereid.SourceContents.HeaderVisible", false); actions = new LastfmActions (this); preferences = new LastfmPreferences (this); ServiceManager.SourceManager.AddSource (this); if (FirstRunSchema.Get ()) { var streaming_addin = AddinManager.Registry.GetAddins () .Single (a => a.LocalId.Equals ("Banshee.LastfmStreaming")); if (streaming_addin != null) { streaming_addin.Enabled = Account.Subscriber; } FirstRunSchema.Set (false); } }
public void Dispose() { Connection.StateChanged -= HandleConnectionStateChanged; ServiceManager.Get<Network> ().StateChanged -= HandleNetworkStateChanged; Connection.Dispose (); preferences.Dispose (); actions.Dispose (); actions = null; connection = null; preferences = null; account = null; }