Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.h

1//
2// PreferencesControllerBase.h
3// ChameleonPrefPane
4//
5// Created by Rekursor on 1/22/10.
6//
7
8#import <Cocoa/Cocoa.h>
9#import "ChameleonPrefPane.h"
10#import "ChameleonPropertyList.h"
11#import "ShellProcess.h"
12#import "string_util.h"
13#import "GroupControllerProtocol.h"
14
15
16#define kChameleonUserRootDir @"~/Desktop/Chameleon"
17
18//--------------------------------------------------------------------------
19const char * const kKernelFlags = "Kernel Flags";
20
21//--------------------------------------------------------------------------
22enum GroupAction
23{
24SetDefaultValues,
25RefreshLockStates,
26LoadPreferencesOptions,
27LoadBootConfigOptions,
28AddOptionsDesc,
29SaveBootConfigOptions
30};
31
32/// PrefPane Localization Helper
33NSString* GetLocStrDef(NSString* label, NSString* comment, NSString* def);
34
35
36// ENHANCE ME: remove this globals and integrate them in ChameleonPrefPane or at least
37// add function accessor entry points
38
39/// Define common expected behavior for all derived controllers
40@interface PreferencesControllerBase : NSObject
41{
42}
43
44/// Register the Group panel for further automatic iteration matters
45+ (void) registerPreferencesGroup:(id) myGroup;
46
47/// Iterate and execute action for each register group
48+ (void) doForEachGroup: (GroupAction) action withOption:(id) option;
49
50/// Set refresh state {enabled | disabled} depending on the authorizations state
51+ (void) refreshBodLockState: (const BootOptionDesc*) bod;
52+ (void) refreshLockState: (id) item;
53
54/// Unitary Method for Load One option of any type
55+ (void) loadOptionsFromBootFile;
56
57/// Method for loading all registred options components in the interface
58+ (void) loadOptionFromBootFile:(id) optionID;
59
60/// Get the resource in the pref pane, needed because the bundle get resource api wont work
61/// as it would return the SystemPreferences application resource
62- (id) getResourcePath: (NSString *) str ofType: (NSString*) sType;
63
64/// Execute a task and wait for the process to terminate
65- (bool) executeTaskAndWaitForTermination: (NSString*)taskPath;
66- (bool) executeTaskAndWaitForTermination: (NSString*)taskPath withArgs:(NSArray*) args;
67
68/// Open a file selection modal dialog
69- (NSString*) selectFileWithFileTypes:(NSString*) dir withName: (NSString*) name withTypes:(NSArray*) fileTypes;
70/// Open a file selection modal dialog with a plist predefined type
71- (NSString*) selectAnyFile;
72- (NSString*) selectPlistFile:(NSString*)name;
73-(NSString*) selectDirectory:(NSString*) dirName;
74
75-(void) msgBoxInfo:(NSString*) msg;
76-(void) msgBoxError:(NSString*) msg;
77
78- (void) loadPreferences;
79- (bool) savePreferences;
80
81- (bool) handleSender: (id) sender;
82
83-(NSMutableDictionary*) preferencesFile;
84-(NSMutableDictionary*) preferencesParts;
85
86-(ChameleonPrefPane*) chameleon;
87
88@end
89

Archive Download this file

Revision: 458