#define TRAC_URL @"http://trac.transmissionbt.com/"
#define DONATE_URL @"http://www.transmissionbt.com/donate.php"
+#define DONATE_NAG_TIME (60 * 60 * 24 * 7)
+
static void altSpeedToggledCallback(tr_session * handle UNUSED, tr_bool active, tr_bool byUser, void * controller)
{
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSNumber alloc] initWithBool: active], @"Active",
if ([fDefaults boolForKey: @"InfoVisible"])
[self showInfo: nil];
+
+ //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 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