summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-27 21:50:54 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-27 21:50:54 (GMT)
commit05fa7a57b3c7df3a9cc717cba202c96be05fa21a (patch)
tree70ddc33247920490c946bd73421083851dcaef31 /SwifTools/AutoUpdater
parentaa09a889108c4d0e3c5888ad98958d8f3e12bd3b (diff)
downloadswift-contrib-05fa7a57b3c7df3a9cc717cba202c96be05fa21a.zip
swift-contrib-05fa7a57b3c7df3a9cc717cba202c96be05fa21a.tar.bz2
Added (Sparkle) AutoUpdater.
Not plugged into Swift yet.
Diffstat (limited to 'SwifTools/AutoUpdater')
-rw-r--r--SwifTools/AutoUpdater/AutoUpdater.cpp8
-rw-r--r--SwifTools/AutoUpdater/AutoUpdater.h10
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.h18
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm33
4 files changed, 69 insertions, 0 deletions
diff --git a/SwifTools/AutoUpdater/AutoUpdater.cpp b/SwifTools/AutoUpdater/AutoUpdater.cpp
new file mode 100644
index 0000000..cd0eb0b
--- /dev/null
+++ b/SwifTools/AutoUpdater/AutoUpdater.cpp
@@ -0,0 +1,8 @@
+#include "SwifTools/AutoUpdater/AutoUpdater.h"
+
+namespace Swift {
+
+AutoUpdater::~AutoUpdater() {
+}
+
+}
diff --git a/SwifTools/AutoUpdater/AutoUpdater.h b/SwifTools/AutoUpdater/AutoUpdater.h
new file mode 100644
index 0000000..c1a73f1
--- /dev/null
+++ b/SwifTools/AutoUpdater/AutoUpdater.h
@@ -0,0 +1,10 @@
+#pragma once
+
+namespace Swift {
+ class AutoUpdater {
+ public:
+ virtual ~AutoUpdater();
+
+ virtual void checkForUpdates() = 0;
+ };
+}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.h b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
new file mode 100644
index 0000000..37053fc
--- /dev/null
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "Swiften/Base/String.h"
+#include "SwifTools/AutoUpdater/AutoUpdater.h"
+
+namespace Swift {
+ class SparkleAutoUpdater : public AutoUpdater {
+ public:
+ SparkleAutoUpdater(const String& url);
+ ~SparkleAutoUpdater();
+
+ void checkForUpdates();
+
+ private:
+ class Private;
+ Private* d;
+ };
+}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
new file mode 100644
index 0000000..30e2ae2
--- /dev/null
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
@@ -0,0 +1,33 @@
+#include "SwifTools/AutoUpdater/SparkleAutoUpdater.h"
+
+#include <Cocoa/Cocoa.h>
+#include <Sparkle/Sparkle.h>
+
+namespace Swift {
+
+class SparkleAutoUpdater::Private {
+ public:
+ SUUpdater* updater;
+};
+
+SparkleAutoUpdater::SparkleAutoUpdater(const String& url) {
+ d = new Private;
+
+ d->updater = [SUUpdater sharedUpdater];
+ [d->updater retain];
+
+ NSURL* nsurl = [NSURL URLWithString:
+ [NSString stringWithUTF8String: url.getUTF8Data()]];
+ [d->updater setFeedURL: nsurl];
+}
+
+SparkleAutoUpdater::~SparkleAutoUpdater() {
+ [d->updater release];
+ delete d;
+}
+
+void SparkleAutoUpdater::checkForUpdates() {
+ [d->updater checkForUpdatesInBackground];
+}
+
+}