discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add a defaults database to a theme ?


From: Fred Kiefer
Subject: Re: How to add a defaults database to a theme ?
Date: Fri, 10 May 2019 13:06:02 +0200

Hi Bertrand,

I think you are misreading the compiler warning. This just complains that the 
class that this method is on already has an instance variable with the name 
„defaults“. You should just use a different name for your local variable 
instead. Maybe something like „user_defaults“?

Hope this helps,
Fred

> Am 10.05.2019 um 12:39 schrieb Bertrand Dekoninck <address@hidden>:
> 
> Hi, everyone, I'd like to add some default values to the rik.theme, writable 
> with the "defaults" tool.
> I wanted to add a transparency level to the top menu bar, which would be 
> editable. I thought I could do something like this :
> 
> - (NSColor *) menuBackgroundColor
> {
>  float transparency = 1.0;
>  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
>   if ([defaults floatForKey:@"menubartransparency"])
>    {
>      transparency = [defaults floatForKey:@"menubartransparency"];
>      }
> 
>  NSColor *color = [NSColor colorWithCalibratedRed: 0.992 green: 0.992 blue: 
> 0.992 alpha: transparency];
>  return color;
> }
> 
> I get then a warning :  "local declaration of ‘defaults’ hides instance 
> variable"
> And when I read the documentation, I see that [NSUserDefaults 
> standardUserDefaults] is for the current app and user.
> A theme is not an app but a bundle. rik dosn't have such thing as an app 
> controller to initiate the database at start-up. Can I create a defaults 
> database for it, and how ? 
> 
> Bertrand




reply via email to

[Prev in Thread] Current Thread [Next in Thread]