diff --git a/Plugin/CTFWhitelistWindowController.h b/Plugin/CTFWhitelistWindowController.h index 847f073f..3d90ff65 100755 --- a/Plugin/CTFWhitelistWindowController.h +++ b/Plugin/CTFWhitelistWindowController.h @@ -1,9 +1,12 @@ #import +extern NSString* kCTFCheckForUpdates; @interface CTFWhitelistWindowController : NSWindowController { IBOutlet NSArrayController *_controller; } +- (IBAction)checkForUpdates:(id)sender; + @end diff --git a/Plugin/CTFWhitelistWindowController.m b/Plugin/CTFWhitelistWindowController.m index 00cb1e1e..25494aab 100755 --- a/Plugin/CTFWhitelistWindowController.m +++ b/Plugin/CTFWhitelistWindowController.m @@ -1,4 +1,7 @@ #import "CTFWhitelistWindowController.h" +#import + +NSString *kCTFCheckForUpdates = @"CTFCheckForUpdates"; @implementation CTFWhitelistWindowController @@ -16,4 +19,17 @@ - (id)init return self; } +- (IBAction)checkForUpdates:(id)sender; +{ + // this code is put here, because if it's code that's owned by the plugin object, then initiating + // an update will silently fail when no ClickToFlash view is loaded; putting it in the whitelist window + // object allows Sparkle to always check for updates + + NSBundle *clickToFlashBundle = [NSBundle bundleWithIdentifier:@"com.github.rentzsch.clicktoflash"]; + NSAssert(clickToFlashBundle, nil); + SUUpdater *updater = [SUUpdater updaterForBundle:clickToFlashBundle]; + NSAssert(updater, nil); + [updater checkForUpdates:self]; +} + @end diff --git a/Plugin/English.lproj/WhitelistPanel.xib b/Plugin/English.lproj/WhitelistPanel.xib index fe1fc9ec..8aded3b7 100755 --- a/Plugin/English.lproj/WhitelistPanel.xib +++ b/Plugin/English.lproj/WhitelistPanel.xib @@ -8,7 +8,6 @@ 353.00 YES - YES @@ -38,13 +37,13 @@ 15 2 - {{80, 343}, {527, 360}} + {{80, 276}, {527, 427}} -534248448 Q2xpY2sgdG8gRmxhc2gg4oCUIFNldHRpbmdzA NSPanel {3.40282e+38, 3.40282e+38} - {420, 250} + {420, 350} 274 @@ -65,12 +64,14 @@ 4352 {485, 151} + YES 256 {485, 17} + @@ -78,6 +79,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -89,7 +91,7 @@ 75628032 134217728 Whitelisted Sites - + LucidaGrande 1.100000e+01 3100 @@ -163,6 +165,7 @@ {{1, 17}, {485, 151}} + @@ -173,6 +176,7 @@ -2147483392 {{471, 17}, {15, 152}} + _doScroller: 3.700000e+01 @@ -183,6 +187,7 @@ 256 {{-100, -100}, {450, 15}} + 1 _doScroller: @@ -197,6 +202,7 @@ {{1, 0}, {485, 17}} + @@ -204,8 +210,9 @@ - {{20, 41}, {487, 169}} + {{20, 47}, {487, 169}} + 530 @@ -218,8 +225,9 @@ 292 - {{48, 13}, {29, 26}} + {{48, 19}, {29, 26}} + YES 67239424 @@ -242,8 +250,9 @@ 292 - {{20, 13}, {29, 26}} + {{20, 19}, {29, 26}} + YES 67239424 @@ -262,8 +271,9 @@ 289 - {{227, 14}, {283, 17}} + {{227, 20}, {283, 17}} + YES 67239424 @@ -288,8 +298,9 @@ 268 - {{93, 104}, {236, 18}} + {{93, 169}, {286, 18}} + YES -2080244224 @@ -319,8 +330,9 @@ 268 - {{93, 84}, {271, 18}} + {{93, 149}, {286, 18}} + YES -2080244224 @@ -341,8 +353,9 @@ 268 - {{26, 105}, {58, 17}} + {{17, 170}, {67, 17}} + YES 68288064 @@ -357,8 +370,9 @@ 268 - {{93, 9}, {285, 58}} + {{93, 74}, {285, 58}} + YES 3 1 @@ -628,8 +642,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 - {{17, 50}, {67, 17}} + {{17, 115}, {67, 17}} + YES 68288064 @@ -641,21 +656,88 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + 268 + {{17, 44}, {67, 17}} + + + YES + + 68288064 + 71304192 + Updates: + + + + + + + + + 268 + {{93, 43}, {218, 18}} + + + YES + + -2080244224 + 0 + Check for updates on first load + + + 1211912703 + 130 + + + + + 200 + 25 + + + + + 268 + {{117, 13}, {86, 28}} + + + YES + + 67239424 + 134348800 + Check Now + + + -2038284033 + 129 + + + 200 + 25 + + - {{65, 222}, {397, 142}} + {{65, 224}, {397, 207}} + NSView - {527, 360} + {527, 427} + {{0, 0}, {1280, 778}} - {420, 272} + {420, 372} {3.40282e+38, 3.40282e+38} ClickToFlash_settingsWindow + + YES + ClickToFlash_checkForUpdatesOnLoad + YES @@ -814,6 +896,30 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 136 + + + value: values.ClickToFlash_checkForUpdatesOnLoad + + + + + + value: values.ClickToFlash_checkForUpdatesOnLoad + value + values.ClickToFlash_checkForUpdatesOnLoad + 2 + + + 145 + + + + checkForUpdates: + + + + 146 + @@ -858,11 +964,11 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA YES - + - + @@ -955,62 +1061,84 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + 113 + + + YES + + + + + + 114 + + + 42 YES - - - - + + + + + + + - 36 - + 131 + YES - + - 41 - - + 132 + + - 38 - + 106 + YES - + - 39 - - + 107 + + 101 YES - - - + + + - 102 - + 105 + + + + + 104 + @@ -1019,56 +1147,79 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 104 - + 102 + - 105 - - + 38 + + + YES + + + - 106 - + 39 + + + + + 36 + YES - + - 107 - - + 41 + + - 113 - + 139 + YES - + - + - 114 - - + 140 + + - 131 - + 141 + YES - + - 132 - - + 142 + + + + + 143 + + + YES + + + + + + 144 + + @@ -1081,6 +1232,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA -3.IBPluginDependency 1.IBEditorWindowLastContentRect 1.IBPluginDependency + 1.IBViewEditorWindowController.showingLayoutRectangles 1.IBWindowTemplateEditedContentRect 1.NSWindowTemplate.visibleAtLaunch 1.WindowOrigin @@ -1104,7 +1256,13 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 131.IBAttributePlaceholdersKey 131.IBPluginDependency 132.IBPluginDependency + 139.IBPluginDependency 14.IBPluginDependency + 140.IBPluginDependency + 141.IBPluginDependency + 142.IBPluginDependency + 143.IBPluginDependency + 144.IBPluginDependency 17.IBPluginDependency 2.IBPluginDependency 20.IBPluginDependency @@ -1124,14 +1282,15 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{46, 1154}, {527, 360}} + {{65, 235}, {527, 427}} com.apple.InterfaceBuilder.CocoaPlugin - {{46, 1154}, {527, 360}} + + {{65, 235}, {527, 427}} {196, 240} {{202, 428}, {480, 270}} - {420, 250} + {420, 350} com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -1177,6 +1336,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 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 + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -1213,7 +1378,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA - 136 + 146 @@ -1221,6 +1386,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA CTFWhitelistWindowController NSWindowController + + checkForUpdates: + id + _controller NSArrayController diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index 8fb1a0e4..8cc38a22 100644 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -42,6 +42,7 @@ of this software and associated documentation files (the "Software"), to deal // NSUserDefaults keys static NSString *sUseYouTubeH264DefaultsKey = @"ClickToFlash_useYouTubeH264"; static NSString *sAutoLoadInvisibleFlashViewsKey = @"ClickToFlash_autoLoadInvisibleViews"; +static NSString *sCheckForUpdatesOnFirstLoadKey = @"ClickToFlash_checkForUpdatesOnFirstLoad"; @interface CTFClickToFlashPlugin (Internal) @@ -86,15 +87,17 @@ - (id) initWithArguments:(NSDictionary *)arguments self = [super init]; if (self) { { - static BOOL checkedForUpdate = NO; - if (!checkedForUpdate) { - checkedForUpdate = YES; NSBundle *clickToFlashBundle = [NSBundle bundleWithIdentifier:@"com.github.rentzsch.clicktoflash"]; - NSAssert(clickToFlashBundle, nil); - SUUpdater *updater = [SUUpdater updaterForBundle:clickToFlashBundle]; - NSAssert(updater, nil); - [updater setAutomaticallyChecksForUpdates:YES]; - [updater resetUpdateCycle]; - } + if ([ [ NSUserDefaults standardUserDefaults ] boolForKey: sCheckForUpdatesOnFirstLoadKey ]) { + static BOOL checkedForUpdate = NO; + if (!checkedForUpdate) { + checkedForUpdate = YES; NSBundle *clickToFlashBundle = [NSBundle bundleWithIdentifier:@"com.github.rentzsch.clicktoflash"]; + NSAssert(clickToFlashBundle, nil); + SUUpdater *updater = [SUUpdater updaterForBundle:clickToFlashBundle]; + NSAssert(updater, nil); + [updater setAutomaticallyChecksForUpdates:YES]; + [updater resetUpdateCycle]; + } + } } self.webView = [[[arguments objectForKey:WebPlugInContainerKey] webFrame] webView];