diff options
author | Eugene Sandulenko | 2016-04-03 11:38:06 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-04-03 11:38:06 +0200 |
commit | d643036c206fff904232d3d7678cf0f3d57e55b4 (patch) | |
tree | 263507834121849fc91b0f30bccc43b8f40be929 /backends/updates/macosx | |
parent | c8bb597e6754783660efa8011af60e0c2d8490eb (diff) | |
parent | 5baa657f2586ec9596768920861f1645dd5a4856 (diff) | |
download | scummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.tar.gz scummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.tar.bz2 scummvm-rg350-d643036c206fff904232d3d7678cf0f3d57e55b4.zip |
Merge pull request #735 from sev-/updates-gui
UPDATES: Add GUI. Opt-in dialog and Options
Diffstat (limited to 'backends/updates/macosx')
-rw-r--r-- | backends/updates/macosx/macosx-updates.h | 4 | ||||
-rw-r--r-- | backends/updates/macosx/macosx-updates.mm | 19 |
2 files changed, 14 insertions, 9 deletions
diff --git a/backends/updates/macosx/macosx-updates.h b/backends/updates/macosx/macosx-updates.h index fd2d1f46f5..9f541ad02a 100644 --- a/backends/updates/macosx/macosx-updates.h +++ b/backends/updates/macosx/macosx-updates.h @@ -39,8 +39,8 @@ public: virtual void setAutomaticallyChecksForUpdates(UpdateState state); virtual UpdateState getAutomaticallyChecksForUpdates(); - virtual void setUpdateCheckInterval(UpdateInterval interval); - virtual UpdateInterval getUpdateCheckInterval(); + virtual void setUpdateCheckInterval(int interval); + virtual int getUpdateCheckInterval(); }; #endif diff --git a/backends/updates/macosx/macosx-updates.mm b/backends/updates/macosx/macosx-updates.mm index a94f1c21fd..fc967f8fec 100644 --- a/backends/updates/macosx/macosx-updates.mm +++ b/backends/updates/macosx/macosx-updates.mm @@ -27,6 +27,7 @@ #ifdef USE_SPARKLE #include "common/translation.h" +#include "common/config-manager.h" #include <Cocoa/Cocoa.h> #include <Sparkle/Sparkle.h> @@ -74,11 +75,13 @@ MacOSXUpdateManager::MacOSXUpdateManager() { // Finally give up our references to the objects [menuItem release]; - // Enable automatic update checking once a day (alternatively use - // checkForUpdates() here to check for updates on every startup) - // TODO: Should be removed when an update settings gui is implemented - setAutomaticallyChecksForUpdates(kUpdateStateEnabled); - setUpdateCheckInterval(kUpdateIntervalOneDay); + if (!ConfMan.hasKey("updates_check") + || ConfMan.getInt("updates_check") == Common::UpdateManager::kUpdateIntervalNotSupported) { + setAutomaticallyChecksForUpdates(kUpdateStateDisabled); + } else { + setAutomaticallyChecksForUpdates(kUpdateStateEnabled); + setUpdateCheckInterval(normalizeInterval(ConfMan.getInt("updates_check"))); + } } MacOSXUpdateManager::~MacOSXUpdateManager() { @@ -103,14 +106,16 @@ Common::UpdateManager::UpdateState MacOSXUpdateManager::getAutomaticallyChecksFo return kUpdateStateDisabled; } -void MacOSXUpdateManager::setUpdateCheckInterval(UpdateInterval interval) { +void MacOSXUpdateManager::setUpdateCheckInterval(int interval) { if (interval == kUpdateIntervalNotSupported) return; + interval = normalizeInterval(interval); + [sparkleUpdater setUpdateCheckInterval:(NSTimeInterval)interval]; } -Common::UpdateManager::UpdateInterval MacOSXUpdateManager::getUpdateCheckInterval() { +int MacOSXUpdateManager::getUpdateCheckInterval() { // This is kind of a hack but necessary, as the value stored by Sparkle // might have been changed outside of ScummVM (in which case we return the // default interval of one day) |