banshee r3886 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Dap/Banshee.Dap/Banshee.Dap
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3886 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Sources src/Dap/Banshee.Dap/Banshee.Dap
- Date: Tue, 6 May 2008 16:05:32 +0100 (BST)
Author: gburt
Date: Tue May 6 15:05:31 2008
New Revision: 3886
URL: http://svn.gnome.org/viewvc/banshee?rev=3886&view=rev
Log:
2008-05-06 Gabriel Burt <gabriel burt gmail com>
* src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs: Don't delay add and
delete user jobs, since removable devices are slow and we might as well
show the progress bars asap.
* src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs: Make sure the device
mapping doesn't happen on the main thread. Aaron will love this. MTP's
DeviceInitialize method can be very slow (10+ seconds) and we definitely
shouldn't block the ui for it.
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Make sure
adding files to a primary source happens not on the main thread. Add
protected properties for deciding whether to delay the add/delete jobs.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
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 Tue May 6 15:05:31 2008
@@ -438,8 +438,11 @@
DatabaseTrackListModel model = (source as ITrackModelSource).TrackModel as DatabaseTrackListModel;
+ // Store a snapshot of the current selection
CachedList<DatabaseTrackInfo> cached_list = CachedList<DatabaseTrackInfo>.CreateFromModelSelection (model);
- AddTrackList (cached_list);
+
+ System.Threading.ThreadPool.QueueUserWorkItem (AddTrackList, cached_list);
+
return true;
}
@@ -460,8 +463,9 @@
IncrementAddedTracks ();
}
- protected virtual void AddTrackList (CachedList<DatabaseTrackInfo> list)
+ protected virtual void AddTrackList (object cached_list)
{
+ CachedList<DatabaseTrackInfo> list = cached_list as CachedList<DatabaseTrackInfo>;
is_adding = true;
AddTrackJob.Total += (int) list.Count;
@@ -507,6 +511,18 @@
OnUserNotifyUpdated ();
}
+ private bool delay_add_job = true;
+ protected bool DelayAddJob {
+ get { return delay_add_job; }
+ set { delay_add_job = value; }
+ }
+
+ private bool delay_delete_jbo = true;
+ protected bool DelayDeleteJob {
+ get { return delay_delete_jbo; }
+ set { delay_delete_jbo = value; }
+ }
+
private BatchUserJob add_track_job;
protected BatchUserJob AddTrackJob {
get {
@@ -515,7 +531,7 @@
add_track_job = new BatchUserJob (String.Format (Catalog.GetString (
"Adding {0} of {1} to {2}"), "{0}", "{1}", Name),
Properties.GetStringList ("Icon.Name"));
- //add_track_job.DelayShow = true;
+ add_track_job.DelayShow = DelayAddJob;
add_track_job.Register ();
}
}
@@ -531,7 +547,7 @@
delete_track_job = new BatchUserJob (String.Format (Catalog.GetString (
"Deleting {0} of {1} From {2}"), "{0}", "{1}", Name),
Properties.GetStringList ("Icon.Name"));
- //delete_track_job.DelayShow = true;
+ delete_track_job.DelayShow = DelayDeleteJob;
delete_track_job.Register ();
}
}
Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs (original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs Tue May 6 15:05:31 2008
@@ -141,31 +141,33 @@
private void MapDevice (IDevice device)
{
- lock (this) {
- if (sources.ContainsKey (device.Uuid)) {
- return;
- }
-
- if (device is ICdromDevice || device is IDiscVolume) {
- return;
- }
-
- if (device is IVolume && (device as IVolume).ShouldIgnore) {
- return;
- }
-
- if (device.MediaCapabilities == null && !(device is IBlockDevice) && !(device is IVolume)) {
- return;
- }
-
- DapSource source = FindDeviceSource (device);
- if (source != null) {
- Log.DebugFormat ("Found DAP support ({0}) for device {1}", source.GetType ().FullName, source.Name);
- sources.Add (device.Uuid, source);
- ServiceManager.SourceManager.AddSource (source);
- source.NotifyUser ();
+ Banshee.Base.ThreadAssist.SpawnFromMain (delegate {
+ lock (this) {
+ if (sources.ContainsKey (device.Uuid)) {
+ return;
+ }
+
+ if (device is ICdromDevice || device is IDiscVolume) {
+ return;
+ }
+
+ if (device is IVolume && (device as IVolume).ShouldIgnore) {
+ return;
+ }
+
+ if (device.MediaCapabilities == null && !(device is IBlockDevice) && !(device is IVolume)) {
+ return;
+ }
+
+ DapSource source = FindDeviceSource (device);
+ if (source != null) {
+ Log.DebugFormat ("Found DAP support ({0}) for device {1}", source.GetType ().FullName, source.Name);
+ sources.Add (device.Uuid, source);
+ ServiceManager.SourceManager.AddSource (source);
+ source.NotifyUser ();
+ }
}
- }
+ });
}
internal void UnmapDevice (string uuid)
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 Tue May 6 15:05:31 2008
@@ -56,6 +56,11 @@
Properties.SetString ("UnmapSourceActionIconName", "media-eject");
Properties.SetString ("GtkActionPath", "/RemovableSourceContextMenu");
AfterInitialized ();
+
+ // Things are usually slower on removable disks, so don't bother trying to
+ // delay the add/remove jobs from showing.
+ DelayAddJob = false;
+ DelayDeleteJob = false;
}
public override string GenericName {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]