• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
prefs stopped saving.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

prefs stopped saving.


  • Subject: prefs stopped saving.
  • From: email@hidden
  • Date: Thu, 12 Feb 2004 03:46:45 EST

I was removing heavy comments from my source and now it doesn automatically
save the prefs, it's not complicated and only has 2 check boxes.

All I did was remove some comments to write ones more appropriate, of course
I deleted them the night before so I can't undo and I don't believe I deleted
any code.

It used to update the prefs automatically if you changed windows or closed
the prefs window but now it doesn't.

All of the routines appear to be present and it builds without errors, what
gives???

Here is the entire source.
_______________________________________________
// GeneralPrefController.h

#import <Cocoa/Cocoa.h>
#import "SS_PreferencePaneProtocol.h"

@interface GeneralPrefController : NSObject <SS_PreferencePaneProtocol>
{

IBOutlet NSView *prefsView;
IBOutlet NSButton *allowUSB;
IBOutlet NSButton *enableAtStart;

NSUserDefaults *pref;


}

- (id)init;
- (void)get_Keys;
- (void)awakeFromNib;

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication
*)sender;

@end
_______________________________________________
// GeneralPrefController.m

#import "GeneralPrefController.h"

@implementation GeneralPrefController

+ (NSArray *)preferencePanes
{
return [NSArray arrayWithObjects:[[[GeneralPrefController alloc] init]
autorelease], nil];
}

- (NSView *)paneView
{
BOOL loaded = YES;

if (!prefsView) {
loaded = [NSBundle loadNibNamed:@"GeneralPrefPaneView" owner:self];
}

if (loaded) {
[self get_Keys];
return prefsView;
}


return nil;
}

- (NSString *)paneName
{
return @"General";
}

- (NSImage *)paneIcon
{
return [[[NSImage alloc] initWithContentsOfFile:
[[NSBundle bundleForClass:[self class]] pathForImageResource:
@"General_Prefs"]
] autorelease];
}

- (NSString *)paneToolTip
{
return @"General Preferences";
}

-(id)init
{

extern id NSApp;
[NSApp setDelegate: self];
return [super init];
}

- (void)savePrefs
{
[[NSUserDefaults standardUserDefaults] setInteger:[allowUSB state] forKey:
@"Allow USB"];
[[NSUserDefaults standardUserDefaults] setInteger:[enableAtStart state]
forKey:@"Enable At Start"];
[self get_Keys];
}

- (void)get_Keys
{
[allowUSB setState:[[NSUserDefaults standardUserDefaults] integerForKey:
@"Allow USB"]];
[enableAtStart setState:[[NSUserDefaults standardUserDefaults]
integerForKey:@"Enable At Start"]];
}

- (void)awakeFromNib
{
[self get_Keys];
}

- (BOOL)allowsHorizontalResizing
{
return NO;
}

- (BOOL)allowsVerticalResizing
{
return NO;
}

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication
*)sender
{
return YES;
}

@end
_______________________________________________

Dale
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: prefs stopped saving.
      • From: Yann Bizeul <email@hidden>
  • Prev by Date: Re: Method declaration conflict with NSURLConnection.
  • Next by Date: Re: Adding/removing rectangles from an NSImageView
  • Previous by thread: Re: Spinning wait cursor in COCOA
  • Next by thread: Re: prefs stopped saving.
  • Index(es):
    • Date
    • Thread