Alexander Afanasyev | 14b0948 | 2013-10-11 18:24:45 +0200 | [diff] [blame] | 1 | /* -*- Mode: objc; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California, |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | b6392e3 | 2014-05-12 23:43:50 -0700 | [diff] [blame] | 5 | * 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 Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | #include "sparkle-auto-update.h" |
| 24 | |
| 25 | #import <Foundation/Foundation.h> |
| 26 | #import <AppKit/AppKit.h> |
| 27 | #import <Sparkle/Sparkle.h> |
| 28 | |
| 29 | class SparkleAutoUpdate::Private |
| 30 | { |
| 31 | public: |
| 32 | SUUpdater *updater; |
| 33 | }; |
| 34 | |
| 35 | SparkleAutoUpdate::SparkleAutoUpdate(const char *updateUrl) |
| 36 | { |
| 37 | d = new Private; |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 38 | d->updater = [SUUpdater sharedUpdater]; |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 39 | 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 | |
| 45 | SparkleAutoUpdate::~SparkleAutoUpdate() |
| 46 | { |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 47 | // [d->updater release]; |
Alexander Afanasyev | 749f065 | 2013-09-22 13:03:21 -0700 | [diff] [blame] | 48 | delete d; |
| 49 | // presummably SUUpdater handles garbage collection |
| 50 | } |
| 51 | |
| 52 | void SparkleAutoUpdate::checkForUpdates() |
| 53 | { |
| 54 | //[d->updater checkForUpdatesInBackground]; |
| 55 | [d->updater checkForUpdates : nil]; |
| 56 | } |