Changeset 938
- Timestamp:
- 01/14/05 17:09:23 (4 years ago)
- Files:
-
- WiredServer/trunk/Panel/English.lproj/Wired.nib/classes.nib (modified) (8 diffs)
- WiredServer/trunk/Panel/English.lproj/Wired.nib/info.nib (modified) (1 diff)
- WiredServer/trunk/Panel/English.lproj/Wired.nib/keyedobjects.nib (modified) (previous)
- WiredServer/trunk/Panel/WPWired.h (modified) (2 diffs)
- WiredServer/trunk/Panel/WPWired.m (modified) (7 diffs)
- WiredServer/trunk/WCAccountsController.h (modified) (3 diffs)
- WiredServer/trunk/WCAccountsController.m (modified) (8 diffs)
- WiredServer/trunk/WCAuthorization.m (modified) (4 diffs)
- WiredServer/trunk/WCConfigController.h (modified) (6 diffs)
- WiredServer/trunk/WCConfigController.m (modified) (15 diffs)
- WiredServer/trunk/WCSettings.h (modified) (2 diffs)
- WiredServer/trunk/WCSettings.m (modified) (7 diffs)
- WiredServer/trunk/WiredCommon.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredServer/trunk/Panel/English.lproj/Wired.nib/classes.nib
r923 r938 23 23 "_cannotBeKickedButton" = NSButton; 24 24 "_clearNewsButton" = NSButton; 25 "_configController" = WCConfigController; 25 26 "_createAccountsButton" = NSButton; 26 27 "_createFoldersButton" = NSButton; … … 62 63 selectLogFile = id; 63 64 setBanner = id; 65 showStatusInMenuBar = id; 64 66 touch = id; 65 67 }; … … 81 83 "_controlPortTextField" = NSTextField; 82 84 "_createCertificateButton" = NSButton; 85 "_dashboardController" = WCDashboardController; 83 86 "_deleteTrackerButton" = NSButton; 84 87 "_descriptionTextField" = NSTextField; … … 102 105 "_showDotFilesButton" = NSButton; 103 106 "_showInvisibleButton" = NSButton; 107 "_showStatusInMenuBar" = NSButton; 104 108 "_syslogPopUpButton" = NSPopUpButton; 105 109 "_terminateServerOnQuitButton" = NSButton; … … 117 121 }, 118 122 { 123 ACTIONS = { 124 indexFiles = id; 125 registerWithTracker = id; 126 reload = id; 127 restart = id; 128 start = id; 129 }; 130 CLASS = WCDashboardController; 131 LANGUAGE = ObjC; 132 OUTLETS = { 133 "_indexButton" = NSButton; 134 "_registerButton" = NSButton; 135 "_reloadButton" = NSButton; 136 "_restartButton" = NSButton; 137 "_startButton" = NSButton; 138 "_statusController" = WCStatusController; 139 }; 140 SUPERCLASS = NSObject; 141 }, 142 { 119 143 ACTIONS = {filter = id; mark = id; reload = id; }; 120 144 CLASS = WCLogController; … … 124 148 }, 125 149 { 126 ACTIONS = {127 indexFiles = id;128 registerWithTracker = id;129 reload = id;130 restart = id;131 start = id;132 };133 150 CLASS = WCStatusController; 134 151 LANGUAGE = ObjC; 135 152 OUTLETS = { 136 "_bandwidthGraphView" = WCGraphView;153 "_bandwidthGraphView" = ZAGraphView; 137 154 "_currentDownloadsTextField" = NSTextField; 138 155 "_currentUploadsTextField" = NSTextField; … … 142 159 "_dataOutPerSecTextField" = NSTextField; 143 160 "_dataOutTextField" = NSTextField; 144 "_indexButton" = NSButton;145 "_registerButton" = NSButton;146 "_reloadButton" = NSButton;147 "_restartButton" = NSButton;148 "_startButton" = NSButton;149 161 "_statusTextField" = NSTextField; 150 162 "_totalDownloadsTextField" = NSTextField; 151 163 "_totalUploadsTextField" = NSTextField; 152 164 "_totalUsersTextField" = NSTextField; 153 "_transfersGraphView" = WCGraphView;154 "_usersGraphView" = WCGraphView;165 "_transfersGraphView" = ZAGraphView; 166 "_usersGraphView" = ZAGraphView; 155 167 "_versionTextField" = NSTextField; 156 168 }; … … 162 174 LANGUAGE = ObjC; 163 175 OUTLETS = { 176 "_accountsController" = WCAccountsController; 164 177 "_authorizationStatusButton" = NSButton; 165 178 "_authorizationStatusTextField" = NSTextField; 179 "_configController" = WCConfigController; 180 "_dashboardController" = WCDashboardController; 181 "_logController" = WCLogController; 182 "_statusController" = WCStatusController; 166 183 }; 167 184 SUPERCLASS = NSPreferencePane; WiredServer/trunk/Panel/English.lproj/Wired.nib/info.nib
r923 r938 22 22 </array> 23 23 <key>IBSystem Version</key> 24 <string>7 S215</string>24 <string>7R28</string> 25 25 </dict> 26 26 </plist> WiredServer/trunk/Panel/WPWired.h
r923 r938 1 /* $Id: WPWired.h,v 1. 1 2005/01/07 23:14:20morris Exp $ */1 /* $Id: WPWired.h,v 1.2 2005/01/14 16:09:23 morris Exp $ */ 2 2 3 3 /* … … 28 28 29 29 @interface WPWired : NSPreferencePane { 30 IBOutlet WCAccountsController *_accountsController; 31 IBOutlet WCConfigController *_configController; 32 IBOutlet WCDashboardController *_dashboardController; 33 IBOutlet WCLogController *_logController; 34 IBOutlet WCStatusController *_statusController; 35 30 36 IBOutlet NSButton *_authorizationStatusButton; 31 37 IBOutlet NSTextField *_authorizationStatusTextField; WiredServer/trunk/Panel/WPWired.m
r923 r938 1 /* $Id: WPWired.m,v 1. 1 2005/01/07 23:14:20morris Exp $ */1 /* $Id: WPWired.m,v 1.2 2005/01/14 16:09:23 morris Exp $ */ 2 2 3 3 /* … … 27 27 */ 28 28 29 #import "WPSettings.h"30 29 #import "WPWired.h" 31 30 … … 36 35 37 36 - (void) update; 37 - (void) save; 38 38 39 39 @end … … 60 60 [[self bundle] pathForResource:@"Unlocked" ofType:@"tiff"]]; 61 61 62 [ [WCAccountsController accountsController]setRequiresAuthorization:YES];63 [ [WCConfigController configController]setRequiresAuthorization:YES];64 [ [WCStatusController statusController]setRequiresAuthorization:YES];62 [_accountsController setRequiresAuthorization:YES]; 63 [_configController setRequiresAuthorization:YES]; 64 [_dashboardController setRequiresAuthorization:YES]; 65 65 66 [[WCAccountsController accountsController] awakeFromController]; 67 [[WCConfigController configController] awakeFromController]; 68 [[WCLogController logController] awakeFromController]; 69 [[WCStatusController statusController] awakeFromController]; 66 [_statusController awakeFromController]; 67 [_logController awakeFromController]; 68 [_dashboardController awakeFromController]; 69 [_configController awakeFromController]; 70 [_accountsController awakeFromController]; 70 71 71 72 [self update]; … … 80 81 81 82 - (void)didUnselect { 82 BOOL status = YES; 83 84 if(status) 85 status = [[WCConfigController configController] saveFromController]; 86 87 if(status) 88 status = [[WCAccountsController accountsController] saveFromController]; 83 [self save]; 89 84 } 90 85 … … 94 89 95 90 - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { 96 BOOL status = YES; 97 98 if(status) 99 status = [[WCConfigController configController] saveFromController]; 100 101 if(status) 102 status = [[WCAccountsController accountsController] saveFromController]; 91 [self save]; 103 92 } 104 93 … … 117 106 NSLS(@"Click the lock to make changes.", @"Authorization status")]; 118 107 } 108 } 109 110 111 112 - (void)save { 113 BOOL status = YES; 114 115 if(status) 116 status = [_configController saveFromController]; 117 118 if(status) 119 status = [_accountsController saveFromController]; 119 120 } 120 121 WiredServer/trunk/WCAccountsController.h
r923 r938 1 /* $Id: WCAccountsController.h,v 1. 1 2005/01/07 23:14:19morris Exp $ */1 /* $Id: WCAccountsController.h,v 1.2 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 30 30 31 31 @interface WCAccountsController : NSObject { 32 IBOutlet WCConfigController *_configController; 33 32 34 IBOutlet NSTableView *_tableView; 33 35 IBOutlet NSButton *_addButton; … … 71 73 72 74 BOOL _requiresAuthorization; 75 BOOL _authorized; 73 76 BOOL _touched; 74 77 } WiredServer/trunk/WCAccountsController.m
r931 r938 1 /* $Id: WCAccountsController.m,v 1. 2 2005/01/09 18:40:04morris Exp $ */1 /* $Id: WCAccountsController.m,v 1.3 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 90 90 [self readUsersFromFile:WCExpandWiredPath(@"users")]; 91 91 [self readGroupsFromFile:WCExpandWiredPath(@"groups")]; 92 93 [self selectAccount:[self selectedAccount]]; 92 94 } 93 95 … … 128 130 129 131 - (void)authorizationStatusDidChange:(NSNotification *)notification { 132 _authorized = [[notification object] boolValue]; 133 130 134 [self validateAccount:[self selectedAccount]]; 131 135 } … … 166 170 WCAccount *group; 167 171 168 if(!account)169 return;170 171 172 // --- populate menu 172 173 [_groupPopUpButton removeAllItems]; … … 181 182 182 183 // --- update interface from account 183 [_typePopUpButton selectItemAtIndex: 184 [_typePopUpButton indexOfItemWithTag:[account type]]]; 185 [_nameTextField setStringValue:[account name]]; 186 [_passwordTextField setStringValue:[account password]]; 187 188 if([[account group] length] == 0) { 189 [_groupPopUpButton selectItemAtIndex:0]; 190 } else { 191 [_groupPopUpButton selectItemWithTitle:[account group]]; 192 account = [_groups accountWithName:[account group]]; 193 } 194 195 [_getUserInfoButton setState:[account getUserInfo]]; 196 [_broadcastButton setState:[account broadcast]]; 197 [_postNewsButton setState:[account postNews]]; 198 [_clearNewsButton setState:[account clearNews]]; 199 [_downloadButton setState:[account download]]; 200 [_uploadButton setState:[account upload]]; 201 [_uploadAnywhereButton setState:[account uploadAnywhere]]; 202 [_createFoldersButton setState:[account createFolders]]; 203 [_moveFilesButton setState:[account moveFiles]]; 204 [_deleteFilesButton setState:[account deleteFiles]]; 205 [_viewDropBoxesButton setState:[account viewDropBoxes]]; 206 [_createAccountsButton setState:[account createAccounts]]; 207 [_editAccountsButton setState:[account editAccounts]]; 208 [_deleteAccountsButton setState:[account deleteAccounts]]; 209 [_elevatePrivilegesButton setState:[account elevatePrivileges]]; 210 [_kickUsersButton setState:[account kickUsers]]; 211 [_banUsersButton setState:[account banUsers]]; 212 [_cannotBeKickedButton setState:[account cannotBeKicked]]; 213 [_setTopicButton setState:[account setTopic]]; 214 215 if([account downloads] > 0) 216 [_downloadsTextField setIntValue:[account downloads]]; 217 else 218 [_downloadsTextField setStringValue:@""]; 219 220 if([account downloadSpeed] > 0) 221 [_downloadSpeedTextField setIntValue:[account downloadSpeed] / (double) 1024.0]; 222 else 223 [_downloadSpeedTextField setStringValue:@""]; 224 225 if([account uploads] > 0) 226 [_uploadsTextField setIntValue:[account uploads]]; 227 else 228 [_uploadsTextField setStringValue:@""]; 229 230 if([account uploadSpeed] > 0) 231 [_uploadSpeedTextField setIntValue:[account uploadSpeed] / (double) 1024.0]; 232 else 233 [_uploadSpeedTextField setStringValue:@""]; 184 if(account) { 185 [_typePopUpButton selectItemAtIndex: 186 [_typePopUpButton indexOfItemWithTag:[account type]]]; 187 [_nameTextField setStringValue:[account name]]; 188 [_passwordTextField setStringValue:[account password]]; 189 190 if([[account group] length] == 0) { 191 [_groupPopUpButton selectItemAtIndex:0]; 192 } else { 193 [_groupPopUpButton selectItemWithTitle:[account group]]; 194 account = [_groups accountWithName:[account group]]; 195 } 196 197 [_getUserInfoButton setState:[account getUserInfo]]; 198 [_broadcastButton setState:[account broadcast]]; 199 [_postNewsButton setState:[account postNews]]; 200 [_clearNewsButton setState:[account clearNews]]; 201 [_downloadButton setState:[account download]]; 202 [_uploadButton setState:[account upload]]; 203 [_uploadAnywhereButton setState:[account uploadAnywhere]]; 204 [_createFoldersButton setState:[account createFolders]]; 205 [_moveFilesButton setState:[account moveFiles]]; 206 [_deleteFilesButton setState:[account deleteFiles]]; 207 [_viewDropBoxesButton setState:[account viewDropBoxes]]; 208 [_createAccountsButton setState:[account createAccounts]]; 209 [_editAccountsButton setState:[account editAccounts]]; 210 [_deleteAccountsButton setState:[account deleteAccounts]]; 211 [_elevatePrivilegesButton setState:[account elevatePrivileges]]; 212 [_kickUsersButton setState:[account kickUsers]]; 213 [_banUsersButton setState:[account banUsers]]; 214 [_cannotBeKickedButton setState:[account cannotBeKicked]]; 215 [_setTopicButton setState:[account setTopic]]; 216 217 if([account downloads] > 0) 218 [_downloadsTextField setIntValue:[account downloads]]; 219 else 220 [_downloadsTextField setStringValue:@""]; 221 222 if([account downloadSpeed] > 0) 223 [_downloadSpeedTextField setIntValue:[account downloadSpeed] / (double) 1024.0]; 224 else 225 [_downloadSpeedTextField setStringValue:@""]; 226 227 if([account uploads] > 0) 228 [_uploadsTextField setIntValue:[account uploads]]; 229 else 230 [_uploadsTextField setStringValue:@""]; 231 232 if([account uploadSpeed] > 0) 233 [_uploadSpeedTextField setIntValue:[account uploadSpeed] / (double) 1024.0]; 234 else 235 [_uploadSpeedTextField setStringValue:@""]; 236 } 234 237 } 235 238 … … 278 281 BOOL authorized; 279 282 280 authorized = [self requiresAuthorization]281 ? [[WCStatusController statusController] isAuthorized]282 : YES;283 284 283 // --- enable/disable basics 285 enabled = authorized; 284 authorized = [self requiresAuthorization] ? _authorized : YES; 285 enabled = authorized && (account != NULL); 286 286 [_addButton setEnabled:enabled]; 287 287 [_deleteButton setEnabled:enabled]; … … 377 377 378 378 if(status) { 379 config = [ [WCConfigController configController]config];379 config = [_configController config]; 380 380 status = [authorization changeOwnerOfPath:path 381 381 toOwner:[config stringForKey:@"user"] … … 416 416 417 417 if(status) { 418 config = [ [WCConfigController configController]config];418 config = [_configController config]; 419 419 status = [authorization changeOwnerOfPath:path 420 420 toOwner:[config stringForKey:@"user"] WiredServer/trunk/WCAuthorization.m
r923 r938 1 /* $Id: WCAuthorization.m,v 1. 1 2005/01/07 23:14:19morris Exp $ */1 /* $Id: WCAuthorization.m,v 1.2 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 113 113 [[NSNotificationCenter defaultCenter] 114 114 postNotificationName:WCAuthorizationStatusDidChange 115 object:self];115 object:[NSNumber numberWithBool:_authorized]]; 116 116 117 117 return YES; … … 140 140 [[NSNotificationCenter defaultCenter] 141 141 postNotificationName:WCAuthorizationStatusDidChange 142 object: self];142 object:[NSNumber numberWithBool:_authorized]]; 143 143 } 144 144 … … 188 188 [[NSNotificationCenter defaultCenter] 189 189 postNotificationName:WCAuthorizationStatusDidChange 190 object: self];190 object:[NSNumber numberWithBool:_authorized]]; 191 191 } 192 192 WiredServer/trunk/WCConfigController.h
r923 r938 1 /* $Id: WCConfigController.h,v 1. 1 2005/01/07 23:14:19morris Exp $ */1 /* $Id: WCConfigController.h,v 1.2 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 27 27 */ 28 28 29 @class WC LogController;29 @class WCDashboardController; 30 30 31 31 @interface WCConfigController : NSObject { 32 IBOutlet WCDashboardController *_dashboardController; 33 32 34 IBOutlet NSPanel *_certificatePanel; 33 35 IBOutlet NSProgressIndicator *_certificateProgressIndicator; … … 42 44 IBOutlet NSButton *_terminateServerOnQuitButton; 43 45 IBOutlet NSButton *_useRendezvousButton; 44 IBOutlet NSButton *_launchAtBootButton;45 46 46 47 IBOutlet NSTextField *_totalDownloadsTextField; … … 78 79 IBOutlet NSPopUpButton *_groupPopUpButton; 79 80 81 IBOutlet NSButton *_launchAtBootButton; 82 IBOutlet NSButton *_showStatusInMenuBar; 83 80 84 IBOutlet NSMatrix *_logMethodMatrix; 81 85 IBOutlet NSPopUpButton *_syslogPopUpButton; … … 89 93 NSImage *_okImage, *_errorImage; 90 94 95 BOOL _requiresAuthorization; 96 BOOL _authorized; 91 97 BOOL _touched; 92 98 BOOL _logTouched; 93 BOOL _requiresAuthorization;94 99 } 95 100 … … 109 114 - (BOOL) requiresAuthorization; 110 115 116 - (IBAction) showStatusInMenuBar:(id)sender; 111 117 - (IBAction) touch:(id)sender; 112 118 - (IBAction) setBanner:(id)sender; WiredServer/trunk/WCConfigController.m
r929 r938 1 /* $Id: WCConfigController.m,v 1. 3 2005/01/08 19:30:21morris Exp $ */1 /* $Id: WCConfigController.m,v 1.4 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 40 40 - (void) readFromFile:(NSString *)path; 41 41 - (BOOL) writeToFile:(NSString *)path; 42 - (void) setLaunchesAtBoot:(BOOL)value; 42 43 43 44 @end … … 63 64 64 65 - (void)awakeFromNib { 66 NSNumber *pid; 65 67 NSComboBoxCell *comboCell; 66 68 NSMutableArray *array; … … 75 77 [[self bundle] pathForResource:@"Error" ofType:@"tiff"]]; 76 78 79 // --- check if status item is running 80 pid = [[NSWorkspace sharedWorkspace] processIdentifierOfCommand:@"Wired Status"]; 81 [_showStatusInMenuBar setState:(pid != NULL)]; 82 77 83 // --- load users 78 84 array = [NSMutableArray array]; … … 159 165 160 166 if(status) { 161 // --- note config changed162 167 [[NSNotificationCenter defaultCenter] 163 168 postNotificationName:WCConfigDidChange 164 169 object:NULL]; 165 170 166 // --- note log changed167 171 if(_logTouched) { 168 172 [[NSNotificationCenter defaultCenter] … … 174 178 } 175 179 176 [ [WCStatusController statusController]setLaunchesAtBoot:[_launchAtBootButton state]];180 [self setLaunchesAtBoot:[_launchAtBootButton state]]; 177 181 } 178 182 … … 196 200 197 201 - (void)authorizationStatusDidChange:(NSNotification *)notification { 202 _authorized = [[notification object] boolValue]; 203 198 204 [self update]; 199 [_trackersTableView setNeedsDisplay:YES];200 205 } 201 206 … … 265 270 BOOL enabled; 266 271 267 enabled = [self requiresAuthorization] 268 ? [[WCStatusController statusController] isAuthorized] 269 : YES; 272 enabled = [self requiresAuthorization] ? _authorized : YES; 270 273 method = [[_logMethodMatrix selectedCell] tag]; 271 274 … … 280 283 [_clearBannerButton setEnabled:enabled]; 281 284 [_useRendezvousButton setEnabled:enabled]; 282 [_launchAtBootButton setEnabled:enabled];283 285 [_totalDownloadsTextField setEnabled:enabled]; 284 286 [_clientDownloadsTextField setEnabled:enabled]; … … 303 305 [_limitNewsButton setEnabled:enabled]; 304 306 [_limitNewsTextField setEnabled:(enabled && [_limitNewsButton state] == NSOnState)]; 305 307 [_trackersTableView setNeedsDisplay:YES]; 306 308 [_addTrackerButton setEnabled:enabled]; 307 309 [_deleteTrackerButton setEnabled:(enabled && [_trackersTableView selectedRow] >= 0)]; … … 310 312 [_userPopUpButton setEnabled:enabled]; 311 313 [_groupPopUpButton setEnabled:enabled]; 314 [_showStatusInMenuBar setEnabled:enabled]; 315 [_launchAtBootButton setEnabled:enabled]; 312 316 [_logMethodMatrix setEnabled:enabled]; 313 317 [_syslogPopUpButton setEnabled:(enabled && method == WCLogMethodSyslog)]; … … 386 390 _config = [[WCConfig alloc] initWithContentsOfFile:path]; 387 391 388 389 392 // --- config 390 393 if(_terminateServerOnQuitButton) … … 640 643 641 644 645 - (void)setLaunchesAtBoot:(BOOL)value { 646 NSFileManager *fileManager; 647 NSString *path, *owner, *temp, *string; 648 WCAuthorization *authorization; 649 WCConfig *config; 650 BOOL status; 651 652 authorization = [WCAuthorization authorization]; 653 fileManager = [NSFileManager defaultManager]; 654 path = WCExpandWiredPath(@"etc/wired.startup"); 655 656 if(value) { 657 string = [[_dashboardController launchArguments] componentsJoinedByString:@" "]; 658 owner = [fileManager ownerAtPath:path]; 659 660 if(!owner) 661 owner = [fileManager ownerAtPath:[path stringByDeletingLastPathComponent]]; 662 663 if([owner isEqualToString:NSUserName()]) { 664 [string writeToFile:path atomically:YES]; 665 } 666 else if([authorization isAuthorized]) { 667 temp = [NSFileManager temporaryPathWithPrefix:@"wired" suffix:@"startup"]; 668 status = [string writeToFile:temp atomically:YES]; 669 670 if(status) 671 status = [authorization movePath:temp toPath:path]; 672 673 if(status) { 674 config = [self config]; 675 status = [authorization changeOwnerOfPath:path 676 toOwner:[config stringForKey:@"user"] 677 group:[config stringForKey:@"group"]]; 678 } 679 } 680 } else { 681 if([[fileManager ownerAtPath:path] isEqualToString:NSUserName()]) 682 [fileManager removeFileAtPath:path]; 683 else if([authorization isAuthorized]) 684 [authorization removeFileAtPath:path]; 685 } 686 } 687 688 689 642 690 #pragma mark - 643 691 … … 933 981 934 982 983 - (IBAction)showStatusInMenuBar:(id)sender { 984 NSString *path; 985 NSNumber *pid; 986 987 path = [[self bundle] pathForResource:@"Wired Status" ofType:@"app"]; 988 pid = [[NSWorkspace sharedWorkspace] processIdentifierOfCommand:@"Wired Status"]; 989 990 if([sender state] == NSOnState && !pid) { 991 [[NSWorkspace sharedWorkspace] launchApplication:path]; 992 [[NSWorkspace sharedWorkspace] addAutoLaunchedApplication:path hide:NO]; 993 } 994 else if(pid && [pid intValue] > 0) { 995 kill([pid intValue], SIGTERM); 996 [[NSWorkspace sharedWorkspace] removeAutoLaunchedApplication:path]; 997 } 998 } 999 1000 1001 935 1002 - (IBAction)selectLogFile:(id)sender { 936 1003 NSOpenPanel *openPanel; … … 1016 1083 BOOL enabled; 1017 1084 1018 enabled = [self requiresAuthorization] ? [[WCStatusController statusController] isAuthorized]: YES;1085 enabled = [self requiresAuthorization] ? _authorized : YES; 1019 1086 [cell setEnabled:enabled]; 1020 1087 [cell setEditable:enabled]; WiredServer/trunk/WCSettings.h
r923 r938 1 /* $Id: WCSettings.h,v 1. 1 2005/01/07 23:14:20morris Exp $ */1 /* $Id: WCSettings.h,v 1.2 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 68 68 + (void) setBool:(BOOL)value forKey:(id)key; 69 69 + (void) setInt:(int)value forKey:(id)key; 70 + (void) setDouble:(double)value forKey:(id)key; 70 71 71 72 @end WiredServer/trunk/WCSettings.m
r928 r938 1 /* $Id: WCSettings.m,v 1. 2 2005/01/07 23:18:47morris Exp $ */1 /* $Id: WCSettings.m,v 1.3 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 46 46 47 47 48 #pragma mark -49 50 51 48 + (WCSettings *)settings { 52 49 static id sharedSettings; … … 111 108 112 109 while((key = [enumerator nextObject])) { 113 // --- does object exist in user defaults?114 110 object = [defaults objectForKey:key]; 115 111 116 112 if(!object) { 117 // --- set default value in defaults118 113 object = [defaultValues objectForKey:key]; 119 114 … … 125 120 126 121 if([object isKindOfClass:[NSData class]]) { 127 // --- set unarchived value in settings cache128 122 object = [NSUnarchiver unarchiveObjectWithData:object]; 129 123 … … 132 126 } 133 127 else { 134 // --- set simple value in settings cache135 128 [_settings setObject:object forKey:key]; 136 129 } … … 170 163 [_lock unlock]; 171 164 172 [NSObject cancelPreviousPerformRequestsWithTarget:defaults selector:@selector(synchronize) object:NULL]; 173 [defaults performSelector:@selector(synchronize) withObject:NULL afterDelay:0.1]; 165 [defaults performSelectorOnce:@selector(synchronize) withObject:NULL afterDelay:0.1]; 174 166 } 175 167 … … 224 216 } 225 217 218 219 220 + (void)setDouble:(double)value forKey:(id)key { 221 [[self settings] setObject:[NSNumber numberWithDouble:value] forKey:key]; 222 } 223 226 224 @end WiredServer/trunk/WiredCommon.h
r929 r938 1 /* $Id: WiredCommon.h,v 1. 2 2005/01/08 19:30:21morris Exp $ */1 /* $Id: WiredCommon.h,v 1.3 2005/01/14 16:09:22 morris Exp $ */ 2 2 3 3 /* … … 33 33 #import "WCConfig.h" 34 34 #import "WCConfigController.h" 35 #import "WCDashboardController.h" 35 36 #import "WCLogController.h" 36 37 #import "WCSettings.h"
