Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

finished external .plist prefs file support; includes code to migrate…

… existing parasitic prefs from com.apple.Safari.plist to the new external file
  • Loading branch information...
commit 39a3ae3522e168e76f97511fa9623eff587d7580 1 parent 4a239f7
Simone Manganelli authored
20 CTFUserDefaultsController.h
View
@@ -1,20 +0,0 @@
-//
-// CTFUserDefaultsController.h
-// ClickToFlash
-//
-// Created by Simone Manganelli on 2009-05-23.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "CTFPreferencesDictionary.h"
-
-
-@interface CTFUserDefaultsController : NSUserDefaultsController {
- CTFPreferencesDictionary *userDefaultsDict;
-}
-
-- (void)pluginDefaultsDidChange:(NSNotification *)notification;
-- (void)setValues:(CTFPreferencesDictionary *)newUserDefaultsDict;
-
-@end
50 CTFUserDefaultsController.m
View
@@ -1,50 +0,0 @@
-//
-// CTFUserDefaultsController.m
-// ClickToFlash
-//
-// Created by Simone Manganelli on 2009-05-23.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
-//
-
-#import "CTFUserDefaultsController.h"
-
-
-@implementation CTFUserDefaultsController
-
-- (void)awakeFromNib;
-{
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(pluginDefaultsDidChange:)
- name:@"ClickToFlashPluginDefaultsDidChange"
- object:nil];
- [self setValues:[CTFPreferencesDictionary dictionaryWithDictionary:
- [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.github.rentzsch.clicktoflash"]]
- ];
-}
-
-- (void)dealloc;
-{
- [userDefaultsDict release];
- [super dealloc];
-}
-
-- (CTFPreferencesDictionary *)values;
-{
- return userDefaultsDict;
-}
-
-- (void)setValues:(CTFPreferencesDictionary *)newUserDefaultsDict;
-{
- if (! userDefaultsDict) userDefaultsDict = [[CTFPreferencesDictionary alloc] init];
- [userDefaultsDict removeAllObjects];
- [userDefaultsDict addEntriesFromDictionary:newUserDefaultsDict];
-}
-
-- (void)pluginDefaultsDidChange:(NSNotification *)notification;
-{
- NSLog(@"Setting persistent domain defaults: %@", userDefaultsDict);
- [[NSUserDefaults standardUserDefaults] setPersistentDomain:userDefaultsDict
- forName:@"com.github.rentzsch.clicktoflash"];
-}
-
-@end
24 ClickToFlash.xcodeproj/project.pbxproj
View
@@ -51,9 +51,9 @@
844695F70F470D1F00DC783A /* CTFsIFRSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 844695910F46FC6600DC783A /* CTFsIFRSupport.m */; };
845704550F4792320017F3F4 /* CTFWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 845704540F4792320017F3F4 /* CTFWhitelist.m */; };
8457045A0F47BC170017F3F4 /* CTFUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 845704590F47BC170017F3F4 /* CTFUtilities.m */; };
- A41626600FCB535300181427 /* CTFPreferencesDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = A416265F0FCB535300181427 /* CTFPreferencesDictionary.m */; };
- A461B6590FC8ECB20028C966 /* CTFUserDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A461B6580FC8ECB20028C966 /* CTFUserDefaultsController.m */; };
A494CC2C0F9F2446007D5EEB /* ctf.icns in Resources */ = {isa = PBXBuildFile; fileRef = A494CC2B0F9F2446007D5EEB /* ctf.icns */; };
+ A4DEFC460FF33D2D00CCB6A8 /* CTFPreferencesDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = A4DEFC430FF33D2D00CCB6A8 /* CTFPreferencesDictionary.m */; };
+ A4DEFC470FF33D2D00CCB6A8 /* CTFUserDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A4DEFC450FF33D2D00CCB6A8 /* CTFUserDefaultsController.m */; };
B5028E930F413553004886D7 /* HarnessAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5028E910F413553004886D7 /* HarnessAppDelegate.m */; };
B5CFF17A0F40EEF1005DB9CC /* WhitelistPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 072189BC0F30D9C3008C8944 /* WhitelistPanel.xib */; };
B5CFF1870F40F000005DB9CC /* HarnessMain.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5CFF1860F40F000005DB9CC /* HarnessMain.xib */; };
@@ -157,11 +157,11 @@
845704540F4792320017F3F4 /* CTFWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFWhitelist.m; path = Plugin/CTFWhitelist.m; sourceTree = "<group>"; };
845704580F47BC170017F3F4 /* CTFUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTFUtilities.h; path = Plugin/CTFUtilities.h; sourceTree = "<group>"; };
845704590F47BC170017F3F4 /* CTFUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFUtilities.m; path = Plugin/CTFUtilities.m; sourceTree = "<group>"; };
- A416265E0FCB535300181427 /* CTFPreferencesDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTFPreferencesDictionary.h; sourceTree = "<group>"; };
- A416265F0FCB535300181427 /* CTFPreferencesDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTFPreferencesDictionary.m; sourceTree = "<group>"; };
- A461B6570FC8ECB20028C966 /* CTFUserDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTFUserDefaultsController.h; sourceTree = "<group>"; };
- A461B6580FC8ECB20028C966 /* CTFUserDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTFUserDefaultsController.m; sourceTree = "<group>"; };
A494CC2B0F9F2446007D5EEB /* ctf.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ctf.icns; sourceTree = "<group>"; };
+ A4DEFC420FF33D2D00CCB6A8 /* CTFPreferencesDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTFPreferencesDictionary.h; path = Plugin/CTFPreferencesDictionary.h; sourceTree = "<group>"; };
+ A4DEFC430FF33D2D00CCB6A8 /* CTFPreferencesDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFPreferencesDictionary.m; path = Plugin/CTFPreferencesDictionary.m; sourceTree = "<group>"; };
+ A4DEFC440FF33D2D00CCB6A8 /* CTFUserDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTFUserDefaultsController.h; path = Plugin/CTFUserDefaultsController.h; sourceTree = "<group>"; };
+ A4DEFC450FF33D2D00CCB6A8 /* CTFUserDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFUserDefaultsController.m; path = Plugin/CTFUserDefaultsController.m; sourceTree = "<group>"; };
B5028E910F413553004886D7 /* HarnessAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HarnessAppDelegate.m; path = "TestFiles/Debugging Harness/HarnessAppDelegate.m"; sourceTree = "<group>"; };
B5028E920F413553004886D7 /* HarnessAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HarnessAppDelegate.h; path = "TestFiles/Debugging Harness/HarnessAppDelegate.h"; sourceTree = "<group>"; };
B5CFF1740F40EEDB005DB9CC /* Whitelist Panel Harness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Whitelist Panel Harness.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -229,10 +229,10 @@
children = (
55EB703D0E04A84F0016593D /* Plugin.m */,
55EB703C0E04A84F0016593D /* Plugin.h */,
- A416265E0FCB535300181427 /* CTFPreferencesDictionary.h */,
- A416265F0FCB535300181427 /* CTFPreferencesDictionary.m */,
- A461B6570FC8ECB20028C966 /* CTFUserDefaultsController.h */,
- A461B6580FC8ECB20028C966 /* CTFUserDefaultsController.m */,
+ A4DEFC420FF33D2D00CCB6A8 /* CTFPreferencesDictionary.h */,
+ A4DEFC430FF33D2D00CCB6A8 /* CTFPreferencesDictionary.m */,
+ A4DEFC440FF33D2D00CCB6A8 /* CTFUserDefaultsController.h */,
+ A4DEFC450FF33D2D00CCB6A8 /* CTFUserDefaultsController.m */,
845704580F47BC170017F3F4 /* CTFUtilities.h */,
845704590F47BC170017F3F4 /* CTFUtilities.m */,
6953E4340F3EDE9D0014ECF7 /* CTFMenubarMenuController.m */,
@@ -468,8 +468,8 @@
8457045A0F47BC170017F3F4 /* CTFUtilities.m in Sources */,
79E2EB930F86AAD3005CF170 /* SparkleManager.m in Sources */,
0038DE240FC0CCF0007B54E9 /* MATrackingArea.m in Sources */,
- A461B6590FC8ECB20028C966 /* CTFUserDefaultsController.m in Sources */,
- A41626600FCB535300181427 /* CTFPreferencesDictionary.m in Sources */,
+ A4DEFC460FF33D2D00CCB6A8 /* CTFPreferencesDictionary.m in Sources */,
+ A4DEFC470FF33D2D00CCB6A8 /* CTFUserDefaultsController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0  CTFPreferencesDictionary.h → Plugin/CTFPreferencesDictionary.h
View
File renamed without changes
6 CTFPreferencesDictionary.m → Plugin/CTFPreferencesDictionary.m
View
@@ -5,6 +5,11 @@
// Created by Simone Manganelli on 2009-05-25.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
+// the rationale for this class is so that we can monitor when
+// defaults change, and update the *external* preference file accordingly.
+// to do so, we need to monitor the mutable dictionary that represents the
+// defaults. this class follows @bbum's suggestion at this URL:
+// http://www.omnigroup.com/mailman/archive/macosx-dev/1999-April/007726.html
#import "CTFPreferencesDictionary.h"
@@ -43,7 +48,6 @@ - (void)dealloc;
- (void)setObject:(id)object forKey:(id)key;
{
[realMutableDictionary setObject:object forKey:key];
- NSLog(@"posting a notification of defaults change");
[[NSNotificationCenter defaultCenter] postNotificationName:@"ClickToFlashPluginDefaultsDidChange" object:self];
}
36 Plugin/CTFUserDefaultsController.h
View
@@ -0,0 +1,36 @@
+//
+// CTFUserDefaultsController.h
+// ClickToFlash
+//
+// Created by Simone Manganelli on 2009-05-23.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "CTFPreferencesDictionary.h"
+
+
+@interface CTFUserDefaultsController : NSUserDefaultsController {
+ CTFPreferencesDictionary *userDefaultsDict;
+ BOOL hasInited;
+}
+
++ (CTFUserDefaultsController *)standardUserDefaults;
+- (void)setUpExternalPrefsDictionary;
+
+- (void)pluginDefaultsDidChange:(NSNotification *)notification;
+- (CTFPreferencesDictionary *)values;
+- (CTFPreferencesDictionary *)dictionaryRepresentation;
+- (void)setValues:(CTFPreferencesDictionary *)newUserDefaultsDict;
+
+- (id)objectForKey:(NSString *)defaultName;
+- (void)setObject:(id)value forKey:(NSString *)defaultName;
+- (int)integerForKey:(NSString *)defaultName;
+- (void)setIntegerForKey:(int)value forKey:(NSString *)defaultName;
+- (BOOL)boolForKey:(NSString *)defaultName;
+- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
+- (NSArray *)arrayForKey:(NSString *)defaultName;
+- (void)removeObjectForKey:(NSString *)defaultName;
+
+
+@end
124 Plugin/CTFUserDefaultsController.m
View
@@ -0,0 +1,124 @@
+//
+// CTFUserDefaultsController.m
+// ClickToFlash
+//
+// Created by Simone Manganelli on 2009-05-23.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "CTFUserDefaultsController.h"
+
+static CTFUserDefaultsController *sharedInstance = nil;
+
+@implementation CTFUserDefaultsController
+
++ (CTFUserDefaultsController *)standardUserDefaults;
+{
+ if (! sharedInstance) sharedInstance = [[self alloc] init];
+ return sharedInstance;
+}
+
+- (id)init;
+{
+ if (! sharedInstance) {
+ if ((self = [super init])) {
+ hasInited = YES;
+ }
+ }
+
+ return self;
+}
+
+- (void)dealloc;
+{
+ [userDefaultsDict release];
+ [super dealloc];
+}
+
+- (void)setUpExternalPrefsDictionary;
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(pluginDefaultsDidChange:)
+ name:@"ClickToFlashPluginDefaultsDidChange"
+ object:nil];
+ [self setValues:[CTFPreferencesDictionary dictionaryWithDictionary:
+ [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.github.rentzsch.clicktoflash"]]
+ ];
+}
+
+- (CTFPreferencesDictionary *)values;
+{
+ // I have no idea why, but -init, -initWithDefaults:initialValues:,
+ // and +sharedUserDefaultsController all never seem to get called. Only
+ // -awakeFromNib gets called, and that's too late for bindings;
+
+ // so instead, we just wait for the initial call to access 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];
+ return userDefaultsDict;
+}
+
+- (CTFPreferencesDictionary *)dictionaryRepresentation;
+{
+ return [self values];
+}
+
+- (void)setValues:(CTFPreferencesDictionary *)newUserDefaultsDict;
+{
+ if (! userDefaultsDict) userDefaultsDict = [[CTFPreferencesDictionary alloc] init];
+ [userDefaultsDict removeAllObjects];
+ [userDefaultsDict addEntriesFromDictionary:newUserDefaultsDict];
+}
+
+- (void)pluginDefaultsDidChange:(NSNotification *)notification;
+{
+ [[NSUserDefaults standardUserDefaults] setPersistentDomain:userDefaultsDict
+ forName:@"com.github.rentzsch.clicktoflash"];
+}
+
+- (id)objectForKey:(NSString *)defaultName;
+{
+ return [[self values] objectForKey:defaultName];
+}
+
+- (void)setObject:(id)value forKey:(NSString *)defaultName;
+{
+ [[self values] setObject:value forKey:defaultName];
+}
+
+- (int)integerForKey:(NSString *)defaultName;
+{
+ return [[[self values] objectForKey:defaultName] intValue];
+}
+
+- (void)setIntegerForKey:(int)value forKey:(NSString *)defaultName;
+{
+ [[self values] setObject:[NSNumber numberWithInt:value] forKey:defaultName];
+}
+
+- (BOOL)boolForKey:(NSString *)defaultName;
+{
+ return [[[self values] objectForKey:defaultName] boolValue];
+}
+
+- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
+{
+ [[self values] setObject:[NSNumber numberWithBool:value] forKey:defaultName];
+}
+
+- (NSArray *)arrayForKey:(NSString *)defaultName;
+{
+ id value = [[self values] objectForKey:defaultName];
+ id valueToReturn = nil;
+ if ([[value className] isEqualToString:@"NSCFArray"]) valueToReturn = value;
+ return valueToReturn;
+}
+
+- (void)removeObjectForKey:(NSString *)defaultName;
+{
+ [[self values] removeObjectForKey:defaultName];
+}
+
+@end
13 Plugin/CTFWhitelist.m
View
@@ -29,11 +29,14 @@ of this software and associated documentation files (the "Software"), to deal
#import "CTFUtilities.h"
#import "CTFMenubarMenuController.h"
+#import "CTFUserDefaultsController.h"
+#import "CTFPreferencesDictionary.h"
+
// NSNotification names
static NSString *sCTFWhitelistAdditionMade = @"CTFWhitelistAdditionMade";
- // NSUserDefaults keys
+ // CTFUserDefaultsController keys
static NSString *sHostSiteInfoDefaultsKey = @"ClickToFlash_siteInfo";
typedef enum {
@@ -160,13 +163,13 @@ - (BOOL) _isHostWhitelisted
- (BOOL) _isWhiteListedForHostString:(NSString *)hostString
{
- NSArray *hostWhitelist = [[NSUserDefaults standardUserDefaults] arrayForKey: sHostSiteInfoDefaultsKey];
+ NSArray *hostWhitelist = [[CTFUserDefaultsController standardUserDefaults] arrayForKey: sHostSiteInfoDefaultsKey];
return hostWhitelist && itemForSite(hostWhitelist, hostString) != nil;
}
- (NSMutableArray *) _mutableSiteInfo
{
- NSMutableArray *hostWhitelist = [[[[NSUserDefaults standardUserDefaults] arrayForKey: sHostSiteInfoDefaultsKey] mutableCopy] autorelease];
+ NSMutableArray *hostWhitelist = [[[[CTFUserDefaultsController standardUserDefaults] arrayForKey: sHostSiteInfoDefaultsKey] mutableCopy] autorelease];
if (hostWhitelist == nil) {
hostWhitelist = [NSMutableArray array];
}
@@ -177,7 +180,7 @@ - (void) _addHostToWhitelist
{
NSMutableArray *siteInfo = [self _mutableSiteInfo];
[siteInfo addObject: whitelistItemForSite([self host])];
- [[NSUserDefaults standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
+ [[CTFUserDefaultsController standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
[[NSNotificationCenter defaultCenter] postNotificationName: sCTFWhitelistAdditionMade object: self];
}
@@ -188,7 +191,7 @@ - (void) _removeHostFromWhitelist
if(foundIndex != NSNotFound) {
[siteInfo removeObjectAtIndex: foundIndex];
- [[NSUserDefaults standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
+ [[CTFUserDefaultsController standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
}
}
7 Plugin/CTFsIFRSupport.m
View
@@ -26,6 +26,9 @@ of this software and associated documentation files (the "Software"), to deal
#import "CTFsIFRSupport.h"
+#import "CTFUserDefaultsController.h"
+#import "CTFPreferencesDictionary.h"
+
typedef enum {
CTFSifrModeDoNothing = 0,
CTFSifrModeAutoLoadSifr = 1,
@@ -61,7 +64,7 @@ - (NSUInteger) _sifrVersionInstalled
- (BOOL) _shouldDeSIFR
{
- if ([[NSUserDefaults standardUserDefaults] integerForKey: sSifrModeDefaultsKey] == CTFSifrModeDeSifr) {
+ if ([[CTFUserDefaultsController standardUserDefaults] integerForKey: sSifrModeDefaultsKey] == CTFSifrModeDeSifr) {
_sifrVersion = [self _sifrVersionInstalled];
if( _sifrVersion != 0 )
@@ -73,7 +76,7 @@ - (BOOL) _shouldDeSIFR
- (BOOL) _shouldAutoLoadSIFR
{
- return [[NSUserDefaults standardUserDefaults] integerForKey: sSifrModeDefaultsKey] == CTFSifrModeAutoLoadSifr;
+ return [[CTFUserDefaultsController standardUserDefaults] integerForKey: sSifrModeDefaultsKey] == CTFSifrModeAutoLoadSifr;
}
- (void) _disableSIFR
215 Plugin/English.lproj/WhitelistPanel.xib
View
@@ -8,7 +8,6 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="42"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -65,12 +64,14 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{485, 151}</string>
<reference key="NSSuperview" ref="769633510"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="936086174">
<reference key="NSNextResponder" ref="981752289"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{485, 17}</string>
<reference key="NSSuperview" ref="981752289"/>
+ <reference key="NSWindow"/>
<reference key="NSTableView" ref="863640153"/>
</object>
<object class="_NSCornerView" key="NSCornerView" id="929019191">
@@ -78,6 +79,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-26, 0}, {16, 17}}</string>
<reference key="NSSuperview" ref="510641939"/>
+ <reference key="NSWindow"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -163,6 +165,7 @@
</object>
<string key="NSFrame">{{1, 17}, {485, 151}}</string>
<reference key="NSSuperview" ref="510641939"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="863640153"/>
<reference key="NSDocView" ref="863640153"/>
<reference key="NSBGColor" ref="293857357"/>
@@ -173,6 +176,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{471, 17}, {15, 152}}</string>
<reference key="NSSuperview" ref="510641939"/>
+ <reference key="NSWindow"/>
<reference key="NSTarget" ref="510641939"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">3.700000e+01</double>
@@ -183,6 +187,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {450, 15}}</string>
<reference key="NSSuperview" ref="510641939"/>
+ <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="510641939"/>
<string key="NSAction">_doScroller:</string>
@@ -197,6 +202,7 @@
</object>
<string key="NSFrame">{{1, 0}, {485, 17}}</string>
<reference key="NSSuperview" ref="510641939"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="936086174"/>
<reference key="NSDocView" ref="936086174"/>
<reference key="NSBGColor" ref="293857357"/>
@@ -206,6 +212,7 @@
</object>
<string key="NSFrame">{{20, 58}, {487, 169}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="769633510"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="839140272"/>
@@ -220,6 +227,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{48, 30}, {29, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="13544439">
<int key="NSCellFlags">67239424</int>
@@ -244,6 +252,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 30}, {29, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="811527510">
<int key="NSCellFlags">67239424</int>
@@ -264,6 +273,7 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{227, 31}, {283, 17}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="363160467">
<int key="NSCellFlags">67239424</int>
@@ -290,6 +300,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{93, 149}, {286, 18}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="356052318">
<int key="NSCellFlags">-2080244224</int>
@@ -321,6 +332,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{93, 129}, {286, 18}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="688316371">
<int key="NSCellFlags">-2080244224</int>
@@ -343,6 +355,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 170}, {67, 17}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1061234246">
<int key="NSCellFlags">68288064</int>
@@ -359,6 +372,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{93, 58}, {285, 58}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<int key="NSNumRows">3</int>
<int key="NSNumCols">1</int>
@@ -630,6 +644,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 99}, {67, 17}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="393278813">
<int key="NSCellFlags">68288064</int>
@@ -646,6 +661,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 28}, {67, 17}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="345893571">
<int key="NSCellFlags">68288064</int>
@@ -662,6 +678,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{93, 27}, {287, 18}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="548281549">
<int key="NSCellFlags">-2080244224</int>
@@ -684,6 +701,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{117, -3}, {86, 28}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="613643996">
<int key="NSCellFlags">67239424</int>
@@ -704,6 +722,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{93, 169}, {286, 18}}</string>
<reference key="NSSuperview" ref="235344690"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="410759951">
<int key="NSCellFlags">-2080244224</int>
@@ -724,6 +743,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<string key="NSFrame">{{65, 235}, {397, 207}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSTextField" id="710573940">
@@ -731,6 +751,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{471, 9}, {39, 14}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="358695226">
<int key="NSCellFlags">68288064</int>
@@ -745,6 +766,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<string key="NSFrameSize">{527, 438}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{420, 372}</string>
@@ -770,6 +792,15 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSUserDefaultsController" id="961452516">
+ <object class="NSMutableArray" key="NSDeclaredKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>pluginEnabled</string>
+ <string>useYouTubeH264</string>
+ <string>autoLoadInvisibleViews</string>
+ <string>sifrMode</string>
+ <string>checkForUpdatesOnFirstLoad</string>
+ <string>siteInfo</string>
+ </object>
<bool key="NSAppliesImmediately">YES</bool>
</object>
</object>
@@ -809,38 +840,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.ClickToFlash_useYouTubeH264</string>
- <reference key="source" ref="619486495"/>
- <reference key="destination" ref="913882380"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="619486495"/>
- <reference key="NSDestination" ref="913882380"/>
- <string key="NSLabel">value: values.ClickToFlash_useYouTubeH264</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.ClickToFlash_useYouTubeH264</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">48</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">selectedTag: values.ClickToFlash_sifrMode</string>
- <reference key="source" ref="211748724"/>
- <reference key="destination" ref="913882380"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="211748724"/>
- <reference key="NSDestination" ref="913882380"/>
- <string key="NSLabel">selectedTag: values.ClickToFlash_sifrMode</string>
- <string key="NSBinding">selectedTag</string>
- <string key="NSKeyPath">values.ClickToFlash_sifrMode</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">112</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">add:</string>
<reference key="source" ref="258102979"/>
@@ -850,26 +849,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">contentArray: values.ClickToFlash_siteInfo</string>
- <reference key="source" ref="258102979"/>
- <reference key="destination" ref="913882380"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="258102979"/>
- <reference key="NSDestination" ref="913882380"/>
- <string key="NSLabel">contentArray: values.ClickToFlash_siteInfo</string>
- <string key="NSBinding">contentArray</string>
- <string key="NSKeyPath">values.ClickToFlash_siteInfo</string>
- <object class="NSDictionary" key="NSOptions">
- <string key="NS.key.0">NSHandlesContentAsCompoundValue</string>
- <integer value="1" key="NS.object.0" id="5"/>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">127</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
<string key="label">value: arrangedObjects.site</string>
<reference key="source" ref="360546441"/>
<reference key="destination" ref="258102979"/>
@@ -898,22 +877,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="connectionID">130</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.ClickToFlash_autoLoadInvisibleViews</string>
- <reference key="source" ref="90714319"/>
- <reference key="destination" ref="913882380"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="90714319"/>
- <reference key="NSDestination" ref="913882380"/>
- <string key="NSLabel">value: values.ClickToFlash_autoLoadInvisibleViews</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.ClickToFlash_autoLoadInvisibleViews</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">136</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">checkForUpdates:</string>
<reference key="source" ref="1001"/>
@@ -922,22 +885,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="connectionID">146</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.ClickToFlash_checkForUpdatesOnFirstLoad</string>
- <reference key="source" ref="124868638"/>
- <reference key="destination" ref="913882380"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="124868638"/>
- <reference key="NSDestination" ref="913882380"/>
- <string key="NSLabel">value: values.ClickToFlash_checkForUpdatesOnFirstLoad</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.ClickToFlash_checkForUpdatesOnFirstLoad</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">147</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_checkNowButton</string>
<reference key="source" ref="1001"/>
@@ -967,19 +914,103 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">value: values.ClickToFlash_pluginEnabled</string>
+ <string key="label">value: values.pluginEnabled</string>
<reference key="source" ref="596693856"/>
<reference key="destination" ref="961452516"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="596693856"/>
<reference key="NSDestination" ref="961452516"/>
- <string key="NSLabel">value: values.ClickToFlash_pluginEnabled</string>
+ <string key="NSLabel">value: values.pluginEnabled</string>
<string key="NSBinding">value</string>
- <string key="NSKeyPath">values.ClickToFlash_pluginEnabled</string>
+ <string key="NSKeyPath">values.pluginEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">178</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.useYouTubeH264</string>
+ <reference key="source" ref="619486495"/>
+ <reference key="destination" ref="961452516"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="619486495"/>
+ <reference key="NSDestination" ref="961452516"/>
+ <string key="NSLabel">value: values.useYouTubeH264</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.useYouTubeH264</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">179</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.autoLoadInvisibleViews</string>
+ <reference key="source" ref="90714319"/>
+ <reference key="destination" ref="961452516"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="90714319"/>
+ <reference key="NSDestination" ref="961452516"/>
+ <string key="NSLabel">value: values.autoLoadInvisibleViews</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.autoLoadInvisibleViews</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">180</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">selectedTag: values.sifrMode</string>
+ <reference key="source" ref="211748724"/>
+ <reference key="destination" ref="961452516"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="211748724"/>
+ <reference key="NSDestination" ref="961452516"/>
+ <string key="NSLabel">selectedTag: values.sifrMode</string>
+ <string key="NSBinding">selectedTag</string>
+ <string key="NSKeyPath">values.sifrMode</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">181</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.checkForUpdatesOnFirstLoad</string>
+ <reference key="source" ref="124868638"/>
+ <reference key="destination" ref="961452516"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="124868638"/>
+ <reference key="NSDestination" ref="961452516"/>
+ <string key="NSLabel">value: values.checkForUpdatesOnFirstLoad</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.checkForUpdatesOnFirstLoad</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">182</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">contentArray: values.siteInfo</string>
+ <reference key="source" ref="258102979"/>
+ <reference key="destination" ref="961452516"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="258102979"/>
+ <reference key="NSDestination" ref="961452516"/>
+ <string key="NSLabel">contentArray: values.siteInfo</string>
+ <string key="NSBinding">contentArray</string>
+ <string key="NSKeyPath">values.siteInfo</string>
+ <object class="NSDictionary" key="NSOptions">
+ <string key="NS.key.0">NSHandlesContentAsCompoundValue</string>
+ <boolean value="YES" key="NS.object.0"/>
+ </object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
- <int key="connectionID">171</int>
+ <int key="connectionID">183</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -1393,10 +1424,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="8"/>
<string>{{40, 279}, {527, 438}}</string>
- <reference ref="5"/>
+ <integer value="1" id="9"/>
<string>{196, 240}</string>
<string>{{202, 428}, {480, 270}}</string>
- <reference ref="5"/>
+ <reference ref="9"/>
<string>{420, 350}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
@@ -1516,7 +1547,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">172</int>
+ <int key="maxID">183</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
1  Plugin/Plugin.h
View
@@ -52,6 +52,7 @@ THE SOFTWARE.
+ (NSView *)plugInViewWithArguments:(NSDictionary *)arguments;
- (id) initWithArguments:(NSDictionary *)arguments;
+- (void)_migratePrefsToExternalFile;
- (DOMElement *)container;
- (void)setContainer:(DOMElement *)newValue;
67 Plugin/Plugin.m
View
@@ -25,6 +25,8 @@ of this software and associated documentation files (the "Software"), to deal
*/
#import "Plugin.h"
+#import "CTFUserDefaultsController.h"
+#import "CTFPreferencesDictionary.h"
#import "MATrackingArea.h"
#import "CTFMenubarMenuController.h"
@@ -40,10 +42,10 @@ of this software and associated documentation files (the "Software"), to deal
static NSString *sFlashOldMIMEType = @"application/x-shockwave-flash";
static NSString *sFlashNewMIMEType = @"application/futuresplash";
- // NSUserDefaults keys
-static NSString *sUseYouTubeH264DefaultsKey = @"ClickToFlash_useYouTubeH264";
-static NSString *sAutoLoadInvisibleFlashViewsKey = @"ClickToFlash_autoLoadInvisibleViews";
-static NSString *sPluginEnabled = @"ClickToFlash_pluginEnabled";
+ // CTFUserDefaultsController keys
+static NSString *sUseYouTubeH264DefaultsKey = @"useYouTubeH264";
+static NSString *sAutoLoadInvisibleFlashViewsKey = @"autoLoadInvisibleViews";
+static NSString *sPluginEnabled = @"pluginEnabled";
BOOL usingMATrackingArea = NO;
@@ -100,24 +102,24 @@ + (NSView *)plugInViewWithArguments:(NSDictionary *)arguments
- (id) initWithArguments:(NSDictionary *)arguments
{
self = [super init];
- if (self) {
+ 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];
-
- if (![[NSUserDefaults standardUserDefaults] objectForKey:sAutoLoadInvisibleFlashViewsKey]) {
+ NSLog(@"ummmm");
+ if (![[CTFUserDefaultsController standardUserDefaults] objectForKey:sAutoLoadInvisibleFlashViewsKey]) {
// Default to auto-loading invisible flash views.
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:sAutoLoadInvisibleFlashViewsKey];
+ [[CTFUserDefaultsController standardUserDefaults] setBool:YES forKey:sAutoLoadInvisibleFlashViewsKey];
}
- if (![[NSUserDefaults standardUserDefaults] objectForKey:sPluginEnabled]) {
+ if (![[CTFUserDefaultsController standardUserDefaults] objectForKey:sPluginEnabled]) {
// Default to enable the plugin
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:sPluginEnabled];
+ [[CTFUserDefaultsController standardUserDefaults] setBool:YES forKey:sPluginEnabled];
}
-
+ NSLog(@"ummmm2");
[self setLaunchedAppBundleIdentifier:[self launchedAppBundleIdentifier]];
[self setWebView:[[[arguments objectForKey:WebPlugInContainerKey] webFrame] webView]];
@@ -125,6 +127,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
[self setContainer:[arguments objectForKey:WebPlugInContainingElementKey]];
[self _migrateWhitelist];
+ [self _migratePrefsToExternalFile];
// Get URL
@@ -189,7 +192,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
// check whether plugin is disabled, load all content as normal if so
- if ( ![ [ NSUserDefaults standardUserDefaults ] boolForKey: sPluginEnabled ] ) {
+ if ( ![ [ CTFUserDefaultsController standardUserDefaults ] boolForKey: sPluginEnabled ] ) {
_isLoadingFromWhitelist = YES;
[self _convertTypesForContainer];
return self;
@@ -218,7 +221,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
}
}
- if ( [ [ NSUserDefaults standardUserDefaults ] boolForKey: sAutoLoadInvisibleFlashViewsKey ]
+ if ( [ [ CTFUserDefaultsController standardUserDefaults ] boolForKey: sAutoLoadInvisibleFlashViewsKey ]
&& [ self isConsideredInvisible ] ) {
// auto-loading is on and this view meets the size constraints
_isLoadingFromWhitelist = YES;
@@ -358,6 +361,38 @@ - (void) dealloc
[super dealloc];
}
+- (void)_migratePrefsToExternalFile
+{
+ NSArray *parasiticDefaultsNameArray = [NSArray arrayWithObjects:@"ClickToFlash_pluginEnabled",
+ @"ClickToFlash_useYouTubeH264",
+ @"ClickToFlash_autoLoadInvisibleViews",
+ @"ClickToFlash_sifrMode",
+ @"ClickToFlash_checkForUpdatesOnFirstLoad",
+ @"ClickToFlash_siteInfo",
+ nil];
+
+ NSArray *externalDefaultsNameArray = [NSArray arrayWithObjects:@"pluginEnabled",
+ @"useYouTubeH264",
+ @"autoLoadInvisibleViews",
+ @"sifrMode",
+ @"checkForUpdatesOnFirstLoad",
+ @"siteInfo",
+ nil];
+
+ NSMutableDictionary *externalFileDefaults = [[CTFUserDefaultsController standardUserDefaults] dictionaryRepresentation];
+
+ 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]];
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:currentParasiticDefault];
+ }
+ }
+}
+
- (void) drawRect:(NSRect)rect
{
if(!_isLoadingFromWhitelist)
@@ -896,8 +931,8 @@ - (BOOL) _hasH264Version
- (BOOL) _useH264Version
{
return [ self _hasH264Version ]
- && [ [ NSUserDefaults standardUserDefaults ] boolForKey: sUseYouTubeH264DefaultsKey ]
- && [ [ NSUserDefaults standardUserDefaults ] boolForKey: sPluginEnabled ];
+ && [ [ CTFUserDefaultsController standardUserDefaults ] boolForKey: sUseYouTubeH264DefaultsKey ]
+ && [ [ CTFUserDefaultsController standardUserDefaults ] boolForKey: sPluginEnabled ];
}
- (void) _convertElementForMP4: (DOMElement*) element
9 SparkleManager.m
View
@@ -27,6 +27,9 @@ of this software and associated documentation files (the "Software"), to deal
#import "SparkleManager.h"
#import <Sparkle/Sparkle.h>
+#import "CTFUserDefaultsController.h"
+#import "CTFPreferencesDictionary.h"
+
// NSUserDefaults keys
static NSString *sAutomaticallyCheckForUpdates = @"ClickToFlash_checkForUpdatesOnFirstLoad";
@@ -99,11 +102,11 @@ - (SUUpdater*)_updater {
}
- (void)startAutomaticallyCheckingForUpdates {
- if (![[NSUserDefaults standardUserDefaults] objectForKey:sAutomaticallyCheckForUpdates]) {
+ if (![[CTFUserDefaultsController standardUserDefaults] objectForKey:sAutomaticallyCheckForUpdates]) {
// If the key isn't set yet, default to YES, automatically check for updates.
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:sAutomaticallyCheckForUpdates];
+ [[CTFUserDefaultsController standardUserDefaults] setBool:YES forKey:sAutomaticallyCheckForUpdates];
}
- if ([[NSUserDefaults standardUserDefaults] boolForKey:sAutomaticallyCheckForUpdates]) {
+ if ([[CTFUserDefaultsController standardUserDefaults] boolForKey:sAutomaticallyCheckForUpdates]) {
static BOOL checkedForUpdate = NO;
if (!checkedForUpdate) {
checkedForUpdate = YES;
Please sign in to comment.
Something went wrong with that request. Please try again.