summaryrefslogtreecommitdiffstats
blob: 440e178a9f126e1c8d0cd385bf82322c90bcbf2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "SwifTools/AutoUpdater/SparkleAutoUpdater.h"

#include <Cocoa/Cocoa.h>
#include <Sparkle/Sparkle.h>

namespace Swift {

class SparkleAutoUpdater::Private {
	public:
		SUUpdater* updater;
};

SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) {
	d = new Private;

	d->updater = [SUUpdater sharedUpdater];
	[d->updater retain];
	[d->updater setAutomaticallyChecksForUpdates: true];

	NSURL* nsurl = [NSURL URLWithString:
			[NSString stringWithUTF8String: url.c_str()]];
	[d->updater setFeedURL: nsurl];
}

SparkleAutoUpdater::~SparkleAutoUpdater() {
	[d->updater release];
	delete d;
}

void SparkleAutoUpdater::checkForUpdates() {
	[d->updater checkForUpdatesInBackground];
}

}