Use a simple swap, not a three-point swizzle, in the hope of interacting better with other Mail bundles that have preferences (such as MailActOn).
authorPeter Hosey <hg@boredzo.org>
Thu Sep 24 23:30:02 2009 -0700 (2009-09-24)
changeset 44316b117acf2fe9
parent 4430 0f739ceca8b4
child 4432 c5d8e9cdac78
Use a simple swap, not a three-point swizzle, in the hope of interacting better with other Mail bundles that have preferences (such as MailActOn).
Extras/GrowlMail/GrowlMailPreferences.m
     1.1 --- a/Extras/GrowlMail/GrowlMailPreferences.m	Thu Sep 24 14:08:49 2009 -0700
     1.2 +++ b/Extras/GrowlMail/GrowlMailPreferences.m	Thu Sep 24 23:30:02 2009 -0700
     1.3 @@ -48,6 +48,9 @@
     1.4  
     1.5  @end
     1.6  
     1.7 +//Make the swizzle more readable.
     1.8 +#define sharedPreferencesFromAppKitSwizzledByGrowlMail sharedPreferencesForGrowlMail
     1.9 +
    1.10  @implementation GrowlMailPreferences
    1.11  
    1.12  //As of Mac OS X 10.5.6, Mail creates the +sharedPreferences object lazily, so the simplest way to install our prefpane is to swizzle the +sharedPreferences method.
    1.13 @@ -62,25 +65,10 @@
    1.14  		if (!sharedPreferencesFromAppKit)
    1.15  			GMShutDownGrowlMailAndWarn(@"Couldn't install GrowlMail prefpane: +[NSPreferences sharedPreferences] method missing");
    1.16  		else {
    1.17 -			//+[GrowlMailPreferences sharedPreferencesFromAppKitSwizzledByGrowlMail]
    1.18 -			Method sharedPreferencesFromAppKitFromGrowlMail = class_getClassMethod(self, @selector(sharedPreferencesFromAppKitSwizzledByGrowlMail));
    1.19  			//+[GrowlMailPreferences sharedPreferencesForGrowlMail]
    1.20  			Method sharedPreferencesForGrowlMail = class_getClassMethod(self, @selector(sharedPreferencesForGrowlMail));
    1.21  
    1.22 -			//Follow the lady!
    1.23 -			GMExchangeMethodImplementations(sharedPreferencesFromAppKit, sharedPreferencesFromAppKitFromGrowlMail);
    1.24  			GMExchangeMethodImplementations(sharedPreferencesFromAppKit, sharedPreferencesForGrowlMail);
    1.25 -			/*Results of the swizzling:
    1.26 -			 *
    1.27 -			 *+[NSPreferences sharedPreferences]
    1.28 -			 *	implemented by former +[NSPreferences sharedPreferencesForGrowlMail]
    1.29 -			 *
    1.30 -			 *+[NSPreferences sharedPreferencesForGrowlMail]
    1.31 -			 *	implemented by former +[NSPreferences sharedPreferencesFromAppKitSwizzledByGrowlMail] (the stub)
    1.32 -			 *
    1.33 -			 *+[NSPreferences sharedPreferencesFromAppKitSwizzledByGrowlMail]
    1.34 -			 *	implemented by former +[NSPreferences sharedPreferences]
    1.35 -			 */
    1.36  		}
    1.37  	}
    1.38  }
    1.39 @@ -100,10 +88,6 @@
    1.40  
    1.41  	return preferences;
    1.42  }
    1.43 -+ (id) sharedPreferencesFromAppKitSwizzledByGrowlMail {
    1.44 -	//Stub implementation to swizzle out.
    1.45 -	return nil;
    1.46 -}
    1.47  
    1.48  @end
    1.49