]> granicus.if.org Git - transmission/commitdiff
when unchecking all files in the add dialog window, don't do finished events
authorMitchell Livingston <livings124@transmissionbt.com>
Mon, 14 Apr 2008 00:05:16 +0000 (00:05 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Mon, 14 Apr 2008 00:05:16 +0000 (00:05 +0000)
macosx/Controller.h
macosx/Controller.m

index e695196e15df13367e01e1bded7b54a8d6d0d9e5..5ef6d304dce245d2c403d4410c53d7b2886a033b 100644 (file)
@@ -194,6 +194,7 @@ typedef enum
 
 - (void) torrentFinishedDownloading: (NSNotification *) notification;
 - (void) torrentRestartedDownloading: (NSNotification *) notification;
+- (void) torrentStoppedForRatio: (NSNotification *) notification;
 
 - (void) updateTorrentHistory;
 
@@ -227,8 +228,6 @@ typedef enum
 - (void) setRatioGlobalEnabled: (id) sender;
 - (void) setQuickRatioGlobal: (id) sender;
 
-- (void) torrentStoppedForRatio: (NSNotification *) notification;
-
 - (void) changeAutoImport;
 - (void) checkAutoImportDirectory;
 
index 90706ab5b159c2987e14d70a7270df0839dc666c..64fe5174110a7ba26b2538bf3de9b7ec61e51a46 100644 (file)
@@ -1593,32 +1593,33 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
     return desired;
 }
 
+#warning migrate to Torrent.m
 - (void) torrentFinishedDownloading: (NSNotification *) notification
 {
     Torrent * torrent = [notification object];
     
-    if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
+    if ([torrent isActive])
     {
-        NSSound * sound;
-        if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
+        if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
         {
-            [sound setDelegate: self];
-            fSoundPlaying = YES;
-            [sound play];
+            NSSound * sound;
+            if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"DownloadSound"]]))
+            {
+                [sound setDelegate: self];
+                fSoundPlaying = YES;
+                [sound play];
+            }
         }
-    }
-    
-    NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
-                                    [torrent dataLocation] , @"Location", nil];
-    [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
-                                description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
-                                iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
-    
-    if (![fWindow isMainWindow])
-        [fBadger incrementCompleted];
-    
-    if ([torrent isActive])
-    {
+        
+        NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_DOWNLOAD_COMPLETE, @"Type",
+                                        [torrent dataLocation] , @"Location", nil];
+        [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
+                                    description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
+                                    iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+        
+        if (![fWindow isMainWindow])
+            [fBadger incrementCompleted];
+        
         if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
         {
             [torrent stopTransfer];
@@ -1644,6 +1645,32 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
     [self updateTorrentsInQueue];
 }
 
+- (void) torrentStoppedForRatio: (NSNotification *) notification
+{
+    Torrent * torrent = [notification object];
+    
+    [self updateTorrentsInQueue];
+    [fInfoController updateInfoStats];
+    [fInfoController updateOptions];
+    
+    if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
+    {
+        NSSound * sound;
+        if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"SeedingSound"]]))
+        {
+            [sound setDelegate: self];
+            fSoundPlaying = YES;
+            [sound play];
+        }
+    }
+    
+    NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
+                                    [torrent dataLocation], @"Location", nil];
+    [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
+                        description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
+                        iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
+}
+
 - (void) updateTorrentHistory
 {
     NSMutableArray * history = [NSMutableArray arrayWithCapacity: [fTorrents count]];
@@ -2341,32 +2368,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
     [fPrefsController updateRatioStopField];
 }
 
-- (void) torrentStoppedForRatio: (NSNotification *) notification
-{
-    Torrent * torrent = [notification object];
-    
-    [self updateTorrentsInQueue];
-    [fInfoController updateInfoStats];
-    [fInfoController updateOptions];
-    
-    if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
-    {
-        NSSound * sound;
-        if ((sound = [NSSound soundNamed: [fDefaults stringForKey: @"SeedingSound"]]))
-        {
-            [sound setDelegate: self];
-            fSoundPlaying = YES;
-            [sound play];
-        }
-    }
-    
-    NSDictionary * clickContext = [NSDictionary dictionaryWithObjectsAndKeys: GROWL_SEEDING_COMPLETE, @"Type",
-                                    [torrent dataLocation], @"Location", nil];
-    [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
-                        description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
-                        iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
-}
-
 - (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) finishedPlaying
 {
     fSoundPlaying = NO;