5 // Created by Claudio Bisegni LNF
-INFN on
26/04/08.
6 // Copyright
2008 Infn.
All rights reserved.
9 #import "AFSPropertyManager.h"
13 NSString
*afsSysPath
= nil
;
14 AFSPropertyManager
*propManager
= nil
;
16 void readPreferenceFile
();
17 void makeAFSPropertyManager
();
20 int main
(int argc
, char *argv
[])
23 NSAutoreleasePool
*pool
= [[NSAutoreleasePool alloc
] init
];
25 NSLog
(@"Start AFS Preference Daemon"
);
26 // read the preference file
29 //check
if base afs
path is
set
30 if(!afsSysPath
) return 1;
35 //make the afs property manager and
load all afs configuration
36 makeAFSPropertyManager
();
40 if(propManager
) [propManager release
];
46 // -------------------------------------------------------------------------------
47 // readPreferenceFile
:
48 // -------------------------------------------------------------------------------
49 void readPreferenceFile
()
51 // read the preference
for afs
path
52 afsSysPath
= (NSString
*)CFPreferencesCopyAppValue
((CFStringRef
)PREFERENCE_AFS_SYS_PAT
, (CFStringRef
)kAfsCommanderID
);
55 // read the preference
for aklog use
56 NSNumber
*useAklogPrefValue
= (NSNumber
*)CFPreferencesCopyAppValue
((CFStringRef
)PREFERENCE_USE_AKLOG
, (CFStringRef
)kAfsCommanderID
);
57 useAklog
= [useAklogPrefValue boolValue
];
61 // -------------------------------------------------------------------------------
62 // makeAFSPropertyManager
:
63 // -------------------------------------------------------------------------------
64 void makeAFSPropertyManager
() {
66 [propManager release
];
68 propManager
= [[AFSPropertyManager alloc
] initWithAfsPath
:afsSysPath
];
69 [propManager loadConfiguration
];
72 // -------------------------------------------------------------------------------
73 // makeAFSPropertyManager
:
74 // -------------------------------------------------------------------------------
76 //call aklog
for all selected
cell, but first check
if afs is up
77 if([propManager checkAfsStatus
] && useAklog
) {
78 [propManager getTokens
:false
82 // send notification to
83 [[NSDistributedNotificationCenter defaultCenter
] postNotificationName
:kAFSMenuExtraID object
:kMExtraAFSStateChange
];