1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 14:13:23 +00:00

phase 1 of updating menu items to remove bindings

This commit is contained in:
Mitchell Livingston 2007-10-30 19:55:47 +00:00
parent 81bf7b84d9
commit 44c66afffb
5 changed files with 28 additions and 12 deletions

View file

@ -256,7 +256,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fTableView setTorrents: fDisplayedTorrents]; [fTableView setTorrents: fDisplayedTorrents];
[[fTableView tableColumnWithIdentifier: @"Torrent"] setDataCell: [[TorrentCell alloc] init]]; [[fTableView tableColumnWithIdentifier: @"Torrent"] setDataCell: [[TorrentCell alloc] init]];
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]]; [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
[fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]]; [fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
@ -1804,6 +1804,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (void) setSortReverse: (id) sender - (void) setSortReverse: (id) sender
{ {
[fDefaults setBool: ![fDefaults boolForKey: @"SortReverse"] forKey: @"SortReverse"];
[self sortTorrents]; [self sortTorrents];
} }
@ -2265,12 +2266,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
return nil; return nil;
} }
- (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) indexes #warning not working in Leopard
toPasteboard: (NSPasteboard *) pasteboard - (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) indexes toPasteboard: (NSPasteboard *) pasteboard
{ {
//only allow reordering of rows if sorting by order with no filter //only allow reordering of rows if sorting by order with no filter
if ([[fDefaults stringForKey: @"Sort"] isEqualToString: @"Order"] if ([[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER]
&& [[fDefaults stringForKey: @"Filter"] isEqualToString: @"None"] && [[fDefaults stringForKey: @"Filter"] isEqualToString: FILTER_NONE]
&& [[fSearchFilterField stringValue] length] == 0) && [[fSearchFilterField stringValue] length] == 0)
{ {
[pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self]; [pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self];
@ -2474,8 +2475,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (void) toggleSmallView: (id) sender - (void) toggleSmallView: (id) sender
{ {
BOOL makeSmall = ![fDefaults boolForKey: @"SmallView"]; BOOL makeSmall = ![fDefaults boolForKey: @"SmallView"];
if (![NSApp isOnLeopardOrBetter]) [fDefaults setBool: makeSmall forKey: @"SmallView"];
makeSmall != makeSmall;
[fTableView setRowHeight: makeSmall ? ROW_HEIGHT_SMALL : ROW_HEIGHT_REGULAR]; [fTableView setRowHeight: makeSmall ? ROW_HEIGHT_SMALL : ROW_HEIGHT_REGULAR];
@ -2848,7 +2848,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem - (BOOL) validateMenuItem: (NSMenuItem *) menuItem
{ {
SEL action = [menuItem action]; SEL action = [menuItem action];
//only enable some items if it is in a context menu or the window is useable //only enable some items if it is in a context menu or the window is useable
BOOL canUseTable = [fWindow isKeyWindow] || [[menuItem menu] supermenu] != [NSApp mainMenu]; BOOL canUseTable = [fWindow isKeyWindow] || [[menuItem menu] supermenu] != [NSApp mainMenu];
@ -2857,8 +2857,14 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
return [fWindow attachedSheet] == nil; return [fWindow attachedSheet] == nil;
//enable sort and advanced bar items //enable sort and advanced bar items
if (action == @selector(setSort:) || /*action == @selector(toggleAdvancedBar:) ||*/ action == @selector(toggleSmallView:)) if (action == @selector(setSort:) /*|| action == @selector(toggleAdvancedBar:) ||*/)
return [fWindow isVisible]; return [fWindow isVisible];
if (action == @selector(toggleSmallView:))
{
[menuItem setState: [fDefaults boolForKey: @"SmallView"] ? NSOnState : NSOffState];
return [fWindow isVisible];
}
//enable show info //enable show info
if (action == @selector(showInfo:)) if (action == @selector(showInfo:))
@ -3050,7 +3056,10 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
//enable reverse sort item //enable reverse sort item
if (action == @selector(setSortReverse:)) if (action == @selector(setSortReverse:))
return ![[fDefaults stringForKey: @"Sort"] isEqualToString: @"Order"]; {
[menuItem setState: [fDefaults boolForKey: @"SortReverse"] ? NSOnState : NSOffState];
return ![[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER];
}
//check proper filter search item //check proper filter search item
if (action == @selector(setFilterSearchType:)) if (action == @selector(setFilterSearchType:))

View file

@ -23,6 +23,14 @@
<key>SUPERCLASS</key> <key>SUPERCLASS</key>
<string>ImageBackgroundView</string> <string>ImageBackgroundView</string>
</dict> </dict>
<dict>
<key>CLASS</key>
<string>NSApplication</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSResponder</string>
</dict>
<dict> <dict>
<key>CLASS</key> <key>CLASS</key>
<string>NSMenu</string> <string>NSMenu</string>

View file

@ -10,7 +10,7 @@
<integer>5</integer> <integer>5</integer>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>21</integer> <integer>1639</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>9A581</string> <string>9A581</string>

Binary file not shown.

View file

@ -115,7 +115,6 @@
- (void) mouseDown: (NSEvent *) event - (void) mouseDown: (NSEvent *) event
{ {
//NSLog(@"down");
fClickPoint = [self convertPoint: [event locationInWindow] fromView: nil]; fClickPoint = [self convertPoint: [event locationInWindow] fromView: nil];
if ([self pointInActionRect: fClickPoint]) if ([self pointInActionRect: fClickPoint])