[Project_owners] Setting preferences in new firefox

Tracy Norris tnorris at nc.rr.com
Thu Aug 5 19:02:03 EDT 2004


Thats the way autofill does it as well, Jaap. We also check the version
currently installed against the being installed version and update the
"internal preferences" if necessary. However, if it's possible to do it
the way Jawahar shows, I think that would be better.

Jaap Haitsma wrote:

> Jawahar Swaminathan wrote:
>
>> Hi.
>>
>> I'm trying to set some user_pref for my extension at installation
>> time and cannot get it to work.
>>
>> Using firefox 0.9.1
>>
>> The file extension.js is in the directory path 
>> extension/defaults/preferences/
>>
>> and contains the following lines
>>
>> user_pref("biobar.sequences", true); user_pref("biobar.structures",
>> true); user_pref("biobar.function", true);
>>
>> The extension is then zipped and installs and everythings seems okay.
>>
>>
>> However on doing an about:config for getting the settings I get
>>
>> Preference Name              Status            Type         Value
>>
>> biobar.sequences               default           boolean 
>> biobar.structures                default           boolean
>>
>> There is no value, which should have been true !!
>>
>> Any idea what is going on ? I've tried this with a new profile etc.
>>
>> Thanks. Any help greately appreciated.
>>
> I solve it in a different way. I check if they exist and then write the
> default values to them. Excerpt from code I use is below
>
> Cheers,
>
> Jaap
>
> ---------------------------------------------------------
>
> var dictionarySearchPrefs= 
> Components.classes["@mozilla.org/preferences-service;1"].
> getService(Components.interfaces.nsIPrefService).getBranch("dictionarysearch."); 
>
>
> if (!dictionarySearchPrefs.prefHasUserValue("menutext1")){
>   // Assign default values
>   dictionarySearchPrefs.setCharPref("url1", 
> dictionarySearchStrBundle.getString("dictionarysearch.default.URL"));
>   dictionarySearchPrefs.setCharPref("menutext1", 
> dictionarySearchStrBundle.getString("dictionarysearch.default.menutext")); 
>
>   dictionarySearchPrefs.setCharPref("accesskey1", 
> dictionarySearchStrBundle.getString("dictionarysearch.default.accesskey")); 
> }
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>




More information about the Project_owners mailing list