Changeset 1029


Ignore:
Timestamp:
Oct 24, 2006, 9:25:03 PM (15 years ago)
Author:
livings124
Message:

remove redundant methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PrefsController.m

    r1028 r1029  
    4545@interface PrefsController (Private)
    4646
    47 - (void) showGeneralPref: (id) sender;
    48 - (void) showTransfersPref: (id) sender;
    49 - (void) showBandwidthPref: (id) sender;
    50 - (void) showNetworkPref: (id) sender;
    51 
    52 - (void) setPrefView: (NSView *) view;
     47- (void) setPrefView: (id) sender;
    5348
    5449- (void) folderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
     
    10095
    10196    [fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL];
    102     [self showGeneralPref: nil];
     97    [self setPrefView: nil];
    10398   
    10499    //set download folder
     
    297292        [item setImage: [NSImage imageNamed: @"Preferences.png"]];
    298293        [item setTarget: self];
    299         [item setAction: @selector(showGeneralPref:)];
     294        [item setAction: @selector(setPrefView:)];
    300295    }
    301296    else if ([ident isEqualToString: TOOLBAR_TRANSFERS])
     
    304299        [item setImage: [NSImage imageNamed: @"Transfers.png"]];
    305300        [item setTarget: self];
    306         [item setAction: @selector(showTransfersPref:)];
     301        [item setAction: @selector(setPrefView:)];
    307302    }
    308303    else if ([ident isEqualToString: TOOLBAR_BANDWIDTH])
     
    311306        [item setImage: [NSImage imageNamed: @"Bandwidth.png"]];
    312307        [item setTarget: self];
    313         [item setAction: @selector(showBandwidthPref:)];
     308        [item setAction: @selector(setPrefView:)];
    314309    }
    315310    else if ([ident isEqualToString: TOOLBAR_NETWORK])
     
    318313        [item setImage: [NSImage imageNamed: @"Network.png"]];
    319314        [item setTarget: self];
    320         [item setAction: @selector(showNetworkPref:)];
     315        [item setAction: @selector(setPrefView:)];
    321316    }
    322317    else
     
    882877@implementation PrefsController (Private)
    883878
    884 - (void) showGeneralPref: (id) sender
    885 {
    886     [self setPrefView: fGeneralView];
    887 }
    888 
    889 - (void) showTransfersPref: (id) sender
    890 {
    891     [self setPrefView: fTransfersView];
    892 }
    893 
    894 - (void) showBandwidthPref: (id) sender
    895 {
    896     [self setPrefView: fBandwidthView];
    897 }
    898 
    899 - (void) showNetworkPref: (id) sender
    900 {
    901     [self setPrefView: fNetworkView];
    902    
    903     //make sure progress indicator hides itself
    904     if ([fPortStatusImage image])
    905         [fPortStatusProgress setDisplayedWhenStopped: NO];
    906 }
    907 
    908 - (void) setPrefView: (NSView *) view
    909 {
     879- (void) setPrefView: (id) sender
     880{
     881    NSView * view = fGeneralView;
     882    if (sender)
     883    {
     884        NSString * identifier = [sender itemIdentifier];
     885        if ([identifier isEqualToString: TOOLBAR_TRANSFERS])
     886            view = fTransfersView;
     887        else if ([identifier isEqualToString: TOOLBAR_BANDWIDTH])
     888            view = fBandwidthView;
     889        else if ([identifier isEqualToString: TOOLBAR_NETWORK])
     890            view = fNetworkView;
     891        else;
     892    }
     893   
    910894    NSWindow * window = [self window];
    911    
    912895    if ([window contentView] == view)
    913896        return;
     
    923906    [view setHidden: NO];
    924907   
    925     NSToolbarItem * item;
    926     NSEnumerator * enumerator = [[fToolbar items] objectEnumerator];
    927     while ((item = [enumerator nextObject]))
    928         if ([[item itemIdentifier] isEqualToString: [fToolbar selectedItemIdentifier]])
    929         {
    930             [window setTitle: [item label]];
    931             break;
    932         }
     908    //set title label
     909    if (sender)
     910        [window setTitle: [sender label]];
     911    else
     912    {
     913        NSToolbarItem * item;
     914        NSEnumerator * enumerator = [[fToolbar items] objectEnumerator];
     915        while ((item = [enumerator nextObject]))
     916            if ([[item itemIdentifier] isEqualToString: [fToolbar selectedItemIdentifier]])
     917            {
     918                [window setTitle: [item label]];
     919                break;
     920            }
     921    }
     922   
     923    //for network view make sure progress indicator hides itself
     924    if (view == fNetworkView && [fPortStatusImage image])
     925        [fPortStatusProgress setDisplayedWhenStopped: NO];
    933926}
    934927
Note: See TracChangeset for help on using the changeset viewer.