From: Andrew M. <fit...@us...> - 2007-12-06 21:43:23
|
Update of /cvsroot/radmind/radmind-assistant/rsm In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5732 Modified Files: RAServerController.h RAServerController.m Log Message: Use current API to remove selected lines from an array. Got rid of _validClients and related accessors. Index: RAServerController.h =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rsm/RAServerController.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RAServerController.h 5 Apr 2005 19:55:16 -0000 1.5 --- RAServerController.h 6 Dec 2007 21:43:18 -0000 1.6 *************** *** 32,42 **** IBOutlet RSMLoadsetManager *loadsetManager; @private RAServerAuth *sa; RSMPreferences *prefs; - NSMutableArray *serverConfig; NSArray *_allCommandFiles; BOOL _isConfigFileEdited; - NSMutableArray *_validClients; int dragOriginRow; int _rsmThreadID; --- 32,42 ---- IBOutlet RSMLoadsetManager *loadsetManager; + NSMutableArray *serverConfig; + @private RAServerAuth *sa; RSMPreferences *prefs; NSArray *_allCommandFiles; BOOL _isConfigFileEdited; int dragOriginRow; int _rsmThreadID; *************** *** 67,74 **** - ( NSArray * )availableCommandFiles; - - ( NSArray * )validClients; - - ( void )addToValidClients: ( NSString * )client; - - ( void )removeFromValidClients: ( NSString * )client; - - ( void )setSessionTmpDirectory: ( NSString * )tmpdir; - ( NSString * )sessionTmpDirectory; --- 67,70 ---- Index: RAServerController.m =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rsm/RAServerController.m,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RAServerController.m 3 Jun 2007 03:20:47 -0000 1.20 --- RAServerController.m 6 Dec 2007 21:43:18 -0000 1.21 *************** *** 55,59 **** serverConfig = nil; _allCommandFiles = nil; - _validClients = nil; _rsmTmpDirectory = nil; prefs = nil; --- 55,58 ---- *************** *** 117,143 **** } - - ( NSArray * )validClients - { - return( _validClients ); - } - - - ( void )addToValidClients: ( NSString * )client - { - if ( _validClients == nil ) { - _validClients = [[ NSMutableArray alloc ] init ]; - } - - if ( ! [ _validClients containsObject: client ] ) { - [ _validClients addObject: client ]; - } - } - - - ( void )removeFromValidClients: ( NSString * )client - { - if ( [ _validClients containsObject: client ] ) { - [ _validClients removeObject: client ]; - } - } - - ( void )setSessionTmpDirectory: ( NSString * )tmpdir { --- 116,119 ---- *************** *** 397,427 **** - ( IBAction )deleteClientFromConfigFile: ( id )sender { ! NSEnumerator *lineEnumerator = nil; ! NSNumber *lineNumber = nil; ! int count = [ hostsTable numberOfSelectedRows ]; ! unsigned int *lines = NULL, i = 0; ! ! if ( count == 0 ) { ! NSBeep(); ! return; ! } ! ! if (( lines = calloc( count, sizeof( int ))) == NULL ) { ! NSLog( @"malloc: %s", strerror( errno )); ! exit( 2 ); ! } ! ! lineEnumerator = [ hostsTable selectedRowEnumerator ]; ! while (( lineNumber = [ lineEnumerator nextObject ] ) != nil ) { ! lines[ i ] = [ lineNumber intValue ]; ! [ self removeFromValidClients: ! [[ serverConfig objectAtIndex: i ] objectForKey: @"host" ]]; ! i++; } ! [ hostsTable selectRow: *lines byExtendingSelection: NO ]; ! [ serverConfig removeObjectsFromIndices: lines numIndices: count ]; ! free( lines ); [ hostsTable reloadData ]; --- 373,389 ---- - ( IBAction )deleteClientFromConfigFile: ( id )sender { ! NSIndexSet *indexes; ! indexes = [ hostsTable selectedRowIndexes ]; ! if ( [ indexes count ] <= 0 ) { ! NSBeep(); ! return; } ! /* leave the topmost line selected, if possible */ ! [ hostsTable selectRowIndexes: ! [ NSIndexSet indexSetWithIndex: [ indexes firstIndex ]] ! byExtendingSelection: NO ]; ! [ serverConfig removeObjectsAtIndexes: indexes ]; [ hostsTable reloadData ]; *************** *** 657,661 **** [ NSString stringWithUTF8String: targv[ 0 ]], @"host", [ NSString stringWithUTF8String: targv[ 1 ]], @"kfile", nil ]]; - [ self addToValidClients: [ NSString stringWithUTF8String: targv[ 0 ]]]; } else if ( *line == '#' ) { /* display comments */ --- 619,622 ---- *************** *** 847,851 **** [ dict setObject: newstring forKey: @"host" ]; [ serverConfig replaceObjectAtIndex: row withObject: dict ]; - [ self addToValidClients: newstring ]; [ self setConfigFileEdited: YES ]; } --- 808,811 ---- *************** *** 928,933 **** } - [ self removeFromValidClients: old ]; - [ self addToValidClients: theObject ]; [[ serverConfig objectAtIndex: rowIndex ] setObject: theObject forKey: @"host" ]; --- 888,891 ---- |