blob: 84612b3aab877247236918295140f6cb5eefca58 [file] [log] [blame]
Alexander Afanasyev14b09482013-10-11 18:24:45 +02001/* -*- Mode: objc; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07002/**
3 * Copyright (c) 2013-2014, Regents of the University of California,
Alexander Afanasyev749f0652013-09-22 13:03:21 -07004 *
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07005 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * \author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
20 * \author Ilya Moiseenko <http://ilyamoiseenko.com/>
Alexander Afanasyev749f0652013-09-22 13:03:21 -070021 */
22
23#include "sparkle-auto-update.h"
24
25#import <Foundation/Foundation.h>
26#import <AppKit/AppKit.h>
27#import <Sparkle/Sparkle.h>
28
29class SparkleAutoUpdate::Private
30{
31public:
32 SUUpdater *updater;
33};
34
35SparkleAutoUpdate::SparkleAutoUpdate(const char *updateUrl)
36{
37 d = new Private;
Alexander Afanasyev88f0b3a2013-09-24 23:52:08 -070038 d->updater = [SUUpdater sharedUpdater];
Alexander Afanasyev749f0652013-09-22 13:03:21 -070039 NSURL *url = [NSURL URLWithString: [NSString stringWithCString:updateUrl encoding:NSASCIIStringEncoding]];
40 [d->updater setFeedURL: url];
41 [d->updater setAutomaticallyChecksForUpdates: YES];
42 [d->updater setUpdateCheckInterval: 86400];
43}
44
45SparkleAutoUpdate::~SparkleAutoUpdate()
46{
Alexander Afanasyev88f0b3a2013-09-24 23:52:08 -070047 // [d->updater release];
Alexander Afanasyev749f0652013-09-22 13:03:21 -070048 delete d;
49 // presummably SUUpdater handles garbage collection
50}
51
52void SparkleAutoUpdate::checkForUpdates()
53{
54 //[d->updater checkForUpdatesInBackground];
55 [d->updater checkForUpdates : nil];
56}