Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame^] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * @copyright See LICENCE for copyright and license information. |
| 4 | * |
| 5 | * @author Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 6 | * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 7 | */ |
| 8 | |
| 9 | #include "sparkle-auto-update.h" |
| 10 | |
| 11 | #import <Foundation/Foundation.h> |
| 12 | #import <AppKit/AppKit.h> |
| 13 | #import <Sparkle/Sparkle.h> |
| 14 | |
| 15 | class SparkleAutoUpdate::Private |
| 16 | { |
| 17 | public: |
| 18 | SUUpdater *updater; |
| 19 | }; |
| 20 | |
| 21 | SparkleAutoUpdate::SparkleAutoUpdate(const char *updateUrl) |
| 22 | { |
| 23 | d = new Private; |
| 24 | d->updater = [[SUUpdater sharedUpdater] retain]; |
| 25 | NSURL *url = [NSURL URLWithString: [NSString stringWithCString:updateUrl encoding:NSASCIIStringEncoding]]; |
| 26 | [d->updater setFeedURL: url]; |
| 27 | [d->updater setAutomaticallyChecksForUpdates: YES]; |
| 28 | [d->updater setUpdateCheckInterval: 86400]; |
| 29 | } |
| 30 | |
| 31 | SparkleAutoUpdate::~SparkleAutoUpdate() |
| 32 | { |
| 33 | [d->updater release]; |
| 34 | delete d; |
| 35 | // presummably SUUpdater handles garbage collection |
| 36 | } |
| 37 | |
| 38 | void SparkleAutoUpdate::checkForUpdates() |
| 39 | { |
| 40 | //[d->updater checkForUpdatesInBackground]; |
| 41 | [d->updater checkForUpdates : nil]; |
| 42 | } |