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: Bertrand Dekoninck
Subject: Re: How to add a defaults database to a theme ?
Date: Fri, 10 May 2019 13:24:38 +0200
User-agent: GNUMail (Version 1.3.0)

On 2019-05-10 13:06:02 +0200 Fred Kiefer <address@hidden> wrote:

> 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
Thanks,

I can get rid of the warning in this way, but I think my problem is different. 
In the code hereafter, is standardUserDefaults the database of the theme, or 
the database of the app using the theme ? If it's the theme 's one, how could I 
write to it with the command line. Should I use the bundle identifier ?

Bertrand

> 
>> 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
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
> 




reply via email to

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