Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

major oopsies fixed; log spew removed, prefs are honored immediately …

…instead of upon next launch, fixed problems with sparkle updating and sIFR prefs not working
  • Loading branch information...
commit 488ee14b62ce65989ae055ccd32c12d85063bbdd 1 parent 030877d
Simone Manganelli authored
View
1  Plugin/CTFPreferencesDictionary.h
@@ -11,6 +11,7 @@
@interface CTFPreferencesDictionary : NSMutableDictionary {
NSMutableDictionary *realMutableDictionary;
+ BOOL hasInited;
}
@end
View
26 Plugin/CTFPreferencesDictionary.m
@@ -13,6 +13,7 @@
#import "CTFPreferencesDictionary.h"
+static CTFPreferencesDictionary *sharedInstance = nil;
@implementation CTFPreferencesDictionary
@@ -21,10 +22,22 @@ + (id)dictionaryWithDictionary:(NSDictionary *)otherDictionary;
return [[CTFPreferencesDictionary alloc] initWithDictionary:otherDictionary];
}
++ (id)allocWithZone:(NSZone *)zone;
+{
+ if (sharedInstance) {
+ return [sharedInstance retain];
+ } else {
+ return [super allocWithZone:zone];
+ }
+}
+
- (id)init;
{
- if ((self = [super init])) {
- realMutableDictionary = [[NSMutableDictionary alloc] init];
+ if (! sharedInstance) {
+ if ((self = [super init])) {
+ realMutableDictionary = [[NSMutableDictionary alloc] init];
+ hasInited = YES;
+ }
}
return self;
@@ -32,8 +45,13 @@ - (id)init;
- (id)initWithDictionary:(NSDictionary *)otherDictionary;
{
- if ((self = [super init])) {
- realMutableDictionary = [[NSMutableDictionary dictionaryWithDictionary:otherDictionary] retain];
+ if (! sharedInstance) {
+ if ((self = [super init])) {
+ realMutableDictionary = [[NSMutableDictionary dictionaryWithDictionary:otherDictionary] retain];
+ hasInited = YES;
+ }
+ } else {
+ [sharedInstance setDictionary:otherDictionary];
}
return self;
View
13 Plugin/CTFUserDefaultsController.m
@@ -18,6 +18,15 @@ + (CTFUserDefaultsController *)standardUserDefaults;
return sharedInstance;
}
++ (id)allocWithZone:(NSZone *)zone;
+{
+ if (sharedInstance) {
+ return [sharedInstance retain];
+ } else {
+ return [super allocWithZone:zone];
+ }
+}
+
- (id)init;
{
if (! sharedInstance) {
@@ -56,7 +65,9 @@ - (CTFPreferencesDictionary *)values;
// and if that call detects that the user defaults dictionary hasn't
// been set up yet, it sets it up and *then* returns the values
- if (! userDefaultsDict) [self setUpExternalPrefsDictionary];
+ if (! userDefaultsDict) {
+ [self setUpExternalPrefsDictionary];
+ }
return userDefaultsDict;
}
View
2  Plugin/CTFsIFRSupport.m
@@ -35,7 +35,7 @@ of this software and associated documentation files (the "Software"), to deal
CTFSifrModeDeSifr = 2
} CTFSifrMode;
-static NSString *sSifrModeDefaultsKey = @"ClickToFlash_sifrMode";
+static NSString *sSifrModeDefaultsKey = @"sifrMode";
static NSString *sSifr2Test = @"sIFR != null && typeof sIFR == \"function\"";
static NSString *sSifr3Test = @"sIFR != null && typeof sIFR == \"object\"";
View
4 Plugin/Plugin.m
@@ -104,13 +104,11 @@ - (id) initWithArguments:(NSDictionary *)arguments
self = [super init];
if (self) {
[[NSUserDefaults standardUserDefaults] addSuiteNamed:@"com.github.rentzsch.clicktoflash"];
- NSLog(@"ummmm0");
SparkleManager *sharedSparkleManager = [SparkleManager sharedManager];
NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];
NSString *pathToRelaunch = [sharedWorkspace absolutePathForAppBundleWithIdentifier:[self launchedAppBundleIdentifier]];
[sharedSparkleManager setPathToRelaunch:pathToRelaunch];
[sharedSparkleManager startAutomaticallyCheckingForUpdates];
- NSLog(@"ummmm");
if (![[CTFUserDefaultsController standardUserDefaults] objectForKey:sAutoLoadInvisibleFlashViewsKey]) {
// Default to auto-loading invisible flash views.
[[CTFUserDefaultsController standardUserDefaults] setBool:YES forKey:sAutoLoadInvisibleFlashViewsKey];
@@ -119,7 +117,6 @@ - (id) initWithArguments:(NSDictionary *)arguments
// Default to enable the plugin
[[CTFUserDefaultsController standardUserDefaults] setBool:YES forKey:sPluginEnabled];
}
- NSLog(@"ummmm2");
[self setLaunchedAppBundleIdentifier:[self launchedAppBundleIdentifier]];
[self setWebView:[[[arguments objectForKey:WebPlugInContainerKey] webFrame] webView]];
@@ -384,7 +381,6 @@ - (void)_migratePrefsToExternalFile
unsigned int i;
for (i = 0; i < [parasiticDefaultsNameArray count]; i++) {
NSString *currentParasiticDefault = [parasiticDefaultsNameArray objectAtIndex:i];
- NSLog(@"sending objectForKey: to a CTFUserDefaultsController");
id prefValue = [[NSUserDefaults standardUserDefaults] objectForKey:currentParasiticDefault];
if (prefValue) {
[externalFileDefaults setObject:prefValue forKey:[externalDefaultsNameArray objectAtIndex:i]];
View
2  Plugin/SparkleManager.m
@@ -31,7 +31,7 @@ of this software and associated documentation files (the "Software"), to deal
#import "CTFPreferencesDictionary.h"
// NSUserDefaults keys
-static NSString *sAutomaticallyCheckForUpdates = @"ClickToFlash_checkForUpdatesOnFirstLoad";
+static NSString *sAutomaticallyCheckForUpdates = @"checkForUpdatesOnFirstLoad";
@implementation SparkleManager
Please sign in to comment.
Something went wrong with that request. Please try again.