1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

get rid of an unnecessary class

This commit is contained in:
Mitchell Livingston 2008-12-17 02:13:49 +00:00
parent be4dc0d674
commit 37c9e00aae
4 changed files with 16 additions and 82 deletions

View file

@ -44,7 +44,6 @@
#import "BonjourController.h" #import "BonjourController.h"
#import "NSApplicationAdditions.h" #import "NSApplicationAdditions.h"
#import "NSStringAdditions.h" #import "NSStringAdditions.h"
#import "NSMenuAdditions.h"
#import "ExpandedPathToPathTransformer.h" #import "ExpandedPathToPathTransformer.h"
#import "ExpandedPathToIconTransformer.h" #import "ExpandedPathToIconTransformer.h"
#import "SpeedLimitToTurtleIconTransformer.h" #import "SpeedLimitToTurtleIconTransformer.h"
@ -2284,15 +2283,20 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) menuNeedsUpdate: (NSMenu *) menu - (void) menuNeedsUpdate: (NSMenu *) menu
{ {
#warning streamline?
if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu) if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
{ {
for (NSInteger i = [menu numberOfItems]-1; i >= 0; i--) for (NSInteger i = [menu numberOfItems]-1; i >= 0; i--)
[menu removeItemAtIndex: i]; [menu removeItemAtIndex: i];
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO]; NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange: const NSInteger groupMenuCount = [groupMenu numberOfItems];
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO]; for (NSInteger i = 0; i < groupMenuCount; i++)
{
NSMenuItem * item = [[groupMenu itemAtIndex: 0] retain];
[groupMenu removeItemAtIndex: 0];
[menu addItem: item];
[item release];
}
} }
else if (menu == fGroupFilterMenu) else if (menu == fGroupFilterMenu)
{ {
@ -2301,8 +2305,14 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:) NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:)
isSmall: YES]; isSmall: YES];
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange: const NSInteger groupMenuCount = [groupMenu numberOfItems];
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: YES]; for (NSInteger i = 0; i < groupMenuCount; i++)
{
NSMenuItem * item = [[groupMenu itemAtIndex: 0] retain];
[groupMenu removeItemAtIndex: 0];
[menu addItem: item];
[item release];
}
} }
else if (menu == fUploadMenu || menu == fDownloadMenu) else if (menu == fUploadMenu || menu == fDownloadMenu)
{ {

View file

@ -89,8 +89,6 @@ EXTRA_DIST = \
NSApplicationAdditions.m \ NSApplicationAdditions.m \
NSBezierPathAdditions.h \ NSBezierPathAdditions.h \
NSBezierPathAdditions.m \ NSBezierPathAdditions.m \
NSMenuAdditions.h \
NSMenuAdditions.m \
NSStringAdditions.h \ NSStringAdditions.h \
NSStringAdditions.m \ NSStringAdditions.m \
PeerProgressIndicatorCell.h \ PeerProgressIndicatorCell.h \

View file

@ -1,31 +0,0 @@
/******************************************************************************
* $Id$
*
* Copyright (c) 2007-2008 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface NSMenu (NSMenuAdditions)
- (void) appendItemsFromMenu: (NSMenu *) menu atIndexes: (NSIndexSet *) indexes atBottom: (BOOL) bottom;
@end

View file

@ -1,43 +0,0 @@
/******************************************************************************
* $Id$
*
* Copyright (c) 2007-2008 Transmission authors and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#import "NSMenuAdditions.h"
@implementation NSMenu (NSMenuAdditions)
- (void) appendItemsFromMenu: (NSMenu *) menu atIndexes: (NSIndexSet *) indexes atBottom: (BOOL) bottom
{
NSInteger bottomIndex = bottom ? [self numberOfItems] : 0;
NSMenuItem * item;
for (NSUInteger i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
{
item = [[menu itemAtIndex: i] retain];
[menu removeItemAtIndex: i];
[self insertItem: item atIndex: bottomIndex];
[item release];
}
}
@end