banshee r4492 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage src/Dap/Banshee.Dap/Banshee.Dap
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4492 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage src/Dap/Banshee.Dap/Banshee.Dap
- Date: Mon, 8 Sep 2008 21:52:49 +0000 (UTC)
Author: gburt
Date: Mon Sep 8 21:52:49 2008
New Revision: 4492
URL: http://svn.gnome.org/viewvc/banshee?rev=4492&view=rev
Log:
2008-09-08 Gabriel Burt <gabriel burt gmail com>
* src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs:
* src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs:
* src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs:
* src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs:
* src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs:
* src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs:
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs:
Fix things up so that when Sync is enabled for a device the user cannot
DnD tracks or sources onto it, can't create playlists, can't modify
playlists on the device, etc.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/AbstractPlaylistSource.cs Mon Sep 8 21:52:49 2008
@@ -160,13 +160,29 @@
}
public override bool CanRename {
- get { return true; }
+ get { return (Parent is PrimarySource) ? !(Parent as PrimarySource).PlaylistsReadOnly : true; }
}
public override bool CanSearch {
get { return true; }
}
+ public virtual bool CanUnmap {
+ get { return (Parent is PrimarySource) ? !(Parent as PrimarySource).PlaylistsReadOnly : true; }
+ }
+
+ public bool ConfirmBeforeUnmap {
+ get { return true; }
+ }
+
+ // We can delete tracks only if our parent can
+ public override bool CanDeleteTracks {
+ get {
+ DatabaseSource ds = Parent as DatabaseSource;
+ return ds != null && ds.CanDeleteTracks;
+ }
+ }
+
public override void Save ()
{
if (dbid == null || dbid <= 0) {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs Mon Sep 8 21:52:49 2008
@@ -188,19 +188,20 @@
#region DatabaseSource overrides
- // We can delete tracks only if our parent can
- public override bool CanDeleteTracks {
+ // We can add tracks only if our parent can
+ public override bool CanAddTracks {
get {
DatabaseSource ds = Parent as DatabaseSource;
- return ds != null && ds.CanDeleteTracks;
+ return ds != null ? ds.CanAddTracks : base.CanAddTracks;
}
}
- // We can add tracks only if our parent can
- public override bool CanAddTracks {
+ // We can remove tracks only if our parent can
+ public override bool CanRemoveTracks {
get {
- DatabaseSource ds = Parent as DatabaseSource;
- return ds != null ? ds.CanAddTracks : base.CanAddTracks;
+ return (Parent is PrimarySource)
+ ? !(Parent as PrimarySource).PlaylistsReadOnly
+ : true;
}
}
@@ -224,14 +225,6 @@
return true;
}
- public virtual bool CanUnmap {
- get { return true; }
- }
-
- public virtual bool ConfirmBeforeUnmap {
- get { return true; }
- }
-
#endregion
protected void AddTrack (int track_id)
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 Mon Sep 8 21:52:49 2008
@@ -425,14 +425,6 @@
return true;
}
- public virtual bool CanUnmap {
- get { return true; }
- }
-
- public bool ConfirmBeforeUnmap {
- get { return true; }
- }
-
public bool CanRefresh {
get { return QueryOrder == BansheeQuery.RandomOrder; }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs Mon Sep 8 21:52:49 2008
@@ -130,11 +130,15 @@
}
private bool supports_playlists = true;
- public bool SupportsPlaylists {
+ public virtual bool SupportsPlaylists {
get { return supports_playlists; }
protected set { supports_playlists = value; }
}
+ public virtual bool PlaylistsReadOnly {
+ get { return false; }
+ }
+
public ErrorSource ErrorSource {
get {
if (error_source == null) {
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 Mon Sep 8 21:52:49 2008
@@ -358,8 +358,9 @@
UpdateAction ("SourcePropertiesAction", source.HasProperties, true, source);
UpdateAction ("RefreshSmartPlaylistAction", smart_playlist != null && smart_playlist.CanRefresh, true, source);
- UpdateAction ("NewPlaylistAction", primary_source != null && primary_source.SupportsPlaylists, true, source);
- UpdateAction ("NewSmartPlaylistAction", primary_source != null && primary_source.SupportsPlaylists, true, source);
+ bool playlists_writable = primary_source != null && primary_source.SupportsPlaylists && !primary_source.PlaylistsReadOnly;
+ UpdateAction ("NewPlaylistAction", playlists_writable, true, source);
+ UpdateAction ("NewSmartPlaylistAction", playlists_writable, true, source);
/*UpdateAction ("NewSmartPlaylistFromSearchAction", (source is LibrarySource || source.Parent is LibrarySource),
!String.IsNullOrEmpty (source.FilterQuery), source);*/
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/TrackActions.cs Mon Sep 8 21:52:49 2008
@@ -227,7 +227,8 @@
UpdateAction ("TrackPropertiesAction", in_database, has_selection, source);
UpdateAction ("RateTracksAction", in_database, has_selection, null);
- UpdateAction ("AddToPlaylistAction", in_database && primary_source != null && primary_source.SupportsPlaylists, has_selection, null);
+ UpdateAction ("AddToPlaylistAction", in_database && primary_source != null &&
+ primary_source.SupportsPlaylists && !primary_source.PlaylistsReadOnly, has_selection, null);
if (primary_source != null) {
this["DeleteTracksFromDriveAction"].Label = String.Format (Catalog.GetString ("_Delete From {0}"), primary_source.StorageName);
Modified: trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs Mon Sep 8 21:52:49 2008
@@ -233,7 +233,7 @@
private string [] playlist_formats;
private string [] PlaylistFormats {
get {
- if (playlist_formats == null && SupportsPlaylists && MediaCapabilities != null) {
+ if (playlist_formats == null && MediaCapabilities != null) {
playlist_formats = MediaCapabilities.PlaylistFormats;
}
return playlist_formats;
@@ -258,7 +258,7 @@
}
}
- SupportsPlaylists = CanSyncPlaylists;
+ SupportsPlaylists &= CanSyncPlaylists;
return playlist_types;
}
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs Mon Sep 8 21:52:49 2008
@@ -456,6 +456,22 @@
public override long BytesAvailable {
get { return BytesCapacity - BytesUsed - Math.Max (0, BytesReserved - BytesData); }
}
+
+ public override bool CanRemoveTracks {
+ get { return base.CanRemoveTracks && !Sync.Enabled; }
+ }
+
+ public override bool CanDeleteTracks {
+ get { return base.CanDeleteTracks && !Sync.Enabled; }
+ }
+
+ public override bool CanAddTracks {
+ get { return base.CanAddTracks && !Sync.Enabled; }
+ }
+
+ public override bool PlaylistsReadOnly {
+ get { return Sync.Enabled || IsReadOnly; }
+ }
private Banshee.Configuration.SchemaEntry<long> space_for_data;
#endregion
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSync.cs Mon Sep 8 21:52:49 2008
@@ -205,7 +205,8 @@
private IEnumerable<LibrarySource> Libraries {
get {
- foreach (Source source in ServiceManager.SourceManager.Sources) {
+ List<Source> sources = new List<Source> (ServiceManager.SourceManager.Sources);
+ foreach (Source source in sources) {
if (source is LibrarySource) {
yield return source as LibrarySource;
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs Mon Sep 8 21:52:49 2008
@@ -121,7 +121,7 @@
public override bool AcceptsInputFromSource (Source source)
{
- return (source is DatabaseSource) && this != source.Parent;
+ return (source is DatabaseSource) && this != source.Parent && CanAddTracks;
}
private bool syncing = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]