Ignore:
Timestamp:
06/14/03 09:54:54 (19 years ago)
Author:
Nicholas Riley
Message:

ICeCoffEE 1.4a1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m

    r139 r142  
    421421
    422422// returns YES if menu contains useful items, NO otherwise
    423 BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu) {
     423BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu, NSDictionary *serviceOptions) {
    424424    [menu update]; // doesn't propagate to submenus, so we need to do this first
    425425    NSEnumerator *enumerator = [[menu itemArray] objectEnumerator];
    426426    NSMenuItem *menuItem;
    427427    NSMenu *submenu;
     428    NSDictionary *itemOptions = nil;
    428429    BOOL shouldKeepItem = NO, shouldKeepMenu = NO;
    429430
    430431    while ( (menuItem = [enumerator nextObject]) != nil) {
    431         if ( (submenu = [menuItem submenu]) != nil) {
    432             shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu);
     432        if (serviceOptions != nil)
     433            itemOptions = [serviceOptions objectForKey: [menuItem title]];
     434        if ([[itemOptions objectForKey: (NSString *)kICServiceHidden] boolValue]) {
     435            shouldKeepItem = NO;
     436        } else if ( (submenu = [menuItem submenu]) != nil) {
     437            shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu, [itemOptions objectForKey: (NSString *)kICServiceSubmenu]);
    433438            if (shouldKeepItem && [submenu numberOfItems] == 1) { // consolidate
    434439                NSMenuItem *serviceItem = [[submenu itemAtIndex: 0] retain];
     
    457462NSMenuItem *ICCF_ContextualServicesMenuItem() {
    458463    NSMenuItem *servicesItem = ICCF_ServicesMenuItem();
    459     if (ICCF_ConsolidateServicesMenu([servicesItem submenu]))
     464    if (ICCF_ConsolidateServicesMenu([servicesItem submenu], (NSDictionary *)ICCF_prefs.serviceOptions))
    460465        return servicesItem;
    461466    else
Note: See TracChangeset for help on using the changeset viewer.