remyaaron / hcalendar

Automatically exported from code.google.com/p/hcalendar
0 stars 0 forks source link

preference names begin with "extensions." #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

2. Add-ons may not create preferences outside of the "extensions." preference 
branch. Please make sure that all of  preference names begin with "extensions." 
followed by an identifier unique to your extension. Though as your add-on 
already uses root branches in fully approved versions, we suggest that you 
migrate them to the "extensions." branch in a future update but do not require 
it.

Original issue reported on code.google.com by igor.zc on 22 Apr 2012 at 9:03

GoogleCodeExporter commented 8 years ago

Original comment by igor.zc on 23 Apr 2012 at 4:06

GoogleCodeExporter commented 8 years ago
//
// Andrew Williamson awilliamson@mozilla.com
//
I remember but I don't have the snippet.  This is what I did in my extension 
(slightly modified so untested in this state!):

function convertPrefs()  {
 let prefService= Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
 let old=prefService.getBranch('extname.');
 let mew=prefService.getBranch('extensions.extname.');
 if (mew.getPrefType('prefsmigrated')==mew.PREF_BOOL && mew.getBoolPref('prefsmigrated')) return;
 var children=old.getChildList("", {});
 for (var i=0;i<children.length;i++) {
       if (old.prefHasUserValue(children[i])) {
               let type= old.getPrefType(children[i]);
               if (type==old.PREF_BOOL)   mew.setBoolPref(children[i],old.getBoolPref(children[i]));
               if (type==old.PREF_INT)    mew.setIntPref (children[i],old.getIntPref (children[i]));
               if (type==old.PREF_STRING) mew.setCharPref(children[i],old.getCharPref(children[i]));
               old.clearUserPref(children[i]);
       }
 }
 mew.setBoolPref('prefsmigrated',true);

Original comment by igor.zc on 26 Apr 2012 at 9:01

GoogleCodeExporter commented 8 years ago
fixed in 1.0.6.0

Original comment by igor.zc on 26 Apr 2012 at 10:29