move the donation nag window to applicationDidFinishLaunching:

This commit is contained in:
Mitchell Livingston 2009-08-14 03:14:37 +00:00
parent 6c2f77a3ee
commit 8ec3d0f493
2 changed files with 38 additions and 38 deletions

1
NEWS
View File

@ -26,7 +26,6 @@ NEWS file for Transmission <http://www.transmissionbt.com/>
+ When verifying a torrent, "%nan" was displayed
+ "Pause All" only appeared to pause torrents with peers until refresh
1.73 (2009/07/18)
<http://trac.transmissionbt.com/query?milestone=1.73&group=component&groupdesc=1&order=severity>
- All Platforms

View File

@ -518,43 +518,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
if ([fDefaults boolForKey: @"InfoVisible"])
[self showInfo: nil];
//shamelessly ask for donations
NSDate * lastDonateDate = [fDefaults objectForKey: @"DonateAskDate"];
if ([fDefaults boolForKey: @"WarningDonate"] && (!lastDonateDate || [lastDonateDate timeIntervalSinceNow] < -1 * DONATE_NAG_TIME))
{
if (lastDonateDate) //don't show on the first launch
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: NSLocalizedString(@"Support open-source indie software", "Donation beg -> title")];
NSString * donateMessage = [NSString stringWithFormat: @"%@\n\n%@",
NSLocalizedString(@"Transmission is a full-featured torrent application. A lot of time and effort have gone into development, coding, and refinement."
" If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
[alert setInformativeText: donateMessage];
[alert setAlertStyle: NSInformationalAlertStyle];
[alert addButtonWithTitle: [NSLocalizedString(@"Donate", "Donation beg -> button") stringByAppendingEllipsis]];
NSButton * noDonateButton = [alert addButtonWithTitle: NSLocalizedString(@"Nope", "Donation beg -> button")];
[noDonateButton setKeyEquivalent: @"\e"]; //escape key
[[alert suppressionButton] setTitle: NSLocalizedString(@"Don't bug me about this ever again.", "Donation beg -> button")];
[alert setShowsSuppressionButton: YES];
const NSInteger donateResult = [alert runModal];
if (donateResult == NSAlertFirstButtonReturn)
[self linkDonate: self];
if ([[alert suppressionButton] state] == NSOnState)
[fDefaults setBool: NO forKey: @"WarningDonate"];
[alert release];
}
[fDefaults setObject: [NSDate date] forKey: @"DonateAskDate"];
}
}
- (void) applicationDidFinishLaunching: (NSNotification *) notification
@ -571,6 +534,44 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
//registering the Web UI to Bonjour
if ([fDefaults boolForKey: @"RPC"] && [fDefaults boolForKey: @"RPCWebDiscovery"])
[[BonjourController defaultController] startWithPort: [fDefaults integerForKey: @"RPCPort"]];
//shamelessly ask for donations
NSDate * lastDonateDate = [fDefaults objectForKey: @"DonateAskDate"];
if (YES)//[fDefaults boolForKey: @"WarningDonate"] && (!lastDonateDate || [lastDonateDate timeIntervalSinceNow] < -1 * DONATE_NAG_TIME))
{
if (lastDonateDate) //don't show on the first launch
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: NSLocalizedString(@"Support open-source indie software", "Donation beg -> title")];
NSString * donateMessage = [NSString stringWithFormat: @"%@\n\n%@",
NSLocalizedString(@"Transmission is a full-featured torrent application."
" A lot of time and effort have gone into development, coding, and refinement."
" If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
[alert setInformativeText: donateMessage];
[alert setAlertStyle: NSInformationalAlertStyle];
[alert addButtonWithTitle: [NSLocalizedString(@"Donate", "Donation beg -> button") stringByAppendingEllipsis]];
NSButton * noDonateButton = [alert addButtonWithTitle: NSLocalizedString(@"Nope", "Donation beg -> button")];
[noDonateButton setKeyEquivalent: @"\e"]; //escape key
[alert setShowsSuppressionButton: YES];
[[alert suppressionButton] setTitle: NSLocalizedString(@"Don't bug me about this ever again.", "Donation beg -> button")];
const NSInteger donateResult = [alert runModal];
if (donateResult == NSAlertFirstButtonReturn)
[self linkDonate: self];
if ([[alert suppressionButton] state] == NSOnState)
[fDefaults setBool: NO forKey: @"WarningDonate"];
[alert release];
}
[fDefaults setObject: [NSDate date] forKey: @"DonateAskDate"];
}
}
- (BOOL) applicationShouldHandleReopen: (NSApplication *) app hasVisibleWindows: (BOOL) visibleWindows