#4705 Removing a group in prefs doesn't remove the group row in the main window

This commit is contained in:
Mitchell Livingston 2012-01-12 00:12:17 +00:00
parent 3eb8b12fa8
commit 3de5847158
2 changed files with 8 additions and 7 deletions

View File

@ -500,6 +500,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[nc addObserver: self selector: @selector(openCreatedFile:) [nc addObserver: self selector: @selector(openCreatedFile:)
name: @"OpenCreatedTorrentFile" object: nil]; name: @"OpenCreatedTorrentFile" object: nil];
[nc addObserver: self selector: @selector(applyFilter)
name: @"UpdateGroups" object: nil];
//timer to update the interface every second //timer to update the interface every second
[self updateUI]; [self updateUI];
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
@ -2352,15 +2355,15 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
} }
//remove empty groups //remove empty groups
NSIndexSet * removeIndexes = [fDisplayedTorrents indexesOfObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent passingTest: ^BOOL(id obj, NSUInteger idx, BOOL * stop) { NSIndexSet * removeGroupIndexes = [fDisplayedTorrents indexesOfObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent passingTest: ^BOOL(id obj, NSUInteger idx, BOOL * stop) {
return [[(TorrentGroup *)obj torrents] count] == 0; return [[(TorrentGroup *)obj torrents] count] == 0;
}]; }];
if ([removeIndexes count] > 0) if ([removeGroupIndexes count] > 0)
{ {
[fDisplayedTorrents removeObjectsAtIndexes: removeIndexes]; [fDisplayedTorrents removeObjectsAtIndexes: removeGroupIndexes];
if (onLion) if (onLion)
[fTableView removeItemsAtIndexes: removeIndexes inParent: nil withAnimation: NSTableViewAnimationEffectFade]; [fTableView removeItemsAtIndexes: removeGroupIndexes inParent: nil withAnimation: NSTableViewAnimationEffectFade];
} }
//now that all groups are there, sort them - don't insert on the fly in case groups were reordered in prefs //now that all groups are there, sort them - don't insert on the fly in case groups were reordered in prefs
@ -2369,7 +2372,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
} }
else else
{ {
NSAssert(groupRows != wasGroupRows, @"Trying togglng-group torrent reordering when we weren't expecting to."); NSAssert(groupRows != wasGroupRows, @"Trying toggling group-torrent reordering when we weren't expecting to.");
//since we're not doing this the right way (boo buggy animation), we need to remember selected values //since we're not doing this the right way (boo buggy animation), we need to remember selected values
selectedValues = [fTableView selectedValues]; selectedValues = [fTableView selectedValues];

View File

@ -392,8 +392,6 @@
- (void) updateGroups: (NSNotification *) notification - (void) updateGroups: (NSNotification *) notification
{ {
[self updateGroupsButton]; [self updateGroupsButton];
[[NSNotificationCenter defaultCenter] postNotificationName: @"ApplyFilter" object: nil];
} }
@end @end