From 506c049859d0aa78896e0ebcda2aaf1abab7a934 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Sun, 19 Jul 2009 15:39:51 -0500 Subject: [PATCH] [FIX] Delete unused "Remove from Whitelist..." contextual menu item. bug 79. --- Plugin/CTFWhitelist.h | 1 - Plugin/CTFWhitelist.m | 45 ------------------------- Plugin/English.lproj/ContextualMenu.xib | 27 ++------------- Plugin/Plugin.m | 5 --- 4 files changed, 2 insertions(+), 76 deletions(-) diff --git a/Plugin/CTFWhitelist.h b/Plugin/CTFWhitelist.h index 68152802..273adab4 100644 --- a/Plugin/CTFWhitelist.h +++ b/Plugin/CTFWhitelist.h @@ -31,7 +31,6 @@ THE SOFTWARE. @interface CTFClickToFlashPlugin( Whitelist ) - (IBAction) addToWhitelist: (id) sender; -- (IBAction) removeFromWhitelist: (id) sender; - (IBAction) editWhitelist: (id) sender; - (void) _migrateWhitelist; diff --git a/Plugin/CTFWhitelist.m b/Plugin/CTFWhitelist.m index 65995ecf..dc74696c 100644 --- a/Plugin/CTFWhitelist.m +++ b/Plugin/CTFWhitelist.m @@ -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]) @@ -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 ]; diff --git a/Plugin/English.lproj/ContextualMenu.xib b/Plugin/English.lproj/ContextualMenu.xib index 37f1fd19..7225fb2e 100755 --- a/Plugin/English.lproj/ContextualMenu.xib +++ b/Plugin/English.lproj/ContextualMenu.xib @@ -8,6 +8,7 @@ 353.00 YES + YES @@ -78,14 +79,6 @@ - - - Remove from Whitelist... - - 2147483647 - - - YES @@ -134,14 +127,6 @@ 11 - - - removeFromWhitelist: - - - - 13 - addToWhitelist: @@ -195,7 +180,6 @@ YES - @@ -213,11 +197,6 @@ - - 12 - - - 14 @@ -250,7 +229,6 @@ 1.IBEditorWindowLastContentRect 1.IBPluginDependency 10.IBPluginDependency - 12.IBPluginDependency 14.IBPluginDependency 16.IBPluginDependency 19.IBPluginDependency @@ -262,8 +240,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{371, 315}, {222, 123}} - com.apple.InterfaceBuilder.CocoaPlugin + {{371, 335}, {213, 103}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index ddfc9b64..986c4111 100755 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -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; }