2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
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.
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.
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
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
;
62 - (void)closeController
;
64 - (void)movePreferenceFolderFromAdium2ToAdium
;
67 - (IBAction
)showPreferenceWindow
:(id
)sender
;
68 - (void)openPreferencesToCategoryWithIdentifier
:(NSString
*)identifier
;
69 - (void)openPreferencesToAdvancedPane
:(NSString
*)paneName
;
70 - (void)addPreferencePane
:(AIPreferencePane
*)inPane
;
71 - (NSArray
*)paneArray
;
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
;
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
;
91 - (void)registerDefaults
:(NSDictionary
*)defaultDict forGroup
:(NSString
*)group
;
92 - (void)registerDefaults
:(NSDictionary
*)defaultDict forGroup
:(NSString
*)group object
:(AIListObject
*)object
;
93 - (void)resetPreferencesInPane
:(AIPreferencePane
*)preferencePane
;
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
;
105 @interface
NSObject (AIPreferenceObserver
)
106 - (void)preferencesChangedForGroup
:(NSString
*)group key
:(NSString
*)key
107 object
:(AIListObject
*)object preferenceDict
:(NSDictionary
*)prefDict firstTime
:(BOOL
)firstTime
;