[banshee] [Dap.Ipod] Nitpick: common place for the music path



commit 5670ed4336d8b4ecda9975147fe8405d0647084e
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Mon Apr 5 23:19:22 2010 +0200

    [Dap.Ipod] Nitpick: common place for the music path
    
    Follows DRY and brings micro optimization since the ControlPath doesn't
    change.

 .../Banshee.Dap.Ipod/IpodSource.cs                 |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
index 9a989c7..1c78638 100644
--- a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
+++ b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
@@ -63,6 +63,8 @@ namespace Banshee.Dap.Ipod
             get { return name_path; }
         }
 
+        private string music_path;
+
         private bool database_supported;
         internal bool DatabaseSupported {
             get { return database_supported; }
@@ -82,6 +84,7 @@ namespace Banshee.Dap.Ipod
             }
 
             name_path = Path.Combine (Path.GetDirectoryName (ipod_device.TrackDatabasePath), "BansheeIPodName");
+            music_path = Path.Combine (ipod_device.ControlPath, "Music");
             Name = GetDeviceName ();
 
             SupportsPlaylists = ipod_device.ModelInfo.DeviceClass != "shuffle";
@@ -199,7 +202,7 @@ namespace Banshee.Dap.Ipod
             try {
                 int file_count = 0;
 
-                DirectoryInfo m_dir = new DirectoryInfo (Path.Combine (ipod_device.ControlPath, "Music"));
+                DirectoryInfo m_dir = new DirectoryInfo (music_path);
                 foreach (DirectoryInfo f_dir in m_dir.GetDirectories ()) {
                     file_count += f_dir.GetFiles().Length;
                 }
@@ -430,7 +433,7 @@ namespace Banshee.Dap.Ipod
 
         public override void Import ()
         {
-            Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().Enqueue (Path.Combine (ipod_device.ControlPath, "Music"));
+            Banshee.ServiceStack.ServiceManager.Get<LibraryImportManager> ().Enqueue (music_path);
         }
 
         /*public override void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, BatchUserJob job)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]