mirror of
https://github.com/transmission/transmission.git
synced 2025-12-26 21:29:18 +00:00
add a menu additions class
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#import "TorrentCell.h"
|
||||
#import "Controller.h"
|
||||
#import "Torrent.h"
|
||||
#import "NSMenuAdditions.h"
|
||||
|
||||
#define PADDING 3.0
|
||||
|
||||
@@ -53,8 +54,6 @@
|
||||
|
||||
- (void) updateFileMenu: (NSMenu *) menu forFiles: (NSArray *) files;
|
||||
|
||||
- (void) moveItemsFromMenu: (NSMenu *) oldMenu inRange: (NSRange) range toMenu: (NSMenu *) newMenu;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TorrentTableView
|
||||
@@ -319,7 +318,7 @@
|
||||
|
||||
//add file menu items to action menu
|
||||
NSRange range = NSMakeRange(0, [fileMenu numberOfItems]);
|
||||
[self moveItemsFromMenu: fileMenu inRange: range toMenu: fActionMenu];
|
||||
[fActionMenu moveItemsToEndFromMenu: fileMenu inRange: range];
|
||||
|
||||
//place menu below button
|
||||
NSRect rect = [self actionRectForRow: row];
|
||||
@@ -335,7 +334,7 @@
|
||||
|
||||
//move file menu items back to the torrent's file menu
|
||||
range.location = [fActionMenu numberOfItems] - range.length;
|
||||
[self moveItemsFromMenu: fActionMenu inRange: range toMenu: fileMenu];
|
||||
[fileMenu moveItemsToEndFromMenu: fActionMenu inRange: range];
|
||||
|
||||
[fMenuTorrent release];
|
||||
fMenuTorrent = nil;
|
||||
@@ -635,18 +634,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
#warning move to additions
|
||||
- (void) moveItemsFromMenu: (NSMenu *) oldMenu inRange: (NSRange) range toMenu: (NSMenu *) newMenu
|
||||
{
|
||||
NSMenuItem * item;
|
||||
int i;
|
||||
for (i=0; i<range.length; i++)
|
||||
{
|
||||
item = [[oldMenu itemAtIndex: range.location] retain];
|
||||
[oldMenu removeItem: item];
|
||||
[newMenu addItem: item];
|
||||
[item release];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user