Versioned to .88b3 and fixed the copyright date to 2006
[adiumx.git] / Source / AIPreferenceController.h
blob09b88658f4b3c80f3004e373acc72031d41f6c84
1 /*
2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
4 *
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //Preference groups
18 #define PREF_GROUP_GENERAL @"General"
19 #define PREF_GROUP_ACCOUNTS @"Accounts"
20 #define PREF_GROUP_TOOLBARS @"Toolbars"
21 #define PREF_GROUP_WINDOW_POSITIONS @"Window Positions"
22 #define PREF_GROUP_SPELLING @"Spelling"
23 #define OBJECT_PREFS_PATH @"ByObject" //Path to object specific preference folder
24 #define ACCOUNT_PREFS_PATH @"Accounts" //Path to account specific preference folder
26 //Preference Categories
27 typedef enum {
28 AIPref_Accounts = 0,
29 AIPref_General,
30 AIPref_Appearance,
31 AIPref_Messages,
32 AIPref_Status,
33 AIPref_Events,
34 AIPref_FileTransfer,
35 AIPref_Advanced
36 } PREFERENCE_CATEGORY;
38 @class AIPreferencePane, AIAdium, AIListObject;
40 @interface AIPreferenceController : NSObject {
41 IBOutlet AIAdium *adium;
42 NSString *userDirectory;
44 NSMutableArray *paneArray; //Loaded preference panes
45 NSMutableDictionary *observers; //Preference change observers
47 NSMutableDictionary *defaults; //Preference defaults
48 NSMutableDictionary *prefCache; //Preference cache
49 NSMutableDictionary *prefWithDefaultsCache; //Preference cache with defaults included
51 NSMutableDictionary *objectDefaults; //Object specific defaults
52 NSMutableDictionary *objectPrefCache; //Object specific preferences cache
53 NSMutableDictionary *objectPrefWithDefaultsCache; //Object specific preferences cache with defaults included
55 int preferenceChangeDelays; //Number of active delays (0 = not delayed)
56 NSMutableSet *delayedNotificationGroups; //Groups with delayed changes
59 - (void)initController;
60 - (void)finishIniting;
61 - (void)beginClosing;
62 - (void)closeController;
64 - (void)movePreferenceFolderFromAdium2ToAdium;
66 //Preference Window
67 - (IBAction)showPreferenceWindow:(id)sender;
68 - (void)openPreferencesToCategoryWithIdentifier:(NSString *)identifier;
69 - (void)openPreferencesToAdvancedPane:(NSString *)paneName;
70 - (void)addPreferencePane:(AIPreferencePane *)inPane;
71 - (NSArray *)paneArray;
73 //Observing
74 - (void)registerPreferenceObserver:(id)observer forGroup:(NSString *)group;
75 - (void)unregisterPreferenceObserver:(id)observer;
76 - (void)informObserversOfChangedKey:(NSString *)key inGroup:(NSString *)group object:(AIListObject *)object;
77 - (void)delayPreferenceChangedNotifications:(BOOL)inDelay;
79 //Setting Preferences
80 - (void)setPreference:(id)value forKey:(NSString *)key group:(NSString *)group;
81 - (void)setPreference:(id)value forKey:(NSString *)inKey group:(NSString *)group object:(AIListObject *)object;
83 //Retrieving Preferences
84 - (id)preferenceForKey:(NSString *)key group:(NSString *)group;
85 - (id)preferenceForKey:(NSString *)key group:(NSString *)group object:(AIListObject *)object;
86 - (id)preferenceForKey:(NSString *)key group:(NSString *)group objectIgnoringInheritance:(AIListObject *)object;
87 - (NSDictionary *)preferencesForGroup:(NSString *)group;
88 - (id)defaultPreferenceForKey:(NSString *)key group:(NSString *)group object:(AIListObject *)object;
90 //Defaults
91 - (void)registerDefaults:(NSDictionary *)defaultDict forGroup:(NSString *)group;
92 - (void)registerDefaults:(NSDictionary *)defaultDict forGroup:(NSString *)group object:(AIListObject *)object;
93 - (void)resetPreferencesInPane:(AIPreferencePane *)preferencePane;
95 //Preference Cache
96 - (NSMutableDictionary *)cachedPreferencesForGroup:(NSString *)group object:(AIListObject *)object;
97 - (void)updateCachedPreferences:(NSMutableDictionary *)prefDict forGroup:(NSString *)group object:(AIListObject *)object;
99 //Default download location
100 - (NSString *)userPreferredDownloadFolder;
101 - (void)setUserPreferredDownloadFolder:(NSString *)path;
103 @end
105 @interface NSObject (AIPreferenceObserver)
106 - (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)key
107 object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime;
108 @end