blob: a1dc5c0758ce0ba6ecbd5be231223d85505655cc [file] [log] [blame]
Alexander Afanasyev749f0652013-09-22 13:03:21 -07001/* -*- 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
15class SparkleAutoUpdate::Private
16{
17public:
18 SUUpdater *updater;
19};
20
21SparkleAutoUpdate::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
31SparkleAutoUpdate::~SparkleAutoUpdate()
32{
33 [d->updater release];
34 delete d;
35 // presummably SUUpdater handles garbage collection
36}
37
38void SparkleAutoUpdate::checkForUpdates()
39{
40 //[d->updater checkForUpdatesInBackground];
41 [d->updater checkForUpdates : nil];
42}