Changeset 3570

Show
Ignore:
Timestamp:
01/23/06 19:10:15 (3 years ago)
Author:
morris
Message:

Finish cleaning up files - browser view seems to work pretty well now


Fix up connection controller initializers, they now retain themselves


Add preference for alternating rows in transfers, fixing #18

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/Files.nib/info.nib

    r3406 r3570  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>127 169 398 359 0 0 1280 1002 </string> 
     6        <string>124 163 398 359 0 0 1920 1178 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>161</key> 
    10                 <string>2304 22 104 99 1280 0 1280 1024 </string> 
     10                <string>801 189 104 99 0 0 1920 1178 </string> 
    1111                <key>190</key> 
    12                 <string>727 494 179 49 0 0 1680 1028 </string> 
     12                <string>844 570 190 49 0 0 1920 1178 </string> 
    1313        </dict> 
    1414        <key>IBFramework Version</key> 
    1515        <string>443.0</string> 
     16        <key>IBOldestOS</key> 
     17        <integer>3</integer> 
    1618        <key>IBOpenObjects</key> 
    1719        <array> 
    1820                <integer>161</integer> 
     21                <integer>52</integer> 
    1922                <integer>5</integer> 
    20                 <integer>52</integer> 
    2123        </array> 
    2224        <key>IBSystem Version</key> 
    23         <string>8F46</string> 
     25        <string>8G32</string> 
    2426</dict> 
    2527</plist> 
  • WiredClient/trunk/English.lproj/Preferences.nib/classes.nib

    r3565 r3570  
    100100                "_showDockAtStartupButton" = NSButton;  
    101101                "_showTrackersAtStartupButton" = NSButton;  
    102                 "_showTransfersProgressBarButton" = NSButton;  
    103102                "_soundsPopUpButton" = NSPopUpButton;  
    104103                "_statusTextField" = NSTextField;  
     
    109108                "_timestampEveryLineButton" = NSButton;  
    110109                "_timestampEveryLineColorWell" = NSColorWell;  
     110                "_transfersAlternateRowsButton" = NSButton;  
     111                "_transfersShowProgressBarButton" = NSButton;  
    111112            };  
    112113            SUPERCLASS = WIWindowController;  
  • WiredClient/trunk/WCAccountEditor.h

    r3548 r3570  
    7575 
    7676 
    77 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection; 
    78 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account; 
     77+ (id)accountEditorWithConnection:(WCServerConnection *)connection; 
     78+ (id)accountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account; 
    7979 
    8080- (IBAction)create:(id)sender; 
  • WiredClient/trunk/WCAccountEditor.m

    r3550 r3570  
    3333@interface WCAccountEditor(Private) 
    3434 
     35- (id)_initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account; 
     36 
    3537- (void)_updateType; 
    3638- (void)_updateGroup; 
     
    4042 
    4143@implementation WCAccountEditor(Private) 
     44 
     45- (id)_initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 
     46        self = [super initWithWindowNibName:@"AccountEditor" 
     47                                                                   name:NSLS(@"Account Editor", @"Account editor window title") 
     48                                                         connection:connection]; 
     49 
     50        _account = [account retain]; 
     51        _groups = [[NSMutableArray alloc] init]; 
     52 
     53        [self window]; 
     54 
     55        [[self connection] addObserver:self 
     56                                                  selector:@selector(accountEditorReceivedUser:) 
     57                                                          name:WCAccountEditorReceivedUser]; 
     58 
     59        [[self connection] addObserver:self 
     60                                                  selector:@selector(accountEditorReceivedGroup:) 
     61                                                          name:WCAccountEditorReceivedGroup]; 
     62 
     63        if(_account) { 
     64                if([_account type] == WCAccountUser) { 
     65                        [_typePopUpButton selectItem:_userMenuItem]; 
     66 
     67                        [[self connection] sendCommand:WCReadUserCommand withArgument:[_account name]]; 
     68                } else { 
     69                        [_typePopUpButton selectItem:_groupMenuItem]; 
     70 
     71                        [[self connection] sendCommand:WCReadGroupCommand withArgument:[_account name]]; 
     72                } 
     73 
     74                [_okButton setAction:@selector(edit:)]; 
     75                [_okButton setTitle:NSLS(@"Save", @"Account Editor button title")]; 
     76 
     77                [_typePopUpButton setEnabled:NO]; 
     78                [_nameTextField setEnabled:NO]; 
     79        } else { 
     80                [_okButton setAction:@selector(create:)]; 
     81                [_okButton setTitle:NSLS(@"Add", @"Account Editor button title")]; 
     82 
     83                [_typePopUpButton setEnabled:YES]; 
     84                [_nameTextField setEnabled:YES]; 
     85        } 
     86 
     87        [self _updateType]; 
     88        [self _updateGroup]; 
     89         
     90        [self showWindow:self]; 
     91         
     92        [self retain]; 
     93 
     94        return self; 
     95} 
     96 
     97 
     98 
     99#pragma mark - 
    42100 
    43101- (void)_updateType { 
     
    120178@implementation WCAccountEditor 
    121179 
    122 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection { 
    123         return [self initAccountEditorWithConnection:connection account:NULL]; 
    124 
    125  
    126  
    127  
    128 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 
    129         self = [super initWithWindowNibName:@"AccountEditor" 
    130                                                                    name:NSLS(@"Account Editor", @"Account editor window title") 
    131                                                          connection:connection]; 
    132  
    133         _account = [account retain]; 
    134         _groups = [[NSMutableArray alloc] init]; 
    135  
    136         [self window]; 
    137  
    138         [[self connection] addObserver:self 
    139                                                   selector:@selector(accountEditorReceivedUser:) 
    140                                                           name:WCAccountEditorReceivedUser]; 
    141  
    142         [[self connection] addObserver:self 
    143                                                   selector:@selector(accountEditorReceivedGroup:) 
    144                                                           name:WCAccountEditorReceivedGroup]; 
    145  
    146         if(_account) { 
    147                 if([_account type] == WCAccountUser) { 
    148                         [_typePopUpButton selectItem:_userMenuItem]; 
    149  
    150                         [[self connection] sendCommand:WCReadUserCommand withArgument:[_account name]]; 
    151                 } else { 
    152                         [_typePopUpButton selectItem:_groupMenuItem]; 
    153  
    154                         [[self connection] sendCommand:WCReadGroupCommand withArgument:[_account name]]; 
    155                 } 
    156  
    157                 [_okButton setAction:@selector(edit:)]; 
    158                 [_okButton setTitle:NSLS(@"Save", @"Account Editor button title")]; 
    159  
    160                 [_typePopUpButton setEnabled:NO]; 
    161                 [_nameTextField setEnabled:NO]; 
    162         } else { 
    163                 [_okButton setAction:@selector(create:)]; 
    164                 [_okButton setTitle:NSLS(@"Add", @"Account Editor button title")]; 
    165  
    166                 [_typePopUpButton setEnabled:YES]; 
    167                 [_nameTextField setEnabled:YES]; 
    168         } 
    169  
    170         [self _updateType]; 
    171         [self _updateGroup]; 
    172          
    173         [self showWindow:self]; 
    174  
    175         return self; 
     180+ (id)accountEditorWithConnection:(WCServerConnection *)connection { 
     181        return [[[self alloc] _initAccountEditorWithConnection:connection account:NULL] autorelease]; 
     182
     183 
     184 
     185 
     186+ (id)accountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 
     187        return [[[self alloc] _initAccountEditorWithConnection:connection account:account] autorelease]; 
    176188} 
    177189 
  • WiredClient/trunk/WCAccounts.h

    r3413 r3570  
    5252 
    5353 
    54 - (id)initAccountsWithConnection:(WCServerConnection *)connection; 
     54+ (id)accountsWithConnection:(WCServerConnection *)connection; 
    5555 
    5656- (NSArray *)accounts; 
  • WiredClient/trunk/WCAccounts.m

    r3548 r3570  
    3333@interface WCAccounts(Private) 
    3434 
     35- (id)_initAccountsWithConnection:(WCServerConnection *)connection; 
     36 
    3537- (void)_update; 
    3638- (void)_updateStatus; 
     
    4749 
    4850@implementation WCAccounts(Private) 
     51 
     52- (id)_initAccountsWithConnection:(WCServerConnection *)connection { 
     53        self = [super initWithWindowNibName:@"Accounts" 
     54                                                                   name:NSLS(@"Accounts", @"Accounts window title") 
     55                                                         connection:connection]; 
     56 
     57        _allAccounts    = [[NSMutableArray alloc] init]; 
     58        _shownAccounts  = [[NSMutableArray alloc] init]; 
     59        _userImage              = [[NSImage imageNamed:@"User"] retain]; 
     60        _groupImage             = [[NSImage imageNamed:@"Group"] retain]; 
     61 
     62        [self window]; 
     63 
     64        [[self connection] addObserver:self 
     65                                                  selector:@selector(accountsShouldReload:) 
     66                                                          name:WCAccountsShouldReload]; 
     67 
     68        [[self connection] addObserver:self 
     69                                                  selector:@selector(accountsReceivedUser:) 
     70                                                          name:WCAccountsReceivedUser]; 
     71 
     72        [[self connection] addObserver:self 
     73                                                  selector:@selector(accountsCompletedUsers:) 
     74                                                          name:WCAccountsCompletedUsers]; 
     75 
     76        [[self connection] addObserver:self 
     77                                                  selector:@selector(accountsReceivedGroup:) 
     78                                                          name:WCAccountsReceivedGroup]; 
     79 
     80        [[self connection] addObserver:self 
     81                                                  selector:@selector(accountsCompletedGroups:) 
     82                                                          name:WCAccountsCompletedGroups]; 
     83         
     84        [self retain]; 
     85 
     86        return self; 
     87} 
     88 
     89 
     90 
     91#pragma mark - 
    4992 
    5093- (void)_update { 
     
    165208@implementation WCAccounts 
    166209 
    167 - (id)initAccountsWithConnection:(WCServerConnection *)connection { 
    168         self = [super initWithWindowNibName:@"Accounts" 
    169                                                                    name:NSLS(@"Accounts", @"Accounts window title") 
    170                                                          connection:connection]; 
    171  
    172         _allAccounts    = [[NSMutableArray alloc] init]; 
    173         _shownAccounts  = [[NSMutableArray alloc] init]; 
    174         _userImage              = [[NSImage imageNamed:@"User"] retain]; 
    175         _groupImage             = [[NSImage imageNamed:@"Group"] retain]; 
    176  
    177         [self window]; 
    178  
    179         [[self connection] addObserver:self 
    180                                                   selector:@selector(accountsShouldReload:) 
    181                                                           name:WCAccountsShouldReload]; 
    182  
    183         [[self connection] addObserver:self 
    184                                                   selector:@selector(accountsReceivedUser:) 
    185                                                           name:WCAccountsReceivedUser]; 
    186  
    187         [[self connection] addObserver:self 
    188                                                   selector:@selector(accountsCompletedUsers:) 
    189                                                           name:WCAccountsCompletedUsers]; 
    190  
    191         [[self connection] addObserver:self 
    192                                                   selector:@selector(accountsReceivedGroup:) 
    193                                                           name:WCAccountsReceivedGroup]; 
    194  
    195         [[self connection] addObserver:self 
    196                                                   selector:@selector(accountsCompletedGroups:) 
    197                                                           name:WCAccountsCompletedGroups]; 
    198  
    199         return self; 
     210+ (id)accountsWithConnection:(WCServerConnection *)connection { 
     211        return [[[self alloc] _initAccountsWithConnection:connection] autorelease]; 
    200212} 
    201213 
     
    401413 
    402414- (IBAction)add:(id)sender { 
    403         [[WCAccountEditor alloc] initAccountEditorWithConnection:[self connection]]; 
     415        [WCAccountEditor accountEditorWithConnection:[self connection]]; 
    404416} 
    405417 
     
    413425 
    414426        while((account = [enumerator nextObject])) 
    415                 [[WCAccountEditor alloc] initAccountEditorWithConnection:[self connection] account:account]; 
     427                [WCAccountEditor accountEditorWithConnection:[self connection] account:account]; 
    416428} 
    417429 
  • WiredClient/trunk/WCChat.m

    r3565 r3570  
    509509        _allUsers               = [[NSMutableArray alloc] init]; 
    510510        _shownUsers             = [[NSMutableArray alloc] init]; 
     511         
     512        [self window]; 
    511513 
    512514        [[NSNotificationCenter defaultCenter] 
     
    567569                                                  selector:@selector(chatReceivedTopic:) 
    568570                                                          name:WCChatReceivedTopic]; 
     571         
     572        [self retain]; 
    569573 
    570574        return self; 
     
    14321436 
    14331437- (IBAction)getInfo:(id)sender { 
    1434         [[WCUserInfo alloc] initWithConnection:[self connection] user:[self selectedUser]]; 
     1438        [WCUserInfo userInfoWithConnection:[self connection] user:[self selectedUser]]; 
    14351439} 
    14361440 
     
    14441448        account = [[[self connection] accounts] userWithName:[user login]]; 
    14451449 
    1446         [[WCAccountEditor alloc] initAccountEditorWithConnection:[self connection] account:account]; 
     1450        [WCAccountEditor accountEditorWithConnection:[self connection] account:account]; 
    14471451} 
    14481452 
  • WiredClient/trunk/WCConnection.h

    r3542 r3570  
    7272#define WCLeaveCommand                                  @"LEAVE" 
    7373#define WCListCommand                                   @"LIST" 
     74#define WCListRecursiveCommand                  @"LISTRECURSIVE" 
    7475#define WCMeCommand                                             @"ME" 
    7576#define WCMoveCommand                                   @"MOVE" 
  • WiredClient/trunk/WCConnectionController.m

    r3545 r3570  
    4343 
    4444        _name = [name retain]; 
    45         _connection = [connection retain]
     45        _connection = connection
    4646 
    4747        if([self respondsToSelector:@selector(connectionDidConnect:)]) { 
     
    116116 
    117117        [_connection removeObserver:self]; 
    118         [_connection release]
     118        _connection = NULL
    119119 
    120120        [super dealloc]; 
     
    255255 
    256256- (IBAction)files:(id)sender { 
    257         [[WCFiles alloc] initWithConnection:[self connection] path:[WCFile fileWithRootDirectory]]; 
     257        [WCFiles filesWithConnection:[self connection] path:[WCFile fileWithRootDirectory]]; 
    258258} 
    259259 
  • WiredClient/trunk/WCConsole.h

    r3542 r3570  
    3030        IBOutlet NSTextView                     *_consoleTextView; 
    3131        IBOutlet NSScrollView           *_consoleScrollView; 
    32          
    33         BOOL                                            _shared; 
    3432} 
    3533 
    3634 
    37 - (id)initConsoleWithConnection:(WCServerConnection *)connection; 
     35+ (id)consoleWithConnection:(WCServerConnection *)connection; 
    3836 
    3937@end 
  • WiredClient/trunk/WCConsole.m

    r3542 r3570  
    3131@interface WCConsole(Private) 
    3232 
    33 + (NSColor *)logColor; 
    34 + (NSColor *)inputColor; 
    35 + (NSColor *)outputColor; 
     33+ (NSColor *)_inputColor; 
     34+ (NSColor *)_outputColor; 
    3635 
    37 - (void)log:(NSString *)string color:(NSColor *)color; 
    38 - (void)print:(NSAttributedString *)string; 
     36- (id)_initConsoleWithConnection:(WCServerConnection *)connection; 
     37 
     38- (void)_log:(NSString *)string color:(NSColor *)color; 
     39- (void)_print:(NSAttributedString *)string; 
    3940 
    4041@end 
    4142 
    4243 
     44@implementation WCConsole(Private) 
    4345 
    44 @implementation WCConsole 
    45  
    46 + (NSColor *)logColor { 
    47         return [NSColor blackColor]; 
    48 
    49  
    50  
    51  
    52 + (NSColor *)inputColor { 
     46+ (NSColor *)_inputColor { 
    5347        return [NSColor blueColor]; 
    5448} 
     
    5650 
    5751 
    58 + (NSColor *)outputColor { 
     52+ (NSColor *)_outputColor { 
    5953        return [NSColor blackColor]; 
    6054} 
     
    6458#pragma mark - 
    6559 
    66 - (id)initConsoleWithConnection:(WCServerConnection *)connection { 
     60- (id)_initConsoleWithConnection:(WCServerConnection *)connection { 
    6761        self = [super initWithWindowNibName:@"Console" 
    6862                                                                   name:NSLS(@"Console", @"Console window title") 
     
    7872                                                  selector:@selector(connectionSentCommand:) 
    7973                                                          name:WCConnectionSentCommand]; 
     74         
     75        [self retain]; 
    8076 
    8177        return self; 
     78} 
     79 
     80 
     81 
     82#pragma mark - 
     83 
     84- (void)_log:(NSString *)string color:(NSColor *)color { 
     85        static NSArray          *separators; 
     86        static NSFont           *font; 
     87        NSDictionary            *attributes; 
     88        NSAttributedString      *attributedString; 
     89 
     90        if(!separators) { 
     91                separators = [[NSArray alloc] initWithObjects: 
     92                        WCFieldSeparator, WCGroupSeparator, WCRecordSeparator, NULL]; 
     93                 
     94                font = [[NSFont fontWithName:@"Monaco" size:9.0] retain]; 
     95        } 
     96 
     97        string = [string stringByReplacingOccurencesOfStrings:separators withString:@"\t"]; 
     98 
     99        attributes = [NSDictionary dictionaryWithObjectsAndKeys: 
     100                color,          NSForegroundColorAttributeName, 
     101                font,           NSFontAttributeName, 
     102                NULL]; 
     103        attributedString = [NSAttributedString attributedStringWithString:string attributes:attributes]; 
     104 
     105        [self _print:attributedString]; 
     106} 
     107 
     108 
     109 
     110- (void)_print:(NSAttributedString *)string { 
     111        float           position; 
     112 
     113        position = [[_consoleScrollView verticalScroller] floatValue]; 
     114         
     115        if([[_consoleTextView textStorage] length] > 0) 
     116                [[[_consoleTextView textStorage] mutableString] appendString:@"\n"]; 
     117         
     118        [[_consoleTextView textStorage] appendAttributedString:string]; 
     119         
     120        if(position == 1.0) 
     121                [_consoleTextView performSelectorOnce:@selector(scrollToBottom) withObject:NULL afterDelay:0.05]; 
     122} 
     123 
     124@end 
     125 
     126 
     127@implementation WCConsole 
     128 
     129+ (id)consoleWithConnection:(WCServerConnection *)connection { 
     130        return [[[self alloc] _initConsoleWithConnection:connection] autorelease]; 
    82131} 
    83132 
     
    101150 
    102151- (void)connectionReceivedMessage:(NSNotification *)notification { 
    103         [self log:[notification object] color:[WCConsole inputColor]]; 
     152        [self _log:[notification object] color:[WCConsole _inputColor]]; 
    104153} 
    105154 
     
    107156 
    108157- (void)connectionSentCommand:(NSNotification *)notification { 
    109         [self log:[notification object] color:[WCConsole outputColor]]; 
     158        [self _log:[notification object] color:[WCConsole _outputColor]]; 
    110159} 
    111160 
     
    124173} 
    125174 
    126  
    127  
    128 #pragma mark - 
    129  
    130 - (void)log:(NSString *)string color:(NSColor *)color { 
    131         static NSArray          *separators; 
    132         static NSFont           *font; 
    133         NSDictionary            *attributes; 
    134         NSAttributedString      *attributedString; 
    135  
    136         if(!separators) { 
    137                 separators = [[NSArray alloc] initWithObjects: 
    138                         WCFieldSeparator, WCGroupSeparator, WCRecordSeparator, NULL]; 
    139                  
    140                 font = [[NSFont fontWithName:@"Monaco" size:9.0] retain]; 
    141         } 
    142  
    143         string = [string stringByReplacingOccurencesOfStrings:separators withString:@"\t"]; 
    144  
    145         attributes = [NSDictionary dictionaryWithObjectsAndKeys: 
    146                 color,          NSForegroundColorAttributeName, 
    147                 font,           NSFontAttributeName, 
    148                 NULL]; 
    149         attributedString = [NSAttributedString attributedStringWithString:string attributes:attributes]; 
    150  
    151         [self print:attributedString]; 
    152 } 
    153  
    154  
    155  
    156 - (void)print:(NSAttributedString *)string { 
    157         float           position; 
    158  
    159         position = [[_consoleScrollView verticalScroller] floatValue]; 
    160          
    161         if([[_consoleTextView textStorage] length] > 0) 
    162                 [[[_consoleTextView textStorage] mutableString] appendString:@"\n"]; 
    163          
    164         [[_consoleTextView textStorage] appendAttributedString:string]; 
    165          
    166         if(position == 1.0) 
    167                 [_consoleTextView performSelectorOnce:@selector(scrollToBottom) withObject:NULL afterDelay:0.05]; 
    168 } 
    169  
    170175@end 
  • WiredClient/trunk/WCFile.h

    r3569 r3570  
    5757 
    5858+ (NSImage *)iconForFolderType:(WCFileType)type width:(double)width; 
    59 + (NSImage *)iconForFile:(WCFile *)file width:(double)width; 
    6059+ (NSString *)kindForFolderType:(WCFileType)type; 
    61 + (NSString *)kindForFile:(WCFile *)file; 
    6260+ (WCFileType)folderTypeForString:(NSString *)string; 
    6361 
  • WiredClient/trunk/WCFile.m

    r3569 r3570  
    174174 
    175175 
    176 + (NSImage *)iconForFile:(WCFile *)file width:(double)width { 
    177         NSImage         *icon; 
    178         NSString        *extension; 
    179          
    180         if([file isFolder]) { 
    181                 icon = [self iconForFolderType:[file type] width:width]; 
    182         } else { 
    183                 extension = [file extension]; 
    184                 icon = [[WCCache cache] fileIconForExtension:extension]; 
    185                  
    186                 if(!icon) { 
    187                         icon = [[NSWorkspace sharedWorkspace] iconForFileType:extension]; 
    188                         [[WCCache cache] setFileIcon:icon forExtension:extension]; 
    189                 } 
    190                          
    191                 [icon setSize:NSMakeSize(width, width)]; 
    192         } 
    193          
    194         return icon; 
    195 } 
    196  
    197  
    198  
    199176+ (NSString *)kindForFolderType:(WCFileType)type { 
    200177        static NSString         *folder, *uploads, *dropbox; 
     
    229206                 
    230207        return NULL; 
    231 } 
    232  
    233  
    234  
    235 + (NSString *)kindForFile:(WCFile *)file { 
    236         NSString        *kind; 
    237          
    238         if([file isFolder]) { 
    239                 kind = [self kindForFolderType:[file type]]; 
    240         } else { 
    241                 LSCopyKindStringForTypeInfo(kLSUnknownType, 
    242                                                                 kLSUnknownCreator, 
    243                                                                 (CFStringRef) [file extension], 
    244                                                                 (CFStringRef *) &kind); 
    245                  
    246                 [kind autorelease]; 
    247         } 
    248                  
    249         return kind; 
    250208} 
    251209 
     
    454412 
    455413- (NSString *)kind { 
    456         if(!_kind) 
    457                 _kind = [[[self class] kindForFile:self] retain]; 
    458          
     414        if(!_kind) { 
     415                if([self isFolder]) { 
     416                        _kind = [[[self class] kindForFolderType:[self type]] retain]; 
     417                } else { 
     418                        LSCopyKindStringForTypeInfo(kLSUnknownType, 
     419                                                                        kLSUnknownCreator, 
     420                                                                        (CFStringRef) [self extension], 
     421                                                                        (CFStringRef *) &_kind); 
     422                } 
     423        } 
     424                 
    459425        return _kind; 
    460426} 
     
    469435 
    470436- (NSImage *)iconWithWidth:(double)width { 
    471         return [[self class] iconForFile:self width:width]; 
     437        NSImage         *icon; 
     438        NSString        *extension; 
     439         
     440        if([self isFolder]) { 
     441                icon = [[self class] iconForFolderType:[self type] width:width]; 
     442        } else { 
     443                extension = [self extension]; 
     444                icon = [[WCCache cache] fileIconForExtension:extension]; 
     445                 
     446                if(!icon) { 
     447                        icon = [[NSWorkspace sharedWorkspace] iconForFileType:extension]; 
     448                        [[WCCache cache] setFileIcon:icon forExtension:extension]; 
     449                } 
     450                 
     451                icon = [[icon copy] autorelease]; 
     452                [icon setSize:NSMakeSize(width, width)]; 
     453        } 
     454         
     455        return icon; 
    472456} 
    473457 
  • WiredClient/trunk/WCFileInfo.h

    r3441 r3570  
    5353 
    5454 
    55 - (id)initWithConnection:(WCServerConnection *)connection file:(WCFile *)file; 
     55+ (id)fileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file; 
    5656 
    5757@end 
  • WiredClient/trunk/WCFileInfo.m

    r3569 r3570  
    3434@interface WCFileInfo(Private) 
    3535 
     36- (id)_initFileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file; 
     37 
    3638- (void)_resizeTextField:(NSTextField *)textField withTextField:(NSTextField *)titleTextField atOffset:(float *)offset; 
    3739 
     
    4042 
    4143@implementation WCFileInfo(Private) 
     44 
     45- (id)_initFileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 
     46        self = [super initWithWindowNibName:@"FileInfo" connection:connection]; 
     47 
     48        _file = [file retain]; 
     49 
     50        [self window]; 
     51 
     52        [[self connection] addObserver:self 
     53                                                  selector:@selector(fileInfoReceivedFileInfo:) 
     54                                                          name:WCFileInfoReceivedFileInfo]; 
     55 
     56        [[self connection] sendCommand:WCStatCommand withArgument:[_file path]]; 
     57         
     58        [self retain]; 
     59 
     60        return self; 
     61} 
     62 
     63 
     64 
     65#pragma mark - 
    4266 
    4367- (void)_resizeTextField:(NSTextField *)textField withTextField:(NSTextField *)titleTextField atOffset:(float *)offset { 
     
    7296@implementation WCFileInfo 
    7397 
    74 - (id)initWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 
    75         self = [super initWithWindowNibName:@"FileInfo" connection:connection]; 
    76  
    77         _file = [file retain]; 
    78  
    79         [self window]; 
    80  
    81         [[self connection] addObserver:self 
    82                                                   selector:@selector(fileInfoReceivedFileInfo:) 
    83                                                           name:WCFileInfoReceivedFileInfo]; 
    84  
    85         [[self connection] sendCommand:WCStatCommand withArgument:[_file path]]; 
    86  
    87         return self; 
     98+ (id)fileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 
     99        return [[[self alloc] _initFileInfoWithConnection:connection file:file] autorelease]; 
    88100} 
    89101 
     
    137149                 
    138150                // --- compare the existing comment with the one in the text field 
    139                 if(![[_file comment] isEqualToString:[_commentTextField stringValue]]) { 
     151                if(![[_file comment] ? [_file comment] : @"" isEqualToString:[_commentTextField stringValue]]) { 
    140152                        if([[self connection] protocol] >= 1.1) { 
    141153                                [[self connection] sendCommand:WCCommentCommand 
     
    221233 
    222234        // --- set fields 
    223         [_iconImageView setImage:[WCFile iconForFile:_file width:32.0]]; 
     235        [_iconImageView setImage:[_file iconWithWidth:32.0]]; 
    224236        [_fileTextField setStringValue:[_file name]]; 
    225237        [_kindTextField setStringValue:[_file kind]]; 
  • WiredClient/trunk/WCFiles.h

    r3569 r3570  
    8585 
    8686 
    87 - (id)initWithConnection:(WCServerConnection *)connection path:(WCFile *)path; 
    88 - (id)initWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath; 
     87+ (id)filesWithConnection:(WCServerConnection *)connection path:(WCFile *)path; 
     88+ (id)filesWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath; 
    8989 
    9090- (IBAction)up:(id)sender; 
  • WiredClient/trunk/WCFiles.m

    r3569 r3570  
    2828 
    2929#import "WCAccount.h" 
    30 #import "WCBrowserCell.h" 
    3130#import "WCCache.h" 
    3231#import "WCFile.h" 
    3332#import "WCFileInfo.h" 
    3433#import "WCFiles.h" 
     34#import "WCFilesBrowserCell.h" 
    3535#import "WCPreferences.h" 
    3636#import "WCPreview.h" 
     
    3939@interface WCFiles(Private) 
    4040 
     41- (id)_initFilesWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath; 
     42 
    4143- (void)_setCurrentPath:(WCFile *)path; 
    4244- (WCFile *)_currentPath;