[Top][All Lists]

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

How to add a defaults database to a theme ?

From: Bertrand Dekoninck
Subject: How to add a defaults database to a theme ?
Date: Fri, 10 May 2019 12:39:28 +0200
User-agent: GNUMail (Version 1.3.0)

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 
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 ? 


reply via email to

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