1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is Mozilla Communicator client code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998
20
* the Initial Developer. All Rights Reserved.
23
* Alec Flett <alecf@netscape.com>
24
* Brian Nesse <bnesse@netscape.com>
26
* Alternatively, the contents of this file may be used under the terms of
27
* either the GNU General Public License Version 2 or later (the "GPL"), or
28
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
* in which case the provisions of the GPL or the LGPL are applicable instead
30
* of those above. If you wish to allow use of your version of this file only
31
* under the terms of either the GPL or the LGPL, and not to allow others to
32
* use your version of this file under the terms of the NPL, indicate your
33
* decision by deleting the provisions above and replace them with the notice
34
* and other provisions required by the GPL or the LGPL. If you do not delete
35
* the provisions above, a recipient may use your version of this file under
36
* the terms of any one of the NPL, the GPL or the LGPL.
38
* ***** END LICENSE BLOCK ***** */
40
#include "nsISupports.idl"
41
#include "nsIPrefBranch.idl"
46
* The nsIPrefService interface is the main entry point into the back end
47
* preferences management library. The preference service is directly
48
* responsible for the management of the preferences files and also facilitates
49
* access to the preference branch object which allows the direct manipulation
50
* of the preferences themselves.
57
[scriptable, uuid(decb9cc7-c08f-4ea5-be91-a8fc637ce2d2)]
58
interface nsIPrefService : nsISupports
61
* Called to read in the preferences specified in a user preference file.
63
* @param aFile The file to be read.
66
* If nsnull is passed in for the aFile parameter the default preferences
67
* file(s) [prefs.js, user.js] will be read and processed.
69
* @return NS_OK File was read and processed.
70
* @return Other File failed to read or contained invalid data.
75
void readUserPrefs(in nsIFile aFile);
78
* Called to completely flush and re-initialize the preferences system.
80
* @return NS_OK The preference service was re-initialized correctly.
81
* @return Other The preference service failed to restart correctly.
86
* Called to reset all preferences with user set values back to the
87
* application default values.
89
* @return NS_OK Always.
91
void resetUserPrefs();
94
* Called to write current preferences state to a file.
96
* @param aFile The file to be written.
99
* If nsnull is passed in for the aFile parameter the preference data is
100
* written out to the current preferences file (usually prefs.js.)
102
* @return NS_OK File was written.
103
* @return Other File failed to write.
108
void savePrefFile(in nsIFile aFile);
112
* Call to get a Preferences "Branch" which accesses user preference data.
113
* Using a Set method on this object will always create or set a user
114
* preference value. When using a Get method a user set value will be
115
* returned if one exists, otherwise a default value will be returned.
117
* @param aPrefRoot The preference "root" on which to base this "branch".
118
* For example, if the root "browser.startup." is used, the
119
* branch will be able to easily access the preferences
120
* "browser.startup.page", "browser.startup.homepage", or
121
* "browser.startup.homepage_override" by simply requesting
122
* "page", "homepage", or "homepage_override". nsnull or ""
123
* may be used to access to the entire preference "tree".
125
* @return nsIPrefBranch The object representing the requested branch.
127
* @see getDefaultBranch
129
nsIPrefBranch getBranch(in string aPrefRoot);
132
* Call to get a Preferences "Branch" which accesses only the default
133
* preference data. Using a Set method on this object will always create or
134
* set a default preference value. When using a Get method a default value
135
* will always be returned.
137
* @param aPrefRoot The preference "root" on which to base this "branch".
138
* For example, if the root "browser.startup." is used, the
139
* branch will be able to easily access the preferences
140
* "browser.startup.page", "browser.startup.homepage", or
141
* "browser.startup.homepage_override" by simply requesting
142
* "page", "homepage", or "homepage_override". nsnull or ""
143
* may be used to access to the entire preference "tree".
146
* Few consumers will want to create default branch objects. Many of the
147
* branch methods do nothing on a default branch because the operations only
148
* make sense when applied to user set preferences.
150
* @return nsIPrefBranch The object representing the requested default branch.
154
nsIPrefBranch getDefaultBranch(in string aPrefRoot);
160
#define NS_PREFSERVICE_CID \
161
{ /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */ \
165
{ 0x92, 0xe1, 0xed, 0x22, 0xed, 0x29, 0x80, 0x00 } \
168
#define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
169
#define NS_PREFSERVICE_CLASSNAME "Preferences Server"
172
* Notification sent before reading the default user preferences files.
174
#define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs"
177
* Notification sent when resetPrefs has been called, but before the actual
178
* reset process occurs.
180
#define NS_PREFSERVICE_RESET_TOPIC_ID "prefservice:before-reset"