Skip to content

Commit

Permalink
[FIX] Delete unused "Remove from Whitelist..." contextual menu item. …
Browse files Browse the repository at this point in the history
…bug 79.
  • Loading branch information
rentzsch committed Jul 19, 2009
1 parent b751ddd commit 506c049
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 76 deletions.
1 change: 0 additions & 1 deletion Plugin/CTFWhitelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE.
@interface CTFClickToFlashPlugin( Whitelist )

- (IBAction) addToWhitelist: (id) sender;
- (IBAction) removeFromWhitelist: (id) sender;
- (IBAction) editWhitelist: (id) sender;

- (void) _migrateWhitelist;
Expand Down
45 changes: 0 additions & 45 deletions Plugin/CTFWhitelist.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,10 @@ - (void) _addHostToWhitelist
[siteInfo addObject: whitelistItemForSite([self host])];

[[CTFUserDefaultsController standardUserDefaults] setValue:siteInfo forKeyPath:@"values.siteInfo"];
//[values setObject:siteInfo forKey:sHostSiteInfoDefaultsKey];
//[[CTFUserDefaultsController standardUserDefaults] setValues:values];

[[NSNotificationCenter defaultCenter] postNotificationName: sCTFWhitelistAdditionMade object: self];
}

- (void) _removeHostFromWhitelist
{
NSMutableArray *siteInfo = [self _mutableSiteInfo];
NSUInteger foundIndex = indexOfItemForSite(siteInfo, [self host]);

if(foundIndex != NSNotFound) {
[siteInfo removeObjectAtIndex: foundIndex];
[[CTFUserDefaultsController standardUserDefaults] setObject: siteInfo forKey: sHostSiteInfoDefaultsKey];
}
}

- (void) _whitelistAdditionMade: (NSNotification*) notification
{
if ([self _isHostWhitelisted])
Expand All @@ -213,38 +200,6 @@ - (IBAction)addToWhitelist:(id)sender;
[self _addHostToWhitelist];
}

- (IBAction) removeFromWhitelist: (id)sender
{
assert(0);
if (![self _isHostWhitelisted])
return;

NSString *title = NSLocalizedString(@"Stop always loading Flash?", @"Stop always loading Flash? alert title");
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Remove %@ from the whitelist?", @"Remove %@ from the whitelist? alert message"), [self host]];

NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:NSLocalizedString(@"Remove from Whitelist", @"Remove from Whitelist button")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel button")];
[alert setMessageText:title];
[alert setInformativeText:message];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert beginSheetModalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(_removeFromWhitelistAlertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
_activeAlert = alert;
}

- (void) _removeFromWhitelistAlertDidEnd: (NSAlert *)alert returnCode: (int)returnCode contextInfo: (void *)contextInfo
{
if (returnCode == NSAlertFirstButtonReturn)
{
[self _removeHostFromWhitelist];
}

[ self _alertDone ];
}

- (IBAction) editWhitelist: (id)sender;
{
[ [ CTFMenubarMenuController sharedController ] showSettingsWindow: self ];
Expand Down
27 changes: 2 additions & 25 deletions Plugin/English.lproj/ContextualMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -78,14 +79,6 @@
<reference key="NSOnImage" ref="121969399"/>
<reference key="NSMixedImage" ref="575759592"/>
</object>
<object class="NSMenuItem" id="660793203">
<reference key="NSMenu" ref="93442052"/>
<string key="NSTitle">Remove from Whitelist...</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="121969399"/>
<reference key="NSMixedImage" ref="575759592"/>
</object>
<object class="NSMenuItem" id="380486120">
<reference key="NSMenu" ref="93442052"/>
<bool key="NSIsDisabled">YES</bool>
Expand Down Expand Up @@ -134,14 +127,6 @@
</object>
<int key="connectionID">11</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">removeFromWhitelist:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="660793203"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">addToWhitelist:</string>
Expand Down Expand Up @@ -195,7 +180,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="831790790"/>
<reference ref="975793511"/>
<reference ref="660793203"/>
<reference ref="1001518375"/>
<reference ref="688689086"/>
<reference ref="380486120"/>
Expand All @@ -213,11 +197,6 @@
<reference key="object" ref="975793511"/>
<reference key="parent" ref="93442052"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="660793203"/>
<reference key="parent" ref="93442052"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="1001518375"/>
Expand Down Expand Up @@ -250,7 +229,6 @@
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
Expand All @@ -262,8 +240,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilderKit</string>
<string>com.apple.InterfaceBuilderKit</string>
<string>{{371, 315}, {222, 123}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{371, 335}, {213, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand Down
5 changes: 0 additions & 5 deletions Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,6 @@ - (BOOL) validateMenuItem: (NSMenuItem *)menuItem
if ([self _isHostWhitelisted])
enabled = NO;
}
else if (action == @selector(removeFromWhitelist:))
{
if (![self _isHostWhitelisted])
enabled = NO;
}

return enabled;
}
Expand Down

0 comments on commit 506c049

Please sign in to comment.