Ignore:
Timestamp:
Dec 17, 2008, 2:19:14 AM (12 years ago)
Author:
livings124
Message:

cleanup for the group menu filling adjustment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r7426 r7427  
    22842284- (void) menuNeedsUpdate: (NSMenu *) menu
    22852285{
    2286     if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
    2287     {
    2288         for (NSInteger i = [menu numberOfItems]-1; i >= 0; i--)
     2286    if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu || menu == fGroupFilterMenu)
     2287    {
     2288        const BOOL filter = menu == fGroupFilterMenu;
     2289       
     2290        const NSInteger remaining = filter ? 3 : 0;
     2291        for (NSInteger i = [menu numberOfItems]-1; i >= remaining; i--)
    22892292            [menu removeItemAtIndex: i];
    22902293       
    2291         NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
    2292         const NSInteger groupMenuCount = [groupMenu numberOfItems];
    2293         for (NSInteger i = 0; i < groupMenuCount; i++)
    2294         {
    2295             NSMenuItem * item = [[groupMenu itemAtIndex: 0] retain];
    2296             [groupMenu removeItemAtIndex: 0];
    2297             [menu addItem: item];
    2298             [item release];
    2299         }
    2300     }
    2301     else if (menu == fGroupFilterMenu)
    2302     {
    2303         for (NSInteger i = [menu numberOfItems]-1; i >= 3; i--)
    2304             [menu removeItemAtIndex: i];
    2305        
    2306         NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:)
    2307                                 isSmall: YES];
     2294        NSMenu * groupMenu;
     2295        if (filter)
     2296            groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
     2297        else
     2298            groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:) isSmall: YES];
     2299       
    23082300        const NSInteger groupMenuCount = [groupMenu numberOfItems];
    23092301        for (NSInteger i = 0; i < groupMenuCount; i++)
Note: See TracChangeset for help on using the changeset viewer.