* GSWeb.framework/GSWApplication+Defaults.m (TAKEVALUEFORKEY):

New macro to use new setValue:forKey: instead of takeValue:forKey:
        on Cocoa systems until it is implemented for GNUstep.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@20369 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2004-11-22 16:54:54 +00:00
parent c5ee2bd0bf
commit 3fdb17626a
2 changed files with 18 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2004-11-22 David Ayers <d.ayers@inode.at>
* GSWeb.framework/GSWApplication+Defaults.m (TAKEVALUEFORKEY):
New macro to use new setValue:forKey: instead of takeValue:forKey:
on Cocoa systems until it is implemented for GNUstep.
2004-11-12 David Ayers <d.ayers@inode.at>
* GSWeb.framework/GSWApplication.m (GSWApplicationMainReal):

View file

@ -514,34 +514,42 @@ GSWeb_DestroyGlobalAppDefaultOptions(void)
(_userDefaults ? _userDefaults \
: (_userDefaults = [NSUserDefaults standardUserDefaults]))
/* FIXME: Once setValue:forKey: is implemented in -base we should use
use it unconditionally. */
#ifdef GNUSTEP
#define TAKEVALUEFORKEY [self takeValue: val forKey: key]
#else
#define TAKEVALUEFORKEY [self setValue: val forKey: key]
#endif
/* These two macros are seperate for experimental reasons.
They may be merged later. */
#define INIT_DFLT_OBJ(name,opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
id val = [NSUSERDEFAULTS objectForKey: opt]; \
[self takeValue: val forKey: key]; }
TAKEVALUEFORKEY; }
#define INIT_DFLT_BOOL(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
BOOL v = [NSUSERDEFAULTS boolForKey: opt]; \
id val = [NSNumber numberWithBool: v]; \
[self takeValue: val forKey: key]; }
TAKEVALUEFORKEY; }
#define INIT_DFLT_INT(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
int v = [NSUSERDEFAULTS integerForKey: opt]; \
id val = [NSNumber numberWithInt: v]; \
[self takeValue: val forKey: key]; }
TAKEVALUEFORKEY; }
#define INIT_DFLT_FLT(name, opt) \
if (_dflt_init_##name == NO) { \
id key = [NSString stringWithCString: #name]; \
float v = [NSUSERDEFAULTS floatForKey: opt]; \
id val = [NSNumber numberWithFloat: v]; \
[self takeValue: val forKey: key]; }
TAKEVALUEFORKEY; }
@implementation GSWApplication (GSWApplicationDefaults)
//--------------------------------------------------------------------