Re: Problem calling InternetConfig in Jaguar
Re: Problem calling InternetConfig in Jaguar
- Subject: Re: Problem calling InternetConfig in Jaguar
- From: Christian Weykopf <email@hidden>
- Date: Tue, 1 Oct 2002 00:12:44 +0200
Am Montag den, 30. September 2002, um 23:06, schrieb Philippe Martin:
At 16:57 +0100 30/09/02, Diggory Laycock wrote:
I use ICSetPref in my prefpane to change helpers - it seems to 'stick'
for all kinds of apps (with creator codes).
How do you get the creator code? Here's what I do (that's appCreatorCode
that I pass to ICSetPref):
NSFileManager *defaultManager = [ NSFileManager defaultManager ];
NSBundle *appBundle = [ NSBundle bundleWithPath:filepath ];
NSString *appName = [ defaultManager displayNameAtPath:filepath
];
NSDictionary *fileAttributes;
NSString *quote = @"'";
NSString *creatorString;
OSType appCreatorCode;
if ( appBundle ) {
fileAttributes = [ appBundle infoDictionary ];
creatorString = [ [ quote stringByAppendingString:
[ fileAttributes objectForKey:@"CFBundleSignature" ] ]
stringByAppendingString:quote ];
appCreatorCode = NSHFSTypeCodeFromFileType( creatorString );
} else {
fileAttributes = [ defaultManager fileAttributesAtPath:
filepath traverseLink:YES ];
appCreatorCode = [ fileAttributes fileHFSCreatorCode ];
creatorString = NSFileTypeForHFSTypeCode( appCreatorCode );
Could my problem be in there? It doesn't seem so to me, but I'm only an
egg.
I do it this way, it works in 10.1.x and 10.2:
- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
NSURL* browserURL;
LSItemInfoRecord browserInfo;
CFStringRef displayName;
if(returnCode != 1) // Benutzer hat nicht OK gedr|ckt
return;
browserURL = [[sheet URLs] objectAtIndex:0];
if (browserURL == NULL) // NIX AUSGEWDHLT
return;
if (LSCopyItemInfoForURL((CFURLRef)browserURL, kLSRequestTypeCreator,
&browserInfo) != noErr)
return;
browserCreator = browserInfo.creator;
LSCopyDisplayNameForURL((CFURLRef)browserURL, &displayName);
[browserTextField setStringValue: (NSString *)displayName];
[browserURL release];
CFRelease (displayName);
}
I have found that if Internet Explorer is open when you make the change
- when you quit IE it will stampede all over your changes with its own
cached version of the ICHelpers preference.
I haven't seen this. Is that new in Jaguar? OTOH, that doesn't seem to be
related to my problem, because the changes I do don't even stick until I
quit IE.
Thanks for your reply, anyway.
Philippe
On Monday, September 30, 2002, at 04:13 pm, Philippe Martin wrote:
My application (IC-Switch) gets and sets InternetConfig helpers by
calling ICGetPref and ICSetPref. Everything worked fine with Mac OS X 10.
1, but in 10.2, only Carbon and Classic applications are recorded by
ICSetPref. It returns noErr for Cocoa applications too, but the change
doesn't take.
Using Sampler, I can see that System Preferences still calls ICSetPref
when setting a helper to a Cocoa application, but then the changes are
stored in com.apple.LaunchServices.plist instead of
com.apple.internetconfig.plist, and nothing tells me why. All my calls
to ICSetPref result in updating only internetconfig.plist.
And when I set a helper to a Cocoa application from System Preferences
and then call ICGetPref from my application, I still get the application'
s creatorCode as OSType and the application's name as a Pascal string,
just like I pass them when I call ICSetPref.
I found that InternetConfig moved to HIServices and I fixed my
references accordingly, but I didn't find any mention of a change in
ICSetPref's parameters (even in InternetConfig.h). Any idea on what I
miss? Any suggestion on how to find it out (like how to intercept System
Preferences's call to ICSetPref and see the parameters it passes)?
Thanks!
Philippe
--
______________________________________________________________________
Philippe MARTIN (a.k.a. Flip) mailto:email@hidden
http://www.MacrobyteResources.com http://www.Free-Conversant.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/
cocoa-dev
Do not post admin requests to the list. They will be ignored.
Diggory Laycock
-----------------------
http://www.diggory.net
--
______________________________________________________________________
Philippe MARTIN (a.k.a. Flip) mailto:email@hidden
http://www.MacrobyteResources.com http://www.Free-Conversant.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Mit freundlichen Gr|_en
Christian Weykopf
--
Meilenstein Software GmbH
Neue Strasse 5
D-31582 Nienburg
Tel: +49 (0) 5021 91 24 44
Fax: +49 (0) 5021 91 24 45
http://www.meilenstein.de/
mailto:email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.