Changeset 3974

Show
Ignore:
Timestamp:
03/27/06 20:04:57 (3 years ago)
Author:
morris
Message:

Use property dictionaries everywhere

Files:

Legend:

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

    r3656 r3974  
    88        <dict> 
    99                <key>161</key> 
    10                 <string>519 158 104 99 0 0 1280 1002 </string> 
     10                <string>801 189 104 99 0 0 1920 1178 </string> 
    1111                <key>190</key> 
    1212                <string>844 570 190 49 0 0 1920 1178 </string> 
     
    1818        <key>IBOpenObjects</key> 
    1919        <array> 
     20                <integer>52</integer> 
     21                <integer>5</integer> 
    2022                <integer>161</integer> 
    21                 <integer>5</integer> 
    22                 <integer>52</integer> 
    2323        </array> 
    2424        <key>IBSystem Version</key> 
    25         <string>8G32</string> 
     25        <string>8H14</string> 
    2626</dict> 
    2727</plist> 
  • WiredClient/trunk/WCAccountEditor.m

    r3672 r3974  
    5050                                                         connection:connection]; 
    5151 
     52        [self setReleasedWhenClosed:YES]; 
    5253        [self window]; 
    5354 
     
    186187 
    187188- (void)_setForAccount:(WCAccount *)account { 
    188 /*      if([_typePopUpButton selectedItem] == _groupMenuItem) 
    189                 [_nameTextField setStringValue:[account name]]; 
    190  
    191         if([account type] == WCAccountUser) { 
    192                 [_passwordTextField setStringValue:[account password]]; 
    193  
    194                 if([[account group] length] > 0) 
    195                         [_groupPopUpButton selectItemWithTitle:[account group]]; 
    196         } 
    197 */ 
    198189        [_getUserInfoButton setState:[account getUserInfo]]; 
    199190        [_broadcastButton setState:[account broadcast]]; 
     
    264255 
    265256        [[self window] setTitle:[[self connection] name] withSubtitle:[self name]]; 
    266         [self setShouldSaveWindowSizeOnly:YES]; 
     257         
    267258        [self setShouldCascadeWindows:YES]; 
    268259        [self setWindowFrameAutosaveName:@"AccountEditor"]; 
     
    302293                _cannotBeKickedButton, 
    303294                NULL]; 
    304 
    305  
    306  
    307  
    308 - (void)windowWillClose:(NSNotification *)notification { 
    309         [self autorelease]; 
     295         
     296        [super windowDidLoad]; 
    310297} 
    311298 
  • WiredClient/trunk/WCAccounts.m

    r3960 r3974  
    236236        [iconCell release]; 
    237237 
    238         [self setShouldCascadeWindows:NO]; 
    239         [self setWindowFrameAutosaveName:@"Accounts"]; 
    240  
    241238        [_accountsTableView setDoubleAction:@selector(edit:)]; 
    242239        [_accountsTableView setDeleteAction:@selector(delete:)]; 
    243         [_accountsTableView setAutosaveName:@"Accounts"]; 
    244         [_accountsTableView setAutosaveTableColumns:YES]; 
     240        [_accountsTableView setDefaultHighlightedTableColumnIdentifier:@"Name"]; 
    245241        [[self window] makeFirstResponder:_accountsTableView]; 
    246242 
     
    248244        [self _updateStatus]; 
    249245        [self _validate]; 
     246         
     247        [super windowDidLoad]; 
     248} 
     249 
     250 
     251 
     252- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     253        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCAccountsWindow"]]; 
     254        [_accountsTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCAccountsTableView"]]; 
     255} 
     256 
     257 
     258 
     259- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     260        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCAccountsWindow"]; 
     261        [windowTemplate setObject:[_accountsTableView propertiesDictionary] forKey:@"WCAccountsTableView"]; 
    250262} 
    251263 
  • WiredClient/trunk/WCChat.m

    r3965 r3974  
    645645        [self _update]; 
    646646        [self validate]; 
     647         
     648        [super windowDidLoad]; 
    647649} 
    648650 
     
    651653- (void)windowWillClose:(NSNotification *)notification { 
    652654        [_userListTableView setDataSource:NULL]; 
     655} 
     656 
     657 
     658 
     659- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     660        [_userListSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCChatUserListSplitView"]]; 
     661        [_chatSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCChatSplitView"]]; 
     662} 
     663 
     664 
     665 
     666- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     667        [windowTemplate setObject:[_userListSplitView propertiesDictionary] forKey:@"WCChatUserListSplitView"]; 
     668        [windowTemplate setObject:[_chatSplitView propertiesDictionary] forKey:@"WCChatSplitView"]; 
    653669} 
    654670 
  • WiredClient/trunk/WCConnectionController.h

    r3961 r3974  
    3333         
    3434        BOOL                                    _hidden; 
     35        BOOL                                    _releasedWhenClosed; 
    3536} 
    3637 
     
    4546- (void)setHidden:(BOOL)value; 
    4647- (BOOL)isHidden; 
     48- (void)setReleasedWhenClosed:(BOOL)value; 
     49- (BOOL)isReleasedWhenClosed; 
    4750 
    4851- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate; 
  • WiredClient/trunk/WCConnectionController.m

    r3963 r3974  
    5454         
    5555        if(windowTemplate) 
    56                 _windowTemplate = [windowTemplate mutableCopy]; 
    57         else 
     56                _windowTemplate = [[windowTemplate objectForKey:[self windowNibName]] mutableCopy]; 
     57 
     58        if(!_windowTemplate) 
    5859                _windowTemplate = [[NSMutableDictionary alloc] init]; 
    5960         
     
    6465 
    6566- (void)_saveWindowTemplate { 
     67        NSMutableDictionary             *windowTemplate; 
     68         
    6669        [self windowTemplateShouldSave:_windowTemplate]; 
    6770         
    68         if([[self connection] bookmark]) 
    69                 [WCSettings setWindowTemplate:_windowTemplate forKey:[[[self connection] bookmark] objectForKey:WCBookmarksIdentifier]]; 
    70         else 
    71                 [WCSettings setWindowTemplate:_windowTemplate forKey:[[[self connection] URL] hostpair]]; 
     71        windowTemplate = [[WCSettings windowTemplateForKey:[[self connection] identifier]] mutableCopy]; 
     72         
     73        if(!windowTemplate) 
     74                windowTemplate = [[NSMutableDictionary alloc] init]; 
     75                 
     76        [windowTemplate setObject:_windowTemplate forKey:[self windowNibName]]; 
     77         
     78        [WCSettings setWindowTemplate:windowTemplate forKey:[[self connection] identifier]]; 
     79         
     80        [windowTemplate release]; 
    7281} 
    7382 
     
    8998        _connection = connection; 
    9099         
    91         [self _loadWindowTemplate]; 
    92  
     100        [_connection addObserver:self 
     101                                        selector:@selector(_connectionWillTerminate:) 
     102                                                name:WCConnectionWillTerminate]; 
     103 
     104        [_connection addObserver:self 
     105                                        selector:@selector(_connectionDidTerminate:) 
     106                                                name:WCConnectionDidTerminate]; 
     107 
     108        [_connection addObserver:self 
     109                                        selector:@selector(_serverConnectionShouldHide:) 
     110                                                name:WCServerConnectionShouldHide]; 
     111         
     112        [_connection addObserver:self 
     113                                        selector:@selector(_serverConnectionShouldUnhide:) 
     114                                                name:WCServerConnectionShouldUnhide]; 
     115 
     116        [_connection addObserver:self 
     117                                        selector:@selector(_serverConnectionShouldLoadWindowTemplate:) 
     118                                                name:WCServerConnectionShouldLoadWindowTemplate]; 
     119 
     120        [_connection addObserver:self 
     121                                        selector:@selector(_serverConnectionShouldSaveWindowTemplate:) 
     122                                                name:WCServerConnectionShouldSaveWindowTemplate]; 
     123         
    93124        if([self respondsToSelector:@selector(connectionDidConnect:)]) { 
    94125                [_connection addObserver:self 
     
    145176        } 
    146177         
    147         [_connection addObserver:self 
    148                                         selector:@selector(_connectionDidTerminate:) 
    149                                                 name:WCConnectionDidTerminate]; 
    150  
    151         [_connection addObserver:self 
    152                                         selector:@selector(_serverConnectionShouldHide:) 
    153                                                 name:WCServerConnectionShouldHide]; 
    154          
    155         [_connection addObserver:self 
    156                                         selector:@selector(_serverConnectionShouldUnhide:) 
    157                                                 name:WCServerConnectionShouldUnhide]; 
    158  
    159         [_connection addObserver:self 
    160                                         selector:@selector(_serverConnectionShouldLoadWindowTemplate:) 
    161                                                 name:WCServerConnectionShouldLoadWindowTemplate]; 
    162  
    163         [_connection addObserver:self 
    164                                         selector:@selector(_serverConnectionShouldSaveWindowTemplate:) 
    165                                                 name:WCServerConnectionShouldSaveWindowTemplate]; 
    166          
    167178        return self; 
    168179} 
     
    185196#pragma mark - 
    186197 
     198- (void)_WC_windowWillClose:(NSNotification *)notification { 
     199        if([self isReleasedWhenClosed]) { 
     200                [self _saveWindowTemplate]; 
     201                 
     202                [self autorelease]; 
     203        } 
     204} 
     205 
     206 
     207 
     208- (void)_connectionWillTerminate:(NSNotification *)notification { 
     209        [self _saveWindowTemplate]; 
     210} 
     211 
     212 
     213 
    187214- (void)_connectionDidTerminate:(NSNotification *)notification { 
    188         [self _saveWindowTemplate]; 
    189          
    190215        [_connection removeObserver:self]; 
    191216        _connection = NULL; 
     
    195220 
    196221- (void)_serverConnectionShouldHide:(NSNotification *)notification { 
    197         _hidden = ![[self window] isVisible]; 
     222        _hidden = ![[self window] isOnScreen]; 
    198223 
    199224        [[self window] orderOut:self]; 
     
    223248#pragma mark - 
    224249 
    225 - (void)setWindowFrameAutosaveName:(NSString *)value { 
    226         [super setWindowFrameAutosaveName:value]; 
    227          
    228         if([self connection]) { 
    229                 if([[self connection] bookmark]) { 
    230                         [super setWindowFrameAutosaveName:[NSSWF:@"%@ %@", 
    231                                 value, 
    232                                 [[[self connection] bookmark] objectForKey:WCBookmarksIdentifier]]]; 
    233                 } else { 
    234                         [super setWindowFrameAutosaveName:[NSSWF:@"%@ %@", 
    235                                 value, 
    236                                 [[[self connection] URL] hostpair]]]; 
    237                 } 
    238         } 
     250- (void)windowDidLoad { 
     251        [[NSNotificationCenter defaultCenter] 
     252                addObserver:self 
     253                   selector:@selector(_WC_windowWillClose:) 
     254                           name:NSWindowWillCloseNotification 
     255                         object:[self window]]; 
     256                          
     257        [self _loadWindowTemplate]; 
    239258} 
    240259 
     
    281300- (BOOL)isHidden { 
    282301        return _hidden; 
     302} 
     303 
     304 
     305 
     306- (void)setReleasedWhenClosed:(BOOL)value { 
     307        _releasedWhenClosed = value; 
     308} 
     309 
     310 
     311 
     312- (BOOL)isReleasedWhenClosed { 
     313        return _releasedWhenClosed; 
    283314} 
    284315 
  • WiredClient/trunk/WCConsole.m

    r3943 r3974  
    135135#pragma mark - 
    136136 
    137 - (void)windowDidLoad { 
    138         [self setShouldCascadeWindows:NO]; 
    139         [self setWindowFrameAutosaveName:@"Console"]; 
     137- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     138        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCConsoleWindow"]]; 
     139
     140 
     141 
     142 
     143- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     144        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCConsoleWindow"]; 
    140145} 
    141146 
  • WiredClient/trunk/WCFileInfo.m

    r3667 r3974  
    5050        _file = [file retain]; 
    5151 
     52        [self setReleasedWhenClosed:YES]; 
    5253        [self window]; 
    5354 
     
    139140        [[self window] setTitle:[NSSWF: 
    140141                NSLS(@"%@ Info", @"File info window title (filename)"), [_file name]]]; 
     142         
    141143        [self setShouldCascadeWindows:YES]; 
    142         [self setShouldSaveWindowSizeOnly:YES]; 
     144        [self setShouldSaveWindowFrameOriginOnly:YES]; 
    143145        [self setWindowFrameAutosaveName:@"FileInfo"]; 
     146         
     147        [super windowDidLoad]; 
    144148} 
    145149 
     
    154158        path = [parentPath stringByAppendingPathComponent:[_fileTextField stringValue]]; 
    155159 
    156         if([[self window] isVisible] && [[[self connection] account] alterFiles] && [[self connection] isConnected]) { 
     160        if([[self window] isOnScreen] && [[[self connection] account] alterFiles] && [[self connection] isConnected]) { 
    157161                // --- compare the existing file name with the one in the text field 
    158162                if(![[_file name] isEqualToString:[_fileTextField stringValue]]) { 
     
    195199                                                                           userInfo:dictionary]; 
    196200        } 
    197  
    198         [self autorelease]; 
    199201} 
    200202 
  • WiredClient/trunk/WCFiles.m

    r3956 r3974  
    9191        [self _validate]; 
    9292 
     93        [self setReleasedWhenClosed:YES]; 
    9394        [self showWindow:self]; 
    9495         
     
    629630        [_filesBrowser setAction:@selector(browserDidSingleClick:)]; 
    630631        [_filesBrowser setDoubleAction:@selector(open:)]; 
    631         [_filesBrowser setColumnsAutosaveName:@"Files"]; 
    632632        [_filesBrowser loadColumnZero]; 
    633633 
     
    644644        [_filesTableView setDefaultTableColumnIdentifiers: 
    645645                [NSArray arrayWithObjects:@"Name", @"Size", NULL]]; 
    646         [_filesTableView setAutosaveName:@"Files"]; 
    647         [_filesTableView setAutosaveTableColumns:YES]; 
    648646 
    649647        [_titleBarMenu removeAllItems]; 
     
    667665         
    668666        [self _update]; 
     667         
     668        [super windowDidLoad]; 
    669669} 
    670670 
     
    673673- (void)windowWillClose:(NSNotification *)notification { 
    674674        [_filesTableView setDataSource:NULL]; 
    675  
    676         [self autorelease]; 
    677675} 
    678676 
     
    693691         
    694692        return frame; 
     693} 
     694 
     695 
     696 
     697- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     698        [_filesTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCFilesTableView"]]; 
     699} 
     700 
     701 
     702 
     703- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     704        [windowTemplate setObject:[_filesTableView propertiesDictionary] forKey:@"WCFilesTableView"]; 
    695705} 
    696706 
  • WiredClient/trunk/WCMessages.m

    r3732 r3974  
    477477        [iconCell release]; 
    478478 
    479         [self setShouldCascadeWindows:NO]; 
    480         [self setWindowFrameAutosaveName:@"Messages"]; 
    481  
    482         [_conversationsSplitView setAutosaveName:@"Conversations"]; 
    483         [_messagesSplitView setAutosaveName:@"Messages"]; 
    484  
    485479        [_messagesTableView setDoubleAction:@selector(reply:)]; 
    486         [_messagesTableView setAutosaveName:@"Messages2"]; 
    487         [_messagesTableView setAutosaveTableColumns:YES]; 
    488480        [_messagesTableView setAllowsUserCustomization:YES]; 
     481        [_messagesTableView setDefaultHighlightedTableColumnIdentifier:@"Time"]; 
     482        [_messagesTableView setDefaultSortOrder:WISortAscending]; 
    489483        [_conversationsOutlineView expandItem:[_titles objectAtIndex:0]]; 
    490484        [_conversationsOutlineView expandItem:[_titles objectAtIndex:1]]; 
     
    494488        [self _update]; 
    495489        [self _validate]; 
     490         
     491        [super windowDidLoad]; 
     492} 
     493 
     494 
     495 
     496- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     497        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesWindow"]]; 
     498        [_conversationsSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesConversationsSplitView"]]; 
     499        [_messagesSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesMessagesSplitView"]]; 
     500        [_messagesTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesMessagesTableView"]]; 
     501} 
     502 
     503 
     504 
     505- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     506        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCMessagesWindow"]; 
     507        [windowTemplate setObject:[_conversationsSplitView propertiesDictionary] forKey:@"WCMessagesConversationsSplitView"]; 
     508        [windowTemplate setObject:[_messagesSplitView propertiesDictionary] forKey:@"WCMessagesMessagesSplitView"]; 
     509        [windowTemplate setObject:[_messagesTableView propertiesDictionary] forKey:@"WCMessagesMessagesTableView"]; 
    496510} 
    497511 
  • WiredClient/trunk/WCNews.m

    r3732 r3974  
    160160 
    161161- (void)windowDidLoad { 
    162         [self setShouldCascadeWindows:NO]; 
    163         [self setWindowFrameAutosaveName:@"News"]; 
    164  
    165162        [_newsTextView setEditable:NO]; 
    166163         
    167164        [self _update]; 
    168165        [self _validate]; 
     166         
     167        [super windowDidLoad]; 
    169168} 
    170169 
     
    177176                [[self connection] postNotificationName:WCNewsDidReadPost object:[self connection]]; 
    178177        } 
     178} 
     179 
     180 
     181 
     182- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     183        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCNewsWindow"]]; 
     184} 
     185 
     186 
     187 
     188- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     189        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCNewsWindow"]; 
    179190} 
    180191 
  • WiredClient/trunk/WCPreferences.m

    r3959 r3974  
    7575        NSToolbarItem   *item; 
    7676 
    77         toolbar = [[NSToolbar alloc] initWithIdentifier:WCPreferencesToolbar]; 
    7877        _toolbarItems = [[NSMutableDictionary alloc] init]; 
    7978         
     
    142141        [_toolbarItems setObject:item forKey:[item itemIdentifier]]; 
    143142 
     143        toolbar = [[NSToolbar alloc] initWithIdentifier:WCPreferencesToolbar]; 
    144144        [toolbar setDelegate:self]; 
    145         [toolbar setVisible:YES]; 
    146145        [toolbar setAllowsUserCustomization:YES]; 
    147146        [toolbar setAutosavesConfiguration:NO]; 
    148         [toolbar setDisplayMode:NSToolbarDisplayModeDefault]; 
    149147 
    150148        return [toolbar autorelease]; 
  • WiredClient/trunk/WCPreview.m

    r3597 r3974  
    5353        self = [super initWithWindowNibName:@"Preview" connection:connection]; 
    5454 
     55        [self setReleasedWhenClosed:YES]; 
    5556        [self window]; 
    5657 
     
    400401 
    401402        [self _update]; 
    402 
    403  
    404  
    405  
    406 - (void)windowWillClose:(NSNotification *)notification { 
    407         if([[notification object] isVisible]) 
    408                 [self autorelease]; 
     403         
     404        [super windowDidLoad]; 
    409405} 
    410406 
  • WiredClient/trunk/WCPrivateChat.m

    r3570 r3974  
    4646                                                                        name:NSLS(@"Private Chat", @"Chat window title")]; 
    4747         
     48        [self setReleasedWhenClosed:YES]; 
     49         
    4850        _cid = cid; 
    4951        _user = [user retain]; 
     
    9698        [self setShouldCascadeWindows:YES]; 
    9799        [self setWindowFrameAutosaveName:@"Private Chat"]; 
     100 
    98101        [[self window] setTitle:[_connection name] withSubtitle:[self name]]; 
    99102 
    100103        [_userListTableView registerForDraggedTypes:[NSArray arrayWithObject:WCUserPboardType]]; 
    101104         
    102         [_chatSplitView setAutosaveName:@"Private Chat"]; 
    103         [_userListSplitView setAutosaveName:@"Private Chat User List"]; 
    104  
    105105        [super windowDidLoad]; 
    106106} 
     
    110110- (void)windowWillClose:(NSNotification *)notification { 
    111111        [_connection sendCommand:WCLeaveCommand withArgument:[NSSWF:@"%u", [self chatID]]]; 
    112  
    113         [self autorelease]; 
    114112} 
    115113 
  • WiredClient/trunk/WCPublicChat.m

    r3967 r3974  
    207207- (void)windowDidLoad { 
    208208        [[self window] setToolbar:[self _toolbar]]; 
    209         [self setShouldCascadeWindows:YES]; 
    210         [self setWindowFrameAutosaveName:@"Public Chat"]; 
    211  
    212         [_chatSplitView setAutosaveName:@"Public Chat"]; 
    213         [_userListSplitView setAutosaveName:@"Public Chat User List"]; 
    214209 
    215210        [super windowDidLoad]; 
     
    246241 
    247242- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    248         [[[self window] toolbar] setPropertiesFromDictionary:[windowTemplate objectForKey:@"Toolbar"]]; 
     243        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCChatWindow"]]; 
     244         
     245        [super windowTemplateShouldLoad:windowTemplate]; 
    249246} 
    250247 
     
    252249 
    253250- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
    254         [windowTemplate setObject:[[[self window] toolbar] propertiesDictionary] forKey:@"Toolbar"]; 
     251        [windowTemplate setObject:[[self window] propertiesDictionaryWithoutVisibility] forKey:@"WCChatWindow"]; 
     252         
     253        [super windowTemplateShouldSave:windowTemplate]; 
    255254} 
    256255 
     
    300299        WCError         *error; 
    301300         
    302         if([[self window] isVisible]) { 
    303                 [[self window] setTitle:[[self connection] name] withSubtitle:[NSSWF:@"%@ %C %@", 
    304                         NSLS(@"Chat", @"Chat window title"), 
    305                         0x2014, 
    306                         NSLS(@"Disconnected", "Chat window title")]]; 
     301        [[self window] setTitle:[[self connection] name] withSubtitle:[NSSWF:@"%@ %C %@", 
     302                NSLS(@"Chat", @"Chat window title"), 
     303                0x2014, 
     304                NSLS(@"Disconnected", "Chat window title")]]; 
     305         
     306        if(![[self connection] isReconnecting]) { 
     307                error = [[notification userInfo] objectForKey:WCErrorKey]; 
    307308                 
    308                 if(![[self connection] isReconnecting]) { 
    309                         error = [[notification userInfo] objectForKey:WCErrorKey]; 
    310                          
    311                         if(!error) 
    312                                 error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientServerDisconnected]; 
    313                          
     309                if(!error) 
     310                        error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientServerDisconnected]; 
     311                 
     312                if([[self window] isMiniaturized]) 
     313                        [self showWindow:self]; 
     314                 
     315                if([[self window] isVisible]) 
    314316                        [[error alert] beginSheetModalForWindow:[self window]]; 
    315                 } 
    316317        } 
    317318         
  • WiredClient/trunk/WCSearch.m

    r3621 r3974  
    253253        [iconCell release]; 
    254254 
    255         [self setShouldCascadeWindows:NO]; 
    256         [self setWindowFrameAutosaveName:@"Search"]; 
    257  
    258255        [_searchTableView setDoubleAction:@selector(open:)]; 
    259256        [_searchTableView setAllowsUserCustomization:YES]; 
     
    261258        [_searchTableView setDefaultTableColumnIdentifiers: 
    262259                [NSArray arrayWithObjects:@"Name", @"Size", NULL]]; 
    263         [_searchTableView setAutosaveName:@"Search"]; 
    264         [_searchTableView setAutosaveTableColumns:YES]; 
    265260         
    266261        [self _update]; 
     262         
     263        [super windowDidLoad]; 
     264} 
     265 
     266 
     267 
     268- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     269        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCSearchWindow"]]; 
     270        [_searchTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCSearchTableView"]]; 
     271} 
     272 
     273 
     274 
     275- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     276        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCSearchWindow"]; 
     277        [windowTemplate setObject:[_searchTableView propertiesDictionary] forKey:@"WCSearchTableView"]; 
    267278} 
    268279 
  • WiredClient/trunk/WCServerConnection.h

    r3963 r3974  
    5959        BOOL                                                                                    _sentLogin; 
    6060        BOOL                                                                                    _loginFailed; 
     61        BOOL                                                                                    _dismissingWindow; 
    6162        BOOL                                                                                    _closingWindow; 
    6263        BOOL                                                                                    _reconnecting; 
  • WiredClient/trunk/WCServerConnection.m

    r3963 r3974  
    157157                _cache                  = [[WCCache alloc] initWithCapacity:100]; 
    158158 
     159                _chat                   = [[WCPublicChat publicChatWithConnection:self] retain]; 
     160 
    159161#if defined(DEBUG) || defined(TEST) 
    160162                _console                = [[WCConsole consoleWithConnection:self] retain]; 
     
    167169                _serverInfo             = [[WCServerInfo serverInfoWithConnection:self] retain]; 
    168170                _transfers              = [[WCTransfers transfersWithConnection:self] retain]; 
    169                 _chat                   = [[WCPublicChat publicChatWithConnection:self] retain]; 
    170171        } 
    171172 
     
    276277 
    277278- (void)windowWillClose:(NSNotification *)notification { 
    278         if(!_reconnecting && [[notification object] isVisible]) { 
     279        if(!_dismissingWindow && !_reconnecting && [[notification object] isOnScreen]) { 
    279280                _closingWindow = YES; 
    280281                 
     
    392393                error = [[notification userInfo] objectForKey:WCErrorKey]; 
    393394                 
    394                 if(error && [[self window] isVisible]) 
    395                         [[error alert] beginSheetModalForWindow:[self window]]; 
     395                if(error) { 
     396                        if([[self window] isMiniaturized]) 
     397                                [self showWindow:self]; 
     398                         
     399                        if([[self window] isVisible]) 
     400                                [[error alert] beginSheetModalForWindow:[self window]]; 
     401                } 
    396402                 
    397403                if(![[self window] isVisible]) 
     
    406412         
    407413        error = [[notification userInfo] objectForKey:WCErrorKey]; 
     414         
     415        if([[self window] isMiniaturized]) 
     416                [self showWindow:self]; 
    408417         
    409418        if([[self window] isVisible]) 
     
    471480                [_link sendCommand:WCBannerCommand]; 
    472481 
    473         [[self window] orderOut:self]; 
     482        _dismissingWindow = YES; 
     483        [[self window] close]; 
     484        _dismissingWindow = NO; 
    474485         
    475486        _reconnecting = NO; 
  • WiredClient/trunk/WCServerInfo.m

    r3910 r3974  
    170170#pragma mark - 
    171171 
    172 - (void)windowDidLoad { 
    173         NSSize          size; 
    174         NSRect          rect; 
    175          
    176         size = [[self window] frame].size; 
    177          
    178         [self setShouldCascadeWindows:NO]; 
    179         [self setWindowFrameAutosaveName:@"ServerInfo"]; 
    180          
    181         rect = [[self window] frame]; 
    182         rect.size = size; 
    183         [[self window] setFrame:rect display:NO]; 
    184 } 
    185  
    186  
    187  
    188172- (void)windowDidBecomeKey:(NSNotification *)notification { 
    189173        WCServer        *server; 
     
    200184 
    201185 
     186- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     187        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCServerInfoWindow"]]; 
     188} 
     189 
     190 
     191 
     192- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     193        [windowTemplate setObject:[[self window] propertiesDictionaryWithoutFrameSize] forKey:@"WCServerInfoWindow"]; 
     194} 
     195 
     196 
     197 
    202198- (void)connectionWillTerminate:(NSNotification *)notification { 
    203199        [self close]; 
  • WiredClient/trunk/WCTransfers.m

    r3867 r3974  
    10511051                [NSArray arrayWithObjects:NSStringPboardType, WCTransferPboardType, NULL]]; 
    10521052 
    1053         [self setShouldCascadeWindows:NO]; 
    1054         [self setWindowFrameAutosaveName:@"Transfers"]; 
    1055  
    10561053        [self _update]; 
    10571054        [self _validate]; 
     1055         
     1056        [super windowDidLoad]; 
     1057} 
     1058 
     1059 
     1060 
     1061- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
     1062        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCTransfersWindow"]]; 
     1063} 
     1064 
     1065 
     1066 
     1067- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     1068        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCTransfersWindow"]; 
    10581069} 
    10591070 
  • WiredClient/trunk/WCUserInfo.m

    r3570 r3974  
    5555        _user = [user retain]; 
    5656 
     57        [self setReleasedWhenClosed:YES]; 
    5758        [self window]; 
    5859 
     
    217218        [[self window] setTitle:[NSSWF: 
    218219                NSLS(@"%@ Info", @"User info window title (nick)"), [_user nick]]]; 
     220         
    219221        [self setShouldCascadeWindows:YES]; 
     222        [self setShouldSaveWindowFrameOriginOnly:YES]; 
    220223        [self setWindowFrameAutosaveName:@"UserInfo"]; 
     224         
     225        [super windowDidLoad]; 
    221226} 
    222227 
     
    225230- (void)windowWillClose:(NSNotification *)notification { 
    226231        [NSObject cancelPreviousPerformRequestsWithTarget:self]; 
    227  
    228         [self autorelease]; 
    229232} 
    230233 
     
    326329        [[self window] setFrame:rect display:YES animate:YES]; 
    327330 
    328         if(![[self window] isVisible]) 
     331        if(![[self window] isOnScreen]) 
    329332                [self showWindow:self]; 
    330333