Changeset 12598


Ignore:
Timestamp:
Jul 27, 2011, 3:38:01 AM (10 years ago)
Author:
livings124
Message:

Only show a single popover when excessively clicking the global and per-transfer action buttons

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r12576 r12598  
    106106    NSMutableDictionary             * fPendingTorrentDownloads;
    107107   
     108    BOOL                            fGlobalPopoverShown;
    108109    BOOL                            fSoundPlaying;
    109110}
  • trunk/macosx/Controller.m

    r12597 r12598  
    357357       
    358358        fQuitting = NO;
     359        fGlobalPopoverShown = NO;
    359360        fSoundPlaying = NO;
    360361       
     
    22202221    if ([NSApp isOnLionOrBetter])
    22212222    {
     2223        if (fGlobalPopoverShown)
     2224            return;
     2225       
    22222226        NSPopover * popover = [[NSPopoverLion alloc] init];
    22232227        [popover setBehavior: NSPopoverBehaviorTransient];
    22242228        GlobalOptionsPopoverViewController * viewController = [[GlobalOptionsPopoverViewController alloc] initWithHandle: [PrefsController handle]];
    22252229        [popover setContentViewController: viewController];
     2230        [popover setDelegate: self];
    22262231       
    22272232        [popover showRelativeToRect: [sender frame] ofView: sender preferredEdge: NSMaxYEdge];
     
    22482253        }
    22492254    }
     2255}
     2256
     2257//don't show multiple popovers when clicking the gear button repeatedly
     2258- (void) popoverWillShow: (NSNotification *) notification
     2259{
     2260    fGlobalPopoverShown = YES;
     2261}
     2262
     2263- (void) popoverWillClose: (NSNotification *) notification
     2264{
     2265    fGlobalPopoverShown = NO;
    22502266}
    22512267
  • trunk/macosx/TorrentCell.m

    r12454 r12598  
    467467       
    468468        //action button
     469        #warning image should use new gear
    469470        NSString * actionImageString;
    470471        if (fMouseDownActionButton)
  • trunk/macosx/TorrentTableView.h

    r12570 r12598  
    5353    CGFloat fPiecesBarPercent;
    5454    NSAnimation * fPiecesBarAnimation;
     55   
     56    BOOL fActionPopoverShown;
    5557}
    5658
  • trunk/macosx/TorrentTableView.m

    r12576 r12598  
    7575        fActionPushedRow = -1;
    7676       
     77        fActionPopoverShown = NO;
     78       
    7779        [self setDelegate: self];
    7880       
     
    585587    if ([NSApp isOnLionOrBetter])
    586588    {
     589        if (fActionPopoverShown)
     590            return;
     591       
    587592        Torrent * torrent = [self itemAtRow: row];
    588593       
     
    591596        InfoOptionsViewController * infoViewController = [[InfoOptionsViewController alloc] init];
    592597        [popover setContentViewController: infoViewController];
     598        [popover setDelegate: self];
    593599       
    594600        [popover showRelativeToRect: rect ofView: self preferredEdge: NSMaxYEdge];
     
    629635        fMenuTorrent = nil;
    630636    }
     637}
     638
     639//don't show multiple popovers when clicking the gear button repeatedly
     640- (void) popoverWillShow: (NSNotification *) notification
     641{
     642    fActionPopoverShown = YES;
     643}
     644
     645- (void) popoverWillClose: (NSNotification *) notification
     646{
     647    fActionPopoverShown = NO;
    631648}
    632649
Note: See TracChangeset for help on using the changeset viewer.