[Project_owners] Setting preferences in new firefox

Jawahar Swaminathan jawahar at ebi.ac.uk
Thu Aug 5 22:17:14 EDT 2004


Hi Jaap,

Thanks for the snippet. That just worked fine !!  I;; use this mechanism 
then. I was hoping that if one sets these defauls in the 
defaults/preferences area they would automatically be set to true on 
uninstallation.

Karsten wrote,
 >BTW: Did you consider prefixing your pref names with 'extensions.',

The pref biobar.something has the extension. The extension is called biobar.

Jawahar


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           
> booleanbiobar.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