Browse files

whitelist table now auto-updates when a CtF view adds something to th…

…e whitelist
  • Loading branch information...
1 parent 757f892 commit 555cb353777dc50bc94c5648fa7cf6a61bc815cb Simone Manganelli committed Jun 30, 2009
Showing with 54 additions and 33 deletions.
  1. +16 −1 Plugin/CTFUserDefaultsController.m
  2. +5 −1 Plugin/CTFWhitelist.m
  3. +31 −31 Plugin/English.lproj/WhitelistPanel.xib
  4. +2 −0 Plugin/Plugin.m
View
17 Plugin/CTFUserDefaultsController.m
@@ -38,6 +38,17 @@ - (id)init;
return self;
}
+- (id)initWithCoder:(NSCoder *)decoder;
+{
+ if (! sharedInstance) {
+ if ((self = [super init])) {
+ hasInited = YES;
+ }
+ }
+
+ return self;
+}
+
- (void)dealloc;
{
[userDefaultsDict release];
@@ -50,9 +61,11 @@ - (void)setUpExternalPrefsDictionary;
selector:@selector(pluginDefaultsDidChange:)
name:@"ClickToFlashPluginDefaultsDidChange"
object:nil];
+ [[NSUserDefaults standardUserDefaults] addSuiteNamed:@"com.github.rentzsch.clicktoflash"];
[self setValues:[CTFPreferencesDictionary dictionaryWithDictionary:
[[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.github.rentzsch.clicktoflash"]]
];
+ [[NSUserDefaults standardUserDefaults] removeSuiteNamed:@"com.github.rentzsch.clicktoflash"];
}
- (CTFPreferencesDictionary *)values;
@@ -78,9 +91,11 @@ - (CTFPreferencesDictionary *)dictionaryRepresentation;
- (void)setValues:(CTFPreferencesDictionary *)newUserDefaultsDict;
{
+ CTFPreferencesDictionary *newDictCopy = [newUserDefaultsDict copy];
if (! userDefaultsDict) userDefaultsDict = [[CTFPreferencesDictionary alloc] init];
[userDefaultsDict removeAllObjects];
- [userDefaultsDict addEntriesFromDictionary:newUserDefaultsDict];
+ [userDefaultsDict addEntriesFromDictionary:newDictCopy];
+ [newDictCopy release];
}
- (void)pluginDefaultsDidChange:(NSNotification *)notification;
View
6 Plugin/CTFWhitelist.m
@@ -180,7 +180,11 @@ - (void) _addHostToWhitelist
{
NSMutableArray *siteInfo = [self _mutableSiteInfo];
[siteInfo addObject: whitelistItemForSite([self host])];
- [[CTFUserDefaultsController standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
+
+ [[CTFUserDefaultsController standardUserDefaults] setValue:siteInfo forKeyPath:@"values.siteInfo"];
+ //[values setObject:siteInfo forKey:sHostSiteInfoDefaultsKey];
+ //[[CTFUserDefaultsController standardUserDefaults] setValues:values];
+
[[NSNotificationCenter defaultCenter] postNotificationName: sCTFWhitelistAdditionMade object: self];
}
View
62 Plugin/English.lproj/WhitelistPanel.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="9"/>
+ <integer value="12"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1246,35 +1246,6 @@ dG8gdW5pbnN0YWxsIENsaWNrVG9GbGFzaC4</string>
<int key="connectionID">115</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"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="360546441"/>
- <reference key="NSDestination" ref="258102979"/>
- <string key="NSLabel">value: arrangedObjects.site</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">arrangedObjects.site</string>
- <object class="NSDictionary" key="NSOptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSAllowsEditingMultipleValuesSelection</string>
- <string>NSNullPlaceholder</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="8"/>
- <string>double-click to set</string>
- </object>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">130</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">checkForUpdates:</string>
<reference key="source" ref="1001"/>
@@ -1490,6 +1461,35 @@ dG8gdW5pbnN0YWxsIENsaWNrVG9GbGFzaC4</string>
</object>
<int key="connectionID">251</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"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="360546441"/>
+ <reference key="NSDestination" ref="258102979"/>
+ <string key="NSLabel">value: arrangedObjects.site</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">arrangedObjects.site</string>
+ <object class="NSDictionary" key="NSOptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSAllowsEditingMultipleValuesSelection</string>
+ <string>NSNullPlaceholder</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="6"/>
+ <string>double-click to set</string>
+ </object>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">256</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2461,7 +2461,7 @@ dG8gdW5pbnN0YWxsIENsaWNrVG9GbGFzaC4</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">252</int>
+ <int key="maxID">256</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
View
2 Plugin/Plugin.m
@@ -417,6 +417,7 @@ - (void) _migratePrefsToExternalFile
NSMutableDictionary *externalFileDefaults = [[CTFUserDefaultsController standardUserDefaults] dictionaryRepresentation];
+ [[NSUserDefaults standardUserDefaults] addSuiteNamed:@"com.github.rentzsch.clicktoflash"];
unsigned int i;
for (i = 0; i < [parasiticDefaultsNameArray count]; i++) {
NSString *currentParasiticDefault = [parasiticDefaultsNameArray objectAtIndex:i];
@@ -440,6 +441,7 @@ - (void) _migratePrefsToExternalFile
[[NSUserDefaults standardUserDefaults] removeObjectForKey:currentParasiticDefault];
}
}
+ [[NSUserDefaults standardUserDefaults] removeSuiteNamed:@"com.github.rentzsch.clicktoflash"];
}
- (void) _addApplicationWhitelistArrayToPrefsFile

0 comments on commit 555cb35

Please sign in to comment.