Open
Bug 296382
Opened 20 years ago
Updated 2 years ago
support pref branches in <preferences>
Categories
(Toolkit :: Preferences, enhancement)
Toolkit
Preferences
Tracking
()
NEW
People
(Reporter: asqueella, Unassigned)
Details
When I write an Options UI for my extension, all its prefs are located in
'extensions.infolister.' subbranch, and it's rather inconvenient to type it in
every <preference>'s |name|. It would be nice if I could just write:
<preferences branch="extensions.infolister.">
<!-- The following accesses extensions.infolister.somePref -->
<preference id="p_somePref" name="somePref" type="int"/>
</preferences>
Comment 1•19 years ago
|
||
It might be interesting to implement this via a new <prefbranch> XUL tag.
Specifically, I'm thinking about extensions with lots of prefs that have been
divided into sub-branches. Say, mything.foo.*, mything.bar.* mything.*. In this
case, the ability to nest branches and use relative/absolute branch names could
be useful.
For example, something like this:
<prefbranch root="mything">
<prefbranch subbranch="subbranch1">
... options here, set to mything.subbranch1.* ...
</prefbranch>
<prefbranch root="browser">
... options here, set to browser.* ...
</prefbranch>
<prefbranch subbranch="subbranch2">
... options here, set to mything.subbranch2.* ...
</prefbranch>
<prefbranch subbranch="bar" root="foo">
... options here, set to foo.bar.* ...
</prefbranch>
</prefbranch>
It still might be useful to be able to do this in a <preferences> tag for simple
cases, though. Also, setting both foo.bar and foo.bar.baz would require some
care with where you set each. Maybe some sort of filesystem-like ".." concept is
needed. Or maybe not. :-)
I'm currently working on a rough cut of this right now, as my extension
<prefpane/>s could benefit a great deal from this ability.
Right now, my current work is doing the following:
- <preferences/> gains a new field, 'currentBranch', containing an nsIPrefBranch
of the desired branch, and a new property, 'branch', whose setter goes and makes
an nsIPrefBranch of the desired branch and assigns it to 'currentBranch'.
- <preference/>'s name setter will now check to see if its parent element has
the branch property assigned, and if so, will check to see if the value of that
property exists in the val of the setter, using indexOf(). If it doesn't, it
concatenates the two. This is the part that needs the most thought, as using
split() and checking each token sounds hackish.
- <preference/>'s _branch property checks for the presence of the parent node's
'currentBranch', and if it is set, returns that instead.
I should have a working patch sometime tomorrow. Comments on this rough draft
are welcome.
Updated•15 years ago
|
QA Contact: nobody → preferences
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•