banshee r3230 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Lastfm/Banshee.Lastfm
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3230 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Query src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Lastfm/Banshee.Lastfm
- Date: Tue, 12 Feb 2008 04:27:02 +0000 (GMT)
Author: gburt
Date: Tue Feb 12 04:27:01 2008
New Revision: 3230
URL: http://svn.gnome.org/viewvc/banshee?rev=3230&view=rev
Log:
2008-02-11 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs: Remove
debugging WriteLines.
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:
Add CanRefresh property that is true if ordered by random.
* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml: Add
RefreshSmartPlaylist action to the source toolbar and context menu.
* src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs: Fix
whitespace, add and handle RefreshSmartPlaylist action.
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm/Plugin.cs: Get rid of old
PluginModuleEntry.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/Plugin.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Query/BansheeQuery.cs Tue Feb 12 04:27:01 2008
@@ -42,8 +42,11 @@
{
private static bool asc = true;
private static bool desc = false;
+
+ public static QueryOrder RandomOrder = CreateQueryOrder ("Random", asc, Catalog.GetString ("Random"));
+
public static QueryOrder [] Orders = new QueryOrder [] {
- CreateQueryOrder ("Random", asc, Catalog.GetString ("Random")),
+ RandomOrder,
CreateQueryOrder ("Album", asc, Catalog.GetString ("Album")),
CreateQueryOrder ("Artist", asc, Catalog.GetString ("Artist")),
CreateQueryOrder ("Title", asc, Catalog.GetString ("Title")),
@@ -271,7 +274,6 @@
public static QueryOrder FindOrder (string name)
{
- Console.WriteLine ("# ordres = {0}", Orders.Length);
foreach (QueryOrder order in Orders) {
if (order != null && order.Name == name) {
return order;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs Tue Feb 12 04:27:01 2008
@@ -180,8 +180,6 @@
LimitValue = new IntegerQueryValue ();
LimitValue.ParseUserQuery (limit_number);
- Console.WriteLine ("limit = {0}, order = {1}, val = {2}, valisempty? {3}", Limit, QueryOrder, LimitValue, LimitValue.IsEmpty);
-
DbId = dbid;
InstallProperties ();
@@ -262,17 +260,6 @@
"DELETE FROM CoreSmartPlaylistEntries WHERE SmartPlaylistID = {0}", DbId
));
- Console.WriteLine ("limited? {0}", IsLimited);
-
- Console.WriteLine (String.Format (
- @"INSERT INTO CoreSmartPlaylistEntries
- SELECT {0} as SmartPlaylistID, TrackId
- FROM CoreTracks, CoreArtists, CoreAlbums
- WHERE CoreTracks.ArtistID = CoreArtists.ArtistID AND CoreTracks.AlbumID = CoreAlbums.AlbumID
- {1} {2}",
- DbId, PrependCondition("AND"), OrderAndLimit
- ));
-
// Repopulate it
ServiceManager.DbConnection.Execute (String.Format (
@"INSERT INTO CoreSmartPlaylistEntries
@@ -314,6 +301,10 @@
get { return true; }
}
+ public bool CanRefresh {
+ get { return QueryOrder == BansheeQuery.RandomOrder; }
+ }
+
#endregion
private string PrependCondition (string with)
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs Tue Feb 12 04:27:01 2008
@@ -60,9 +60,9 @@
action_service = actionService;
Add (new ActionEntry [] {
- new ActionEntry("NewPlaylistAction", Stock.New,
- Catalog.GetString("_New Playlist"), "<control>N",
- Catalog.GetString("Create a new empty playlist"), OnNewPlaylist),
+ new ActionEntry ("NewPlaylistAction", Stock.New,
+ Catalog.GetString ("_New Playlist"), "<control>N",
+ Catalog.GetString ("Create a new empty playlist"), OnNewPlaylist),
new ActionEntry ("NewSmartPlaylistAction", null,
Catalog.GetString ("New _Smart Playlist"), null,
@@ -72,22 +72,29 @@
Catalog.GetString ("New _Smart Playlist _From Search"), null,
Catalog.GetString ("Create a new smart playlist from the current search"), OnNewSmartPlaylistFromSearch),
- new ActionEntry("SourceContextMenuAction", null,
+ new ActionEntry ("SourceContextMenuAction", null,
String.Empty, null, null, OnSourceContextMenu),
- new ActionEntry("ImportSourceAction", null,
- Catalog.GetString("Import Source"), null,
- Catalog.GetString("Import source to library"), OnImportSource),
+ new ActionEntry ("ImportSourceAction", null,
+ Catalog.GetString ("Import Source"), null,
+ Catalog.GetString ("Import source to library"), OnImportSource),
- new ActionEntry("RenameSourceAction", "gtk-edit",
+ new ActionEntry ("RenameSourceAction", "gtk-edit",
"Rename", "F2", "Rename", OnRenameSource),
- new ActionEntry("UnmapSourceAction", Stock.Delete,
+
+ new ActionEntry ("UnmapSourceAction", Stock.Delete,
"Unmap", "<shift>Delete", null, OnUnmapSource),
- new ActionEntry("SourcePropertiesAction", Stock.Properties,
+ new ActionEntry ("SourcePropertiesAction", Stock.Properties,
"Source Properties", null, null, OnSourceProperties),
});
+
+ AddImportant (
+ new ActionEntry ("RefreshSmartPlaylistAction", Stock.Refresh,
+ Catalog.GetString ("Refresh"), null,
+ Catalog.GetString ("Refresh this randomly sorted smart playlist"), OnRefreshSmartPlaylist)
+ );
Add (new Gtk.ActionEntry [] {
new Gtk.ActionEntry ("SortChildrenAction", null,
@@ -140,34 +147,20 @@
playlist.Save ();
ServiceManager.SourceManager.DefaultSource.AddChildSource (playlist);
playlist.NotifyUpdated ();
-
- // TODO should begin editing the name after making it, but this changed
- // the ActiveSource to the new playlist and we don't want that.
- //SourceView.BeginRenameSource (playlist);
}
private void OnNewSmartPlaylist (object o, EventArgs args)
{
Editor ed = new Editor ();
ed.RunDialog ();
-
- /*Editor ed = new Editor ();
- ed.SetQueryFromSearch ();
- ed.RunDialog ();*/
-
- // TODO should begin editing the name after making it, but this changed
- // the ActiveSource to the new playlist and we don't want that.
- //SourceView.BeginRenameSource (playlist);
+ //playlist.NotifyUpdated ();
}
private void OnNewSmartPlaylistFromSearch (object o, EventArgs args)
{
- //Editor ed = new Editor ();
- //ed.RunDialog ();
-
- /*Editor ed = new Editor ();
- ed.SetQueryFromSearch ();
- ed.RunDialog ();*/
+ // TODO create playlist and save it
+
+ //playlist.NotifyUpdated ();
// TODO should begin editing the name after making it, but this changed
// the ActiveSource to the new playlist and we don't want that.
@@ -208,6 +201,15 @@
source.Unmap ();
}
+ private void OnRefreshSmartPlaylist (object o, EventArgs args)
+ {
+ SmartPlaylistSource playlist = ActionSource as SmartPlaylistSource;
+
+ if (playlist != null && playlist.CanRefresh) {
+ playlist.Reload ();
+ }
+ }
+
private void OnSourceProperties (object o, EventArgs args)
{
Source source = ActionSource;
@@ -228,10 +230,12 @@
if (source != last_source && source != null) {
IUnmapableSource unmapable = source as IUnmapableSource;
+ SmartPlaylistSource smart_playlist = source as SmartPlaylistSource;
UpdateAction ("UnmapSourceAction", unmapable != null, unmapable != null && unmapable.CanUnmap, source);
UpdateAction ("RenameSourceAction", source.CanRename, true, null);
UpdateAction ("ImportSourceAction", source is IImportable, true, source);
UpdateAction ("SourcePropertiesAction", source.HasProperties, true, source);
+ UpdateAction ("RefreshSmartPlaylistAction", smart_playlist != null && smart_playlist.CanRefresh, true, source);
last_source = source;
}
@@ -240,46 +244,46 @@
}
}
- private static bool ConfirmUnmap(IUnmapableSource source)
+ private static bool ConfirmUnmap (IUnmapableSource source)
{
- string key = "no_confirm_unmap_" + source.GetType().Name.ToLower();
- bool do_not_ask = ConfigurationClient.Get<bool>("sources", key, false);
+ string key = "no_confirm_unmap_" + source.GetType ().Name.ToLower ();
+ bool do_not_ask = ConfigurationClient.Get<bool> ("sources", key, false);
- if(do_not_ask) {
+ if (do_not_ask) {
return true;
}
- Banshee.Widgets.HigMessageDialog dialog = new Banshee.Widgets.HigMessageDialog(
+ Banshee.Widgets.HigMessageDialog dialog = new Banshee.Widgets.HigMessageDialog (
ServiceManager.Get<GtkElementsService> ("GtkElementsService").PrimaryWindow,
Gtk.DialogFlags.Modal,
Gtk.MessageType.Question,
Gtk.ButtonsType.Cancel,
- String.Format(Catalog.GetString("Are you sure you want to delete this {0}?"),
- source.GenericName.ToLower()),
+ String.Format (Catalog.GetString ("Are you sure you want to delete this {0}?"),
+ source.GenericName.ToLower ()),
source.Name);
- dialog.AddButton(Gtk.Stock.Delete, Gtk.ResponseType.Ok, false);
+ dialog.AddButton (Gtk.Stock.Delete, Gtk.ResponseType.Ok, false);
- Gtk.Alignment alignment = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 0.0f);
+ Gtk.Alignment alignment = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 0.0f);
alignment.TopPadding = 10;
- Gtk.CheckButton confirm_button = new Gtk.CheckButton(String.Format(Catalog.GetString(
- "Do not ask me this again"), source.GenericName.ToLower()));
+ Gtk.CheckButton confirm_button = new Gtk.CheckButton (String.Format (Catalog.GetString (
+ "Do not ask me this again"), source.GenericName.ToLower ()));
confirm_button.Toggled += delegate {
do_not_ask = confirm_button.Active;
};
- alignment.Add(confirm_button);
- alignment.ShowAll();
- dialog.LabelVBox.PackStart(alignment, false, false, 0);
+ alignment.Add (confirm_button);
+ alignment.ShowAll ();
+ dialog.LabelVBox.PackStart (alignment, false, false, 0);
try {
- if(dialog.Run() == (int)Gtk.ResponseType.Ok) {
- ConfigurationClient.Set<bool>("sources", key, do_not_ask);
+ if (dialog.Run () == (int)Gtk.ResponseType.Ok) {
+ ConfigurationClient.Set<bool> ("sources", key, do_not_ask);
return true;
}
return false;
} finally {
- dialog.Destroy();
+ dialog.Destroy ();
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Tue Feb 12 04:27:01 2008
@@ -5,7 +5,9 @@
<toolitem action="NextAction"/>
<placeholder name="SeekSlider"/>
<placeholder name="TrackInfoDisplay"/>
- <placeholder name="SourceActions"/>
+ <placeholder name="SourceActions">
+ <toolitem name="RefreshSmartPlaylist" action="RefreshSmartPlaylistAction"/>
+ </placeholder>
<placeholder name="VolumeButton"/>
</toolbar>
@@ -104,6 +106,7 @@
<menuitem name="ImportSource" action="ImportSourceAction"/>
<separator/>
<menuitem name="RenameSource" action="RenameSourceAction"/>
+ <menuitem name="RefreshSmartPlaylist" action="RefreshSmartPlaylistAction"/>
<menuitem name="UnmapSource" action="UnmapSourceAction"/>
<!--<menuitem name="ExportPlaylist" action="ExportPlaylistAction"/>-->
<!--<menuitem name="SyncDap" action="SyncDapAction"/>-->
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/Plugin.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/Plugin.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/Plugin.cs Tue Feb 12 04:27:01 2008
@@ -40,16 +40,6 @@
using Banshee.Database;
using Banshee.Configuration;
-public static class PluginModuleEntry
-{
- public static Type [] GetTypes ()
- {
- return new Type [] {
- typeof (Banshee.Plugins.LastFM.LastFMPlugin)
- };
- }
-}
-
namespace Banshee.Lastfm
{
public class LastFMPlugin : Banshee.Plugins.Plugin
@@ -65,7 +55,12 @@
private static LastFMPlugin instance = null;
public static LastFMPlugin Instance {
- get { return instance; }
+ get {
+ if (instance == null) {
+ instance = new LastfmPlugin ();
+ }
+ return instance;
+ }
}
protected override string ConfigurationName {
@@ -86,8 +81,6 @@
protected override void PluginInitialize ()
{
- instance = this;
-
// We don't automatically connect to Last.fm, but load the last Last.fm
// username we used so we can load the user's stations.
string last_user = LastUserSchema.Get ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]