From d193a728c32af21345af083cc4a22c7a26c97f42 Mon Sep 17 00:00:00 2001 From: Ben Gottlieb Date: Tue, 10 Feb 2009 12:17:10 +0800 Subject: [PATCH] committed all modified files, not just new ones Signed-off-by: Jonathan 'Wolf' Rentzsch --- ClickToFlash.xcodeproj/project.pbxproj | 126 ++++++++++ Plugin/CTFWhitelistWindowController.h | 9 +- Plugin/CTFWhitelistWindowController.m | 57 ++++- Plugin/English.lproj/WhitelistPanel.xib | 292 ++++++++++++++---------- Plugin/Plugin.m | 4 +- 5 files changed, 366 insertions(+), 122 deletions(-) diff --git a/ClickToFlash.xcodeproj/project.pbxproj b/ClickToFlash.xcodeproj/project.pbxproj index ed546777..cb045620 100644 --- a/ClickToFlash.xcodeproj/project.pbxproj +++ b/ClickToFlash.xcodeproj/project.pbxproj @@ -49,6 +49,11 @@ 6953E43C0F3EDEB50014ECF7 /* MenubarMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6953E43A0F3EDEB50014ECF7 /* MenubarMenu.xib */; }; 69A26D0C0F302C10006648BC /* NSBezierPath-RoundedRectangle.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A26D0B0F302C10006648BC /* NSBezierPath-RoundedRectangle.m */; }; 79A21C4D0F30B735009424B8 /* CTFWhitelistWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79A21C490F30B735009424B8 /* CTFWhitelistWindowController.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 */; }; + B5CFF18A0F40F013005DB9CC /* CTFWhitelistWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79A21C490F30B735009424B8 /* CTFWhitelistWindowController.m */; }; + B5CFF1AE0F40F070005DB9CC /* HarnessMain.m in Sources */ = {isa = PBXBuildFile; fileRef = B5CFF1AD0F40F070005DB9CC /* HarnessMain.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -104,6 +109,12 @@ 69A26D0B0F302C10006648BC /* NSBezierPath-RoundedRectangle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBezierPath-RoundedRectangle.m"; path = "Plugin/NSBezierPath-RoundedRectangle.m"; sourceTree = ""; }; 79A21C490F30B735009424B8 /* CTFWhitelistWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFWhitelistWindowController.m; path = Plugin/CTFWhitelistWindowController.m; sourceTree = ""; }; 79A21C4A0F30B735009424B8 /* CTFWhitelistWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTFWhitelistWindowController.h; path = Plugin/CTFWhitelistWindowController.h; sourceTree = ""; }; + B5028E910F413553004886D7 /* HarnessAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HarnessAppDelegate.m; path = "TestFiles/Debugging Harness/HarnessAppDelegate.m"; sourceTree = ""; }; + B5028E920F413553004886D7 /* HarnessAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HarnessAppDelegate.h; path = "TestFiles/Debugging Harness/HarnessAppDelegate.h"; sourceTree = ""; }; + B5CFF1740F40EEDB005DB9CC /* Whitelist Panel Harness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Whitelist Panel Harness.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + B5CFF1860F40F000005DB9CC /* HarnessMain.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = HarnessMain.xib; path = "TestFiles/Debugging Harness/HarnessMain.xib"; sourceTree = ""; }; + B5CFF1AB0F40F064005DB9CC /* Harness-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Harness-Info.plist"; path = "TestFiles/Debugging Harness/Harness-Info.plist"; sourceTree = ""; }; + B5CFF1AD0F40F070005DB9CC /* HarnessMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HarnessMain.m; path = "TestFiles/Debugging Harness/HarnessMain.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -124,6 +135,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B5CFF1720F40EEDB005DB9CC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -142,6 +160,7 @@ 55EB70300E04A8410016593D = { isa = PBXGroup; children = ( + B5CFF1810F40EF98005DB9CC /* Debugging Harness */, 55EB70540E04A89C0016593D /* Plugin */, 558405520E0F2C2200EA991B /* Installer */, 55EB70550E04A8A40016593D /* Frameworks */, @@ -154,6 +173,7 @@ children = ( 55EB70420E04A8640016593D /* ClickToFlash.plugin */, 558405610E0F2DE900EA991B /* Install ClickToFlash.app */, + B5CFF1740F40EEDB005DB9CC /* Whitelist Panel Harness.app */, ); name = Products; sourceTree = ""; @@ -186,6 +206,18 @@ name = Frameworks; sourceTree = ""; }; + B5CFF1810F40EF98005DB9CC /* Debugging Harness */ = { + isa = PBXGroup; + children = ( + B5CFF1AD0F40F070005DB9CC /* HarnessMain.m */, + B5CFF1AB0F40F064005DB9CC /* Harness-Info.plist */, + B5CFF1860F40F000005DB9CC /* HarnessMain.xib */, + B5028E910F413553004886D7 /* HarnessAppDelegate.m */, + B5028E920F413553004886D7 /* HarnessAppDelegate.h */, + ); + name = "Debugging Harness"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -224,6 +256,23 @@ productReference = 55EB70420E04A8640016593D /* ClickToFlash.plugin */; productType = "com.apple.product-type.bundle"; }; + B5CFF1730F40EEDB005DB9CC /* Whitelist Panel Harness */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5CFF1790F40EEDC005DB9CC /* Build configuration list for PBXNativeTarget "Whitelist Panel Harness" */; + buildPhases = ( + B5CFF1700F40EEDB005DB9CC /* Resources */, + B5CFF1710F40EEDB005DB9CC /* Sources */, + B5CFF1720F40EEDB005DB9CC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Whitelist Panel Harness"; + productName = "Whitelist Panel Harness"; + productReference = B5CFF1740F40EEDB005DB9CC /* Whitelist Panel Harness.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -241,6 +290,7 @@ 558405600E0F2DE900EA991B /* Install ClickToFlash */, 5584067D0E0F371E00EA991B /* Create Zip */, 2B9260570F36854B000F1583 /* Install plugin for user */, + B5CFF1730F40EEDB005DB9CC /* Whitelist Panel Harness */, ); }; /* End PBXProject section */ @@ -266,6 +316,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B5CFF1700F40EEDB005DB9CC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5CFF17A0F40EEF1005DB9CC /* WhitelistPanel.xib in Resources */, + B5CFF1870F40F000005DB9CC /* HarnessMain.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -317,6 +376,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B5CFF1710F40EEDB005DB9CC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B5CFF18A0F40F013005DB9CC /* CTFWhitelistWindowController.m in Sources */, + B5CFF1AE0F40F070005DB9CC /* HarnessMain.m in Sources */, + B5028E930F413553004886D7 /* HarnessAppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -550,6 +619,54 @@ }; name = Release; }; + B5CFF1770F40EEDC005DB9CC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "TestFiles/Debugging Harness/Harness-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "Whitelist Panel Harness"; + }; + name = Debug; + }; + B5CFF1780F40EEDC005DB9CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "Whitelist Panel Harness-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "Whitelist Panel Harness"; + ZERO_LINK = NO; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -598,6 +715,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + B5CFF1790F40EEDC005DB9CC /* Build configuration list for PBXNativeTarget "Whitelist Panel Harness" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5CFF1770F40EEDC005DB9CC /* Debug */, + B5CFF1780F40EEDC005DB9CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 55EB70320E04A8410016593D /* Project object */; diff --git a/Plugin/CTFWhitelistWindowController.h b/Plugin/CTFWhitelistWindowController.h index 4a5ced94..4ac1990d 100755 --- a/Plugin/CTFWhitelistWindowController.h +++ b/Plugin/CTFWhitelistWindowController.h @@ -2,7 +2,14 @@ @interface CTFWhitelistWindowController : NSWindowController { - + IBOutlet NSArrayController *_controller; + NSMutableArray *_sites; } +- (IBAction) addWhitelistSite: (id) sender; +- (IBAction) removeWhitelistSite: (id) sender; + +- (void) saveWhitelist: (id) sender; +- (void) whitelistChanged: (NSNotification *) note; @end + diff --git a/Plugin/CTFWhitelistWindowController.m b/Plugin/CTFWhitelistWindowController.m index 735b4241..d5f8a0c1 100755 --- a/Plugin/CTFWhitelistWindowController.m +++ b/Plugin/CTFWhitelistWindowController.m @@ -1,5 +1,7 @@ #import "CTFWhitelistWindowController.h" +extern NSString *sHostWhitelistDefaultsKey; +extern NSString *sCTFWhitelistAdditionMade; @implementation CTFWhitelistWindowController @@ -13,8 +15,61 @@ - (id)init return nil; } - self = [super initWithWindowNibPath:nibPath owner:self]; + self = [super initWithWindowNibPath: nibPath owner: self]; + + [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(whitelistChanged:) name: sCTFWhitelistAdditionMade object: nil]; + _sites = [[NSMutableArray array] retain]; + + [self whitelistChanged: nil]; + return self; } +- (void) dealloc { + [_sites release]; + [super dealloc]; +} + +- (void) whitelistChanged: (NSNotification *) note { + NSArray *currentSites = [[NSUserDefaults standardUserDefaults] valueForKey: sHostWhitelistDefaultsKey]; + NSEnumerator *enumerator = [currentSites objectEnumerator]; + NSString *site; + + [_sites removeAllObjects]; + + while (site = [enumerator nextObject]) { + [_sites addObject: [NSMutableDictionary dictionaryWithObject: site forKey: @"description"]]; + } + [_controller setContent: _sites]; +} + +- (IBAction) removeWhitelistSite: (id) sender { + [_controller remove: nil]; + [self saveWhitelist: nil]; +} + +- (IBAction) addWhitelistSite: (id) sender { + [_controller insertObject: [NSMutableDictionary dictionaryWithObject: @"" forKey: @"description"] atArrangedObjectIndex: _sites.count]; + [_controller setSelectionIndex: _sites.count - 1]; + [self saveWhitelist: nil]; +} + +- (void) saveWhitelist: (id) sender { + NSMutableArray *sites = [NSMutableArray array]; + NSEnumerator *enumerator = [_sites objectEnumerator]; + NSDictionary *site; + + while (site = [enumerator nextObject]) { + [sites addObject: [site valueForKey: @"description"]]; + } + + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + [defaults setValue: sites forKey: sHostWhitelistDefaultsKey]; +} + +- (void) windowWillClose: (NSNotification *) notification { + [self saveWhitelist: nil]; +} + @end diff --git a/Plugin/English.lproj/WhitelistPanel.xib b/Plugin/English.lproj/WhitelistPanel.xib index d05c010d..798f9119 100755 --- a/Plugin/English.lproj/WhitelistPanel.xib +++ b/Plugin/English.lproj/WhitelistPanel.xib @@ -50,6 +50,37 @@ 274 YES + + + 290 + {{17, 17}, {473, 17}} + + YES + + 67239424 + 138412032 + Option-click Flash to add to whitelist + + LucidaGrande + 1.100000e+01 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 3 + MC41AA + + + 274 @@ -112,20 +143,13 @@ 337772096 2048 Text Cell - - LucidaGrande - 1.100000e+01 - 16 - + 6 System controlBackgroundColor - - 3 - MC42NjY2NjY2OQA - + 6 @@ -147,10 +171,7 @@ 6 System gridColor - - 3 - MC41AA - + 1.700000e+01 1388314624 @@ -215,45 +236,54 @@ QSAAAEEgAABBmAAAQZgAAA - + - 289 - {{325, 12}, {162, 26}} + 292 + {{20, 14}, {23, 22}} YES - + 67239424 134348800 - Remove from Whitelist + - - -2038284033 + + -2033958657 162 + + NSImage + NSAddTemplate + + 200 25 - + 292 - {{18, 15}, {283, 17}} + {{42, 14}, {23, 22}} YES - + 67239424 - 4194304 - Option-click Flash to add to whitelist - - - - 6 - System - controlColor - + 134348800 + + + + -2033958657 + 162 + + NSImage + NSRemoveTemplate - + + + + 200 + 25 @@ -344,9 +374,6 @@ {3.40282e+38, 3.40282e+38} ClickToFlash_settingsWindow - - YES - YES @@ -365,22 +392,6 @@ YES - - - value: arrangedObjects.description - - - - - - value: arrangedObjects.description - value - arrangedObjects.description - 2 - - - 18 - window @@ -389,21 +400,13 @@ 19 - - - remove: - - - - 22 - enabled: canRemove - + - + enabled: canRemove enabled @@ -411,55 +414,75 @@ 2 - 24 + 58 - - value: values.ClickToFlash_allowSifr - - - - - - value: values.ClickToFlash_allowSifr - value - values.ClickToFlash_allowSifr - 2 - + + addWhitelistSite: + + - 44 + 60 + + + + _controller + + + + 61 - value: values.ClickToFlash_useYouTubeH264 - - + value: arrangedObjects.description + + - - - value: values.ClickToFlash_useYouTubeH264 + + + value: arrangedObjects.description value - values.ClickToFlash_useYouTubeH264 + arrangedObjects.description + + NSAllowsEditingMultipleValuesSelection + + 2 - 48 + 63 - contentArray: values.ClickToFlash_whitelist + contentArray: _sites - + - - contentArray: values.ClickToFlash_whitelist + + contentArray: _sites contentArray - values.ClickToFlash_whitelist + _sites 2 - 49 + 65 + + + + delegate + + + + 66 + + + + removeWhitelistSite: + + + + 69 @@ -505,10 +528,11 @@ YES - - + + + @@ -518,11 +542,6 @@ Whitelisted Hosts - - 7 - - - 9 @@ -573,20 +592,6 @@ - - 20 - - - YES - - - - - - 21 - - - 31 @@ -654,6 +659,34 @@ + + 50 + + + YES + + + + + + 51 + + + + + 54 + + + YES + + + + + + 55 + + + @@ -678,8 +711,6 @@ 14.IBPluginDependency 17.IBPluginDependency 2.IBPluginDependency - 20.IBPluginDependency - 21.IBPluginDependency 31.IBPluginDependency 32.IBPluginDependency 36.IBAttributePlaceholdersKey @@ -691,6 +722,10 @@ 4.IBPluginDependency 40.IBPluginDependency 41.IBPluginDependency + 50.IBPluginDependency + 51.IBPluginDependency + 54.IBPluginDependency + 55.IBPluginDependency 9.IBPluginDependency @@ -698,9 +733,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{63, 404}, {507, 292}} + {{79, 833}, {507, 292}} com.apple.InterfaceBuilder.CocoaPlugin - {{63, 404}, {507, 292}} + {{79, 833}, {507, 292}} {196, 240} {{202, 428}, {480, 270}} @@ -715,8 +750,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -741,6 +774,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -763,7 +800,7 @@ - 49 + 69 @@ -771,6 +808,25 @@ CTFWhitelistWindowController NSWindowController + + YES + + YES + addWhitelistSite: + removeWhitelistSite: + saveWhitelist: + + + YES + id + id + id + + + + _controller + NSArrayController + IBProjectSource Plugin/CTFWhitelistWindowController.h diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index c5fed113..8b575ded 100644 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -36,12 +36,12 @@ of this software and associated documentation files (the "Software"), to deal static NSString *sFlashNewMIMEType = @"application/futuresplash"; // NSUserDefaults keys -static NSString *sHostWhitelistDefaultsKey = @"ClickToFlash_whitelist"; + NSString *sHostWhitelistDefaultsKey = @"ClickToFlash_whitelist"; static NSString *sAllowSifrDefaultsKey = @"ClickToFlash_allowSifr"; static NSString *sUseYouTubeH264DefaultsKey = @"ClickToFlash_useYouTubeH264"; // NSNotification names -static NSString *sCTFWhitelistAdditionMade = @"CTFWhitelistAdditionMade"; + NSString *sCTFWhitelistAdditionMade = @"CTFWhitelistAdditionMade"; @interface CTFClickToFlashPlugin (Internal)