Understanding Preferences

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding Preferences

reverendlinux-2
I need a little expert mentoring on Preferences.  I am building a stand alone application and have a very basic prefs.js file for it.  The contents of which look like this.

pref("toolkit.defaultChromeURI", "chrome://SCDBII/content/scdbii.xul");
pref("browser.chromeURL", "chrome://browser/content/browser.xul");
pref("toolkit.defaultChromeFeatures", "chrome,resizable,close=no");
pref("toolkit.singletonWindowType", "scdbii_main");
user_pref("capability.principal.codebase.scdbii.granted","UniversalXPConnect");
pref("scdbii.maximum.size","5500");


In my app, I have a prefwindow with one field that corresponds to the last line of the prefs.js file (scdbii.maximum.size).  I've successfully been able to get and set this pref value.  However, the prefs.js file is not reflecting the changes.  I can exit/restart the app and even restart my computer and the updated pref settings are there and not reflected in the file itself.

I can't seem to find anything in the scattered documentation that would explain this.  So my question is: how exactly is this working?  Where is XUL/XPCOM storing my preferences and the updates to them?

Thanks in advance.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Understanding Preferences

Andreas Franz
Am Dienstag, 10. September 2013 01:39:02 UTC+2 schrieb [hidden email]:

> I need a little expert mentoring on Preferences.  I am building a stand alone application and have a very basic prefs.js file for it.  The contents of which look like this.
>
>
>
> pref("toolkit.defaultChromeURI", "chrome://SCDBII/content/scdbii.xul");
>
> pref("browser.chromeURL", "chrome://browser/content/browser.xul");
>
> pref("toolkit.defaultChromeFeatures", "chrome,resizable,close=no");
>
> pref("toolkit.singletonWindowType", "scdbii_main");
>
> user_pref("capability.principal.codebase.scdbii.granted","UniversalXPConnect");
>
> pref("scdbii.maximum.size","5500");
>
>
>
>
>
> In my app, I have a prefwindow with one field that corresponds to the last line of the prefs.js file (scdbii.maximum.size).  I've successfully been able to get and set this pref value.  However, the prefs.js file is not reflecting the changes.  I can exit/restart the app and even restart my computer and the updated pref settings are there and not reflected in the file itself.
>
>
>
> I can't seem to find anything in the scattered documentation that would explain this.  So my question is: how exactly is this working?  Where is XUL/XPCOM storing my preferences and the updates to them?
>
>
>
> Thanks in advance.

If you're using a windows machine the preferences are stored under C:\Users\%USER_PROFILE%\AppData\Roaming\%VENDOR_NAME%\%APP_NAME%\Profiles\xxxxxxx.default/prefs.js

Make sure that you install the app with the --install-app option and not only start it from the command line.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Understanding Preferences

reverendlinux-2
Andreas,

Very helpful, thank you.   I am indeed developing this on Windows, but with the next step of porting to Unix and eventually OS X.  My approach is to be as platform agnostic in th coding as possible hence the use of preferences for this option and future ones.

The use of a different location to store the prefs brings up a question.  Why have the prefs.js in <appdir>/defaults/preferences and another one in the users AppData directory structure?

I haven't used the install-app method before so that will be a learning experience.  If you )or anyone else) knows of any "gotchas" I'd love to hear about them.  

Again, thanks.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Understanding Preferences

Neil-4
[hidden email] wrote:

>The use of a different location to store the prefs brings up a question.  Why have the prefs.js in <appdir>/defaults/preferences and another one in the users AppData directory structure?
>  
>
default/preferences is just the default values for the preferences for
all users, but individual users might want to customise their
preferences, and those customisations go into the user AppData.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: Understanding Preferences

reverendlinux-2
On Tuesday, September 10, 2013 4:53:31 PM UTC-6, Neil wrote:

> [hidden email] wrote:
>
>
>
> >The use of a different location to store the prefs brings up a question.  Why have the prefs.js in <appdir>/defaults/preferences and another one in the users AppData directory structure?
>
> >  
>
> >
>
> default/preferences is just the default values for the preferences for
>
> all users, but individual users might want to customise their
>
> preferences, and those customisations go into the user AppData.
>
>
>
> --
>
> Warning: May contain traces of nuts.

Neil,

Thanks.  I was assuming that the prefs.js for the app was the only such file.  Makes sense now.

Cheers!
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul