mirror of
https://github.com/transmission/transmission
synced 2025-03-17 17:25:32 +00:00
Make context menu items enabled even if the window isn't active.
Also fixed a little spacing with the buttons.
This commit is contained in:
parent
243d5a58ef
commit
ed904d154d
2 changed files with 14 additions and 7 deletions
|
@ -1140,8 +1140,9 @@ static void sleepCallBack( void * controller, io_service_t y,
|
||||||
{
|
{
|
||||||
SEL action = [menuItem action];
|
SEL action = [menuItem action];
|
||||||
|
|
||||||
//only enable some menus if window is useable
|
//only enable some items if the window is useable or it is in a context menu
|
||||||
BOOL canUseWindow = [fWindow isKeyWindow] && ![fToolbar customizationPaletteIsRunning];
|
BOOL canUseWindow = [fWindow isKeyWindow] && ![fToolbar customizationPaletteIsRunning];
|
||||||
|
BOOL fromContext = [[[menuItem menu] title] isEqualToString: @"Context"];
|
||||||
|
|
||||||
//enable show info
|
//enable show info
|
||||||
if (action == @selector(showInfo:))
|
if (action == @selector(showInfo:))
|
||||||
|
@ -1190,7 +1191,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
||||||
|
|
||||||
if (action == @selector(revealFile:))
|
if (action == @selector(revealFile:))
|
||||||
{
|
{
|
||||||
return canUseWindow && [fTableView numberOfSelectedRows] > 0;
|
return (canUseWindow || fromContext) && [fTableView numberOfSelectedRows] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//enable remove items
|
//enable remove items
|
||||||
|
@ -1224,13 +1225,13 @@ static void sleepCallBack( void * controller, io_service_t y,
|
||||||
[menuItem setTitle: [title substringToIndex:
|
[menuItem setTitle: [title substringToIndex:
|
||||||
[title rangeOfString: NS_ELLIPSIS].location]];
|
[title rangeOfString: NS_ELLIPSIS].location]];
|
||||||
}
|
}
|
||||||
return canUseWindow && [fTableView numberOfSelectedRows] > 0;
|
return (canUseWindow || fromContext) && [fTableView numberOfSelectedRows] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//enable pause item
|
//enable pause item
|
||||||
if( action == @selector(stopTorrent:) )
|
if( action == @selector(stopTorrent:) )
|
||||||
{
|
{
|
||||||
if (!canUseWindow)
|
if (!canUseWindow && !fromContext)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
|
@ -1249,7 +1250,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
||||||
//enable resume item
|
//enable resume item
|
||||||
if( action == @selector(resumeTorrent:) )
|
if( action == @selector(resumeTorrent:) )
|
||||||
{
|
{
|
||||||
if (!canUseWindow)
|
if (!canUseWindow && !fromContext)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
|
|
|
@ -28,12 +28,18 @@
|
||||||
#import "Utils.h"
|
#import "Utils.h"
|
||||||
|
|
||||||
#define BUTTON_WIDTH 14.0
|
#define BUTTON_WIDTH 14.0
|
||||||
#define BUTTON_TO_TOP 32.5
|
#define BUTTON_TO_TOP 33.5
|
||||||
#define AREA_CENTER 23.0
|
#define AREA_CENTER 21.0
|
||||||
#define DISTANCE_FROM_CENTER 2.5
|
#define DISTANCE_FROM_CENTER 2.5
|
||||||
|
|
||||||
@implementation TorrentTableView
|
@implementation TorrentTableView
|
||||||
|
|
||||||
|
- (void) awakeFromNib
|
||||||
|
{
|
||||||
|
[fContextRow setTitle: @"Context"];
|
||||||
|
[fContextNoRow setTitle: @"Context"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setTorrents: (NSArray *) torrents
|
- (void) setTorrents: (NSArray *) torrents
|
||||||
{
|
{
|
||||||
fTorrents = torrents;
|
fTorrents = torrents;
|
||||||
|
|
Loading…
Add table
Reference in a new issue