*****************************************************************************/
#import "GroupsController.h"
+#import "NSMutableArrayAdditions.h"
#define ICON_WIDTH 16.0
#define ICON_WIDTH_SMALL 12.0
- (void) moveGroupAtRow: (NSInteger) oldRow toRow: (NSInteger) newRow
{
- if (oldRow < newRow)
- newRow--;
-
- //remove objects to reinsert
- id movingGroup = [[fGroups objectAtIndex: oldRow] retain];
- [fGroups removeObjectAtIndex: oldRow];
-
- //insert objects at new location
- [fGroups insertObject: movingGroup atIndex: newRow];
-
- [movingGroup release];
+ [fGroups moveObjectAtIndex: oldRow toIndex: newRow];
[self saveGroups];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: GROUP_TABLE_VIEW_DATA_TYPE]];
NSInteger oldRow = [indexes firstIndex], selectedRow = [fTableView selectedRow];
+ if (oldRow < newRow)
+ newRow--;
if ([NSApp isOnLionOrBetter])
[fTableView beginUpdates];
[[GroupsController groups] moveGroupAtRow: oldRow toRow: newRow];
- if (oldRow < newRow)
- newRow--;
-
if ([NSApp isOnLionOrBetter])
{
[fTableView moveRowAtIndex: oldRow toIndex: newRow];