Fwd: (Solved) prefs stopped saving.
Fwd: (Solved) prefs stopped saving.
- Subject: Fwd: (Solved) prefs stopped saving.
- From: email@hidden
- Date: Thu, 12 Feb 2004 07:36:38 EST
Shame on me!!!!
Accidentally deleted the reference in the controller file and upon exit it
never exicuted savePrefs.
Thanks for the wake-up....
Dale
Return-Path: <email@hidden>
Received: from rly-ya02.mx.aol.com (rly-ya02.mail.aol.com
[172.18.141.34]) by air-ya02.mail.aol.com (v97.18) with ESMTP id
MAILINYA24-148402b7028248; Thu, 12 Feb 2004 07:23:38 -0500
Received: from Fitz.local (gw.overlap.fr [195.68.3.254]) by
rly-ya02.mx.aol.com (v98.5) with ESMTP id
MAILRELAYINYA28-148402b7028248; Thu, 12 Feb 2004 07:23:04 -0500
Received: from [127.0.0.1] (localhost [127.0.0.1]) by Fitz.local
(Postfix) with ESMTP id 8EBF6BC505; Thu, 12 Feb 2004 13:23:08 +0100
(CET)
In-Reply-To: <email@hidden>
References: <email@hidden>
<email@hidden>
<email@hidden>
Mime-Version: 1.0 (Apple Message framework v612)
Content-Type: text/plain; charset="us-ascii"
Message-Id: <email@hidden>
Cc: CocoaDev List <email@hidden>
From: Yann Bizeul <email@hidden>
Subject: Re: prefs stopped saving.
Date: Thu, 12 Feb 2004 13:23:07 +0100
To: email@hidden
X-Mailer: Apple Mail (2.612)
X-AOL-IP: 195.68.3.254
X-Converted-To-Plain-Text: from multipart/signed by demime 0.98b
X-Converted-To-Plain-Text: Alternative section used was text/plain
Fool of me. Daniel is right, you never call savePrefs....
You should connect your buttons to your object or call it when closing
the window...
Le 12 fivr. 04, ` 12:01, Daniel Todd Currie a icrit :
>
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.
>
>
--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.