banshee r4914 - in trunk/banshee: . src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma



Author: gburt
Date: Tue Jan 13 20:47:53 2009
New Revision: 4914
URL: http://svn.gnome.org/viewvc/banshee?rev=4914&view=rev

Log:
2009-01-13  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma/KarmaSource.cs: Patch from
	Bob Copeland improving Karma detection and adding OnTracksAdded call (BGO
	#566205)


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma/KarmaSource.cs

Modified: trunk/banshee/src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma/KarmaSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma/KarmaSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Karma/Banshee.Dap.Karma/KarmaSource.cs	Tue Jan 13 20:47:53 2009
@@ -72,29 +72,25 @@
         protected override void LoadFromDevice()
         {
             ReloadDatabase();
+            OnTracksAdded();
         }
 
         private bool IsKarma(IDevice dev)
         {
-            IBlockDevice bdev = dev as IBlockDevice;
+            IVolume volume = dev as IVolume;
 
-            if (bdev == null ||
-                dev.Name.IndexOf("Rio Karma") < 0) {
+            if (volume == null)
                 return false;
-            }
 
-            // now check for a mounted disk (pick the largest partition)
-            bool found = false;
-            ulong max_size = 0;
-            foreach (IVolume volume in bdev.Volumes) {
-                if (volume.FileSystem.Equals("omfs") &&
-                    volume.Capacity > max_size) {
-                        Name = volume.Name;
-                    mount_point = volume.MountPoint;
-                    found = true;
-                }
-            }
-            return found;
+            IUsbDevice usbdev = volume.ResolveRootUsbDevice();
+            if (usbdev == null)
+                return false;
+
+            int vendor_id = usbdev.VendorId;
+            int product_id = usbdev.ProductId;
+
+            mount_point = volume.MountPoint;
+            return (vendor_id == 0x045a && product_id == 0x5210);
         }
 
         private void ReloadDatabase()



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