• 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
Re: prefs stopped saving.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prefs stopped saving.


  • Subject: Re: prefs stopped saving.
  • From: Daniel Todd Currie <email@hidden>
  • Date: Thu, 12 Feb 2004 03:01:26 -0800

I've never used -synchronize... I don't think it's your problem here either.

More likely the problem is that -savePrefs is not called anywhere in the source you have sent.

// Daniel Currie


On 2004 Feb 12, at 02:13, Yann Bizeul wrote:

You should [[NSUserDefaults standardUserDefaults] synchronize ] somewhere
You can make it in a dealloc method, or just after setting the defaults.

Regards,

Le 12 fivr. 04, ` 09:46, email@hidden a icrit :

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.


--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
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.
_______________________________________________
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.

References: 
 >prefs stopped saving. (From: email@hidden)
 >Re: prefs stopped saving. (From: Yann Bizeul <email@hidden>)

  • Prev by Date: Drag&Drop with draw rectangle as iTunes
  • Next by Date: Use of mouseOver & live-feedback (possibly OT)
  • Previous by thread: Re: prefs stopped saving.
  • Next by thread: getting the "selectedControl" effect on a button
  • Index(es):
    • Date
    • Thread