Release/Growl/OpenGrowlPrefPane/PrefPaneOpener.m
changeset 4451 939a07eddf5e
parent 4450 2466e516f7e2
child 4452 e5b1db34ee0b
     1.1 --- a/Release/Growl/OpenGrowlPrefPane/PrefPaneOpener.m	Sun Sep 27 20:52:15 2009 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,64 +0,0 @@
     1.4 -//
     1.5 -//  PrefPaneOpener.m
     1.6 -//  OpenGrowlPrefPane
     1.7 -//
     1.8 -//  Created by Evan Schoenberg on 9/1/07.
     1.9 -//
    1.10 -
    1.11 -#import "PrefPaneOpener.h"
    1.12 -#import "AEVTBuilder.h"
    1.13 -
    1.14 -/*!
    1.15 - * @class PrefPaneOpener
    1.16 - * @brief Opens a specified preference pane in the System Preferences
    1.17 - *
    1.18 - * This is equivalent to the applescript:
    1.19 - *		tell application "System Preferences" to set current pane to pane "preferencePaneName"
    1.20 - * except it works with any localization, not just English.  Applescript has no way of talking to an application
    1.21 - * with a specified bundle ID.
    1.22 - */
    1.23 -@implementation PrefPaneOpener
    1.24 -
    1.25 -+ (void)openPrefPane:(NSString *)preferencePaneName
    1.26 -{
    1.27 -	ProcessSerialNumber psn;
    1.28 -	
    1.29 -	[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.apple.systempreferences"
    1.30 -														 options:NSWorkspaceLaunchWithoutAddingToRecents
    1.31 -								  additionalEventParamDescriptor:nil
    1.32 -												launchIdentifier:NULL];
    1.33 -	
    1.34 -	NSEnumerator *enumerator = [[[NSWorkspace sharedWorkspace] launchedApplications] objectEnumerator];
    1.35 -	NSDictionary *dict;
    1.36 -	while ((dict = [enumerator nextObject])) {
    1.37 -		if ([[dict objectForKey:@"NSApplicationBundleIdentifier"] isEqualToString:@"com.apple.systempreferences"]) {
    1.38 -			psn.highLongOfPSN = [[dict objectForKey:@"NSApplicationProcessSerialNumberHigh"] longValue];
    1.39 -			psn.lowLongOfPSN  = [[dict objectForKey:@"NSApplicationProcessSerialNumberLow"] longValue];
    1.40 -			break;
    1.41 -		}
    1.42 -	}
    1.43 -	
    1.44 -	/* tell application "System Preferences" to set current pane to pane "preferencePaneName" */
    1.45 -	OSType cSysPrefsPane = 'xppb';
    1.46 -	OSType keySysPrefsCurrentPane = 'xpcp';
    1.47 -	NSAppleEventDescriptor *descriptor = [AEVT class:kCoreEventClass id:kAESetData
    1.48 -											  target:psn,
    1.49 -										  [KEY : keyAEData],
    1.50 -										  [RECORD : cObjectSpecifier,
    1.51 -										   [KEY : keyAEKeyForm],      [ENUM : formName],
    1.52 -										   [KEY : keyAEDesiredClass], [TYPE : cSysPrefsPane],
    1.53 -										   [KEY : keyAEKeyData],      [STRING : preferencePaneName],
    1.54 -										   [KEY : keyAEContainer],    [DESC null],
    1.55 -										   ENDRECORD],
    1.56 -										  [KEY : keyDirectObject],
    1.57 -										  [RECORD : cObjectSpecifier,
    1.58 -										   [KEY : keyAEKeyForm],      [ENUM : formPropertyID],
    1.59 -										   [KEY : keyAEDesiredClass], [TYPE : cProperty],
    1.60 -										   [KEY : keyAEKeyData],      [TYPE : keySysPrefsCurrentPane],
    1.61 -										   [KEY : keyAEContainer],    [DESC null],
    1.62 -										   ENDRECORD],
    1.63 -										   ENDRECORD];
    1.64 -	[descriptor sendWithImmediateReply];	
    1.65 -}
    1.66 -
    1.67 -@end