Only show a single popover when excessively clicking the global and per-transfer action buttons
This commit is contained in:
parent
cc8f73b715
commit
2d5d902175
|
@ -105,6 +105,7 @@ typedef enum
|
|||
|
||||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
|
||||
BOOL fGlobalPopoverShown;
|
||||
BOOL fSoundPlaying;
|
||||
}
|
||||
|
||||
|
|
|
@ -356,6 +356,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
fPrefsController = [[PrefsController alloc] init];
|
||||
|
||||
fQuitting = NO;
|
||||
fGlobalPopoverShown = NO;
|
||||
fSoundPlaying = NO;
|
||||
|
||||
tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, self);
|
||||
|
@ -2219,10 +2220,14 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
if ([NSApp isOnLionOrBetter])
|
||||
{
|
||||
if (fGlobalPopoverShown)
|
||||
return;
|
||||
|
||||
NSPopover * popover = [[NSPopoverLion alloc] init];
|
||||
[popover setBehavior: NSPopoverBehaviorTransient];
|
||||
GlobalOptionsPopoverViewController * viewController = [[GlobalOptionsPopoverViewController alloc] initWithHandle: [PrefsController handle]];
|
||||
[popover setContentViewController: viewController];
|
||||
[popover setDelegate: self];
|
||||
|
||||
[popover showRelativeToRect: [sender frame] ofView: sender preferredEdge: NSMaxYEdge];
|
||||
|
||||
|
@ -2249,6 +2254,17 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
}
|
||||
}
|
||||
|
||||
//don't show multiple popovers when clicking the gear button repeatedly
|
||||
- (void) popoverWillShow: (NSNotification *) notification
|
||||
{
|
||||
fGlobalPopoverShown = YES;
|
||||
}
|
||||
|
||||
- (void) popoverWillClose: (NSNotification *) notification
|
||||
{
|
||||
fGlobalPopoverShown = NO;
|
||||
}
|
||||
|
||||
- (void) menuNeedsUpdate: (NSMenu *) menu
|
||||
{
|
||||
if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
|
||||
|
|
|
@ -466,6 +466,7 @@
|
|||
[self drawImage: revealImage inRect: [self revealButtonRectForBounds: cellFrame]];
|
||||
|
||||
//action button
|
||||
#warning image should use new gear
|
||||
NSString * actionImageString;
|
||||
if (fMouseDownActionButton)
|
||||
actionImageString = @"ActionOn.png";
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
|
||||
CGFloat fPiecesBarPercent;
|
||||
NSAnimation * fPiecesBarAnimation;
|
||||
|
||||
BOOL fActionPopoverShown;
|
||||
}
|
||||
|
||||
- (BOOL) isGroupCollapsed: (NSInteger) value;
|
||||
|
|
|
@ -74,6 +74,8 @@
|
|||
fMouseActionRow = -1;
|
||||
fActionPushedRow = -1;
|
||||
|
||||
fActionPopoverShown = NO;
|
||||
|
||||
[self setDelegate: self];
|
||||
|
||||
fPiecesBarPercent = [fDefaults boolForKey: @"PiecesBar"] ? 1.0 : 0.0;
|
||||
|
@ -584,12 +586,16 @@
|
|||
|
||||
if ([NSApp isOnLionOrBetter])
|
||||
{
|
||||
if (fActionPopoverShown)
|
||||
return;
|
||||
|
||||
Torrent * torrent = [self itemAtRow: row];
|
||||
|
||||
NSPopover * popover = [[NSPopoverLion alloc] init];
|
||||
[popover setBehavior: NSPopoverBehaviorTransient];
|
||||
InfoOptionsViewController * infoViewController = [[InfoOptionsViewController alloc] init];
|
||||
[popover setContentViewController: infoViewController];
|
||||
[popover setDelegate: self];
|
||||
|
||||
[popover showRelativeToRect: rect ofView: self preferredEdge: NSMaxYEdge];
|
||||
[infoViewController setInfoForTorrents: [NSArray arrayWithObject: torrent]];
|
||||
|
@ -630,6 +636,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
//don't show multiple popovers when clicking the gear button repeatedly
|
||||
- (void) popoverWillShow: (NSNotification *) notification
|
||||
{
|
||||
fActionPopoverShown = YES;
|
||||
}
|
||||
|
||||
- (void) popoverWillClose: (NSNotification *) notification
|
||||
{
|
||||
fActionPopoverShown = NO;
|
||||
}
|
||||
|
||||
- (void) menuNeedsUpdate: (NSMenu *) menu
|
||||
{
|
||||
//this method seems to be called when it shouldn't be
|
||||
|
|
Loading…
Reference in New Issue