Subversion Repositories TruePreview

[/] [trunk/] [Source/] [TruePreviewPreferencesModule.m] - Diff between revs 42 and 47

Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | View Log

Rev 42 Rev 47
Line 34... Line 34...
@implementation TruePreviewPreferencesModule
@implementation TruePreviewPreferencesModule
 
 
#pragma mark NSPreferencesModule instance methods
#pragma mark NSPreferencesModule instance methods
 
 
- (NSString*)preferencesNibName {
- (NSString*)preferencesNibName {
 
  TRUEPREVIEW_LOG();
 
 
  return @"TruePreviewPreferencesPanel";
  return @"TruePreviewPreferencesPanel";
}
}
 
 
- (void)willBeDisplayed {
- (void)willBeDisplayed {
 
  TRUEPREVIEW_LOG();
 
 
  [super willBeDisplayed];
  [super willBeDisplayed];
 
 
  // build the list of accounts
  // build the list of accounts
  NSDictionary* theAccountDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"];
  NSDictionary* theAccountDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"];
  NSMutableArray* theAccounts = [NSMutableArray array];
  NSMutableArray* theAccounts = [NSMutableArray array];
Line 107... Line 111...
 
 
- (void)observeValueForKeyPath:(NSString*)inPath
- (void)observeValueForKeyPath:(NSString*)inPath
    ofObject:(id)inObject
    ofObject:(id)inObject
    change:(NSDictionary*)inChange
    change:(NSDictionary*)inChange
    context:(void*)inContext {
    context:(void*)inContext {
 
  TRUEPREVIEW_LOG(@"%@, %@, %@, %p", inPath, inObject, inChange, inContext);
 
 
  NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
  NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
 
 
  // build the account settings dictionary to save in the user defaults
  // build the account settings dictionary to save in the user defaults
  for (NSDictionary* theAccount in (NSArray*)inContext) {
  for (NSDictionary* theAccount in (NSArray*)inContext) {
    [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
    [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
  }
  }
 
 
  [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
  [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
  [[NSUserDefaults standardUserDefaults] synchronize];
  [[NSUserDefaults standardUserDefaults] synchronize];
 
}
 
 
 
#pragma mark Instance methods
 
 
 
- (NSString*)truePreviewVersion {
 
  return [[[NSBundle bundleForClass:[TruePreview class]] infoDictionary] objectForKey:@"CFBundleVersion"];
}
}
 
 
@end
@end