Michael J. Sherman wrote:
Benjamin D. Smedberg wrote:
Michael J. Sherman wrote:
I'm writing an app, and I need to store local user preferences.
Instead of mucking about with the LocalFile interface, is there some
'preference' kind of key-pair interface already available? I'm not
talking just the Mozilla preferences (browser stuff), but a more
generic interface I can use for my own app's preferences and data.
nsIPrefService/nsIPrefBranch
Is there any way to store arrays of items? For example, I have a group
of 3-4 settings, but the user can create multiple "sets" of these
settings, but it looks like the PrefService is a single key/value kinda
of setup.
Right now I'm leaning towards just a file stored in the prefs directory
and read/write XML to that to store this info.
My solution to this same problem was to store my application preferences
in the rdf:local-store datasource. By asserting RDF statements using my
application's chrome URL as the subject, I could create arbitrary
structures of data for my application to read. And the convenient thing
is that Mozilla handles load/save of this file for you. I'm not sure
about crash recovery, though it's not as important in my application.
http://www.mozdev.org/source/browse/rdfinspector/src/chrome/content/rdfinspector/settings.js?rev=1.3&content-type=text/x-cvsweb-markup
--man
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom