banshee r3240 - in trunk/banshee: . src/Extensions/Banshee.Lastfm/Banshee.Lastfm
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3240 - in trunk/banshee: . src/Extensions/Banshee.Lastfm/Banshee.Lastfm
- Date: Thu, 14 Feb 2008 20:33:04 +0000 (GMT)
Author: gburt
Date: Thu Feb 14 20:33:04 2008
New Revision: 3240
URL: http://svn.gnome.org/viewvc/banshee?rev=3240&view=rev
Log:
2008-02-14 Gabriel Burt <gabriel burt gmail com>
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmActions.cs:
Handle SourcePropertiesAction for LastfmSource and StationSources.
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSource.cs:
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm/StationSource.cs: Set
HasProperties = true so Edit Properties action shows up.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmActions.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSource.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/StationSource.cs
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmActions.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmActions.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmActions.cs Thu Feb 14 20:33:04 2008
@@ -49,7 +49,7 @@
{
public class LastfmActions : BansheeActionGroup
{
- private LastfmSource source;
+ private LastfmSource lastfm;
private ActionButton love_button;
private ActionButton hate_button;
@@ -59,10 +59,10 @@
private uint actions_id;
private ActionGroup actions;
- public LastfmActions (LastfmSource source) : base ("Lastfm")
+ public LastfmActions (LastfmSource lastfm) : base ("Lastfm")
{
action_service = ServiceManager.Get<InterfaceActionService> ();
- this.source = source;
+ this.lastfm = lastfm;
AddImportant (
new ActionEntry (
@@ -113,16 +113,16 @@
null, "", 2
)
},
- Array.IndexOf (LastfmSource.ChildComparers, source.ChildComparer),
+ Array.IndexOf (LastfmSource.ChildComparers, lastfm.ChildComparer),
delegate (object sender, ChangedArgs args) {
- source.ChildComparer = LastfmSource.ChildComparers[args.Current.Value];
- source.SortChildSources ();
+ lastfm.ChildComparer = LastfmSource.ChildComparers[args.Current.Value];
+ lastfm.SortChildSources ();
}
);
actions_id = action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
- source.Connection.StateChanged += HandleConnectionStateChanged;
+ lastfm.Connection.StateChanged += HandleConnectionStateChanged;
/*Globals.ActionManager["LastfmLoveAction"].IsImportant = true;
Globals.ActionManager["LastfmHateAction"].IsImportant = true;
@@ -157,6 +157,8 @@
UpdateActions ();
+ action_service.SourceActions ["SourcePropertiesAction"].Activated += OnSourceProperties;
+
action_service.AddActionGroup (this);
}
@@ -176,14 +178,25 @@
private void OnAddStation (object sender, EventArgs args)
{
- StationEditor ed = new StationEditor (source);
+ StationEditor ed = new StationEditor (lastfm);
ed.Window.ShowAll ();
ed.RunDialog ();
}
private void OnConnect (object sender, EventArgs args)
{
- source.Connection.Connect ();
+ lastfm.Connection.Connect ();
+ }
+
+ private void OnSourceProperties (object o, EventArgs args)
+ {
+ Source source = action_service.SourceActions.ActionSource;
+ if (source is LastfmSource) {
+ ShowLoginDialog ();
+ } else if (source is StationSource) {
+ StationEditor editor = new StationEditor (lastfm, source as StationSource);
+ editor.RunDialog ();
+ }
}
private void OnChangeStation (object sender, EventArgs args)
@@ -217,9 +230,9 @@
public void ShowLoginDialog ()
{
- AccountLoginDialog dialog = new AccountLoginDialog (source.Account, true);
+ AccountLoginDialog dialog = new AccountLoginDialog (lastfm.Account, true);
dialog.SaveOnEdit = true;
- if (source.Account.Username == null) {
+ if (lastfm.Account.Username == null) {
dialog.AddSignUpButton ();
}
dialog.Run ();
@@ -242,10 +255,10 @@
updating = true;
}
- bool have_user = (source.Account.Username != null);
+ bool have_user = (lastfm.Account.Username != null);
this["LastfmAddAction"].Sensitive = have_user;
this["LastfmSortAction"].Sensitive = have_user;
- this["LastfmConnectAction"].Visible = source.Connection.State == ConnectionState.Disconnected;
+ this["LastfmConnectAction"].Visible = lastfm.Connection.State == ConnectionState.Disconnected;
updating = false;
}
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSource.cs Thu Feb 14 20:33:04 2008
@@ -240,6 +240,10 @@
get { return false; }
}
+ public override bool HasProperties {
+ get { return true; }
+ }
+
private void HandleConnectionStateChanged (object sender, ConnectionStateChangedArgs args)
{
UpdateUI ();
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/StationSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/StationSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/StationSource.cs Thu Feb 14 20:33:04 2008
@@ -495,6 +495,10 @@
public override int Count {
get { return 0; }
}
+
+ public override bool HasProperties {
+ get { return true; }
+ }
public static List<StationSource> LoadAll (LastfmSource lastfm, string creator)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]