Add API for silent on-demand update checks.

There might be cases where the application would want to check for
updates manually. This would override the users request to not perform
update checks, if that is enabled, so should be used with care.

Add in_sparkle_check_update_without_ui() for this purpose. It is not
completely UI-less, as it still shows the "update available" window, but
it doesn't show any UI unless there actually is an update.
This commit is contained in:
Örn Guðjónsson
2013-09-29 19:52:17 +02:00
committed by Vaclav Slavik
parent 7bffa3d1a3
commit f692660e34
2 changed files with 33 additions and 0 deletions

View File

@@ -238,9 +238,29 @@ WIN_SPARKLE_API int __cdecl win_sparkle_get_update_check_interval();
window is shown.
This function returns immediately.
@see win_sparkle_check_update_without_ui()
*/
WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui();
/**
Checks if an update is available.
No progress UI is shown to the user when checking. If an update is
available, the usual "update available" window is shown; this function
is *not* completely UI-less.
Use with caution, it usually makes more sense to use the automatic update
checks on interval option or manual check with visible UI.
This function returns immediately.
@since 0.4
@see win_sparkle_check_update_with_ui()
*/
WIN_SPARKLE_API void __cdecl win_sparkle_check_update_without_ui();
//@}
#ifdef __cplusplus

View File

@@ -222,4 +222,17 @@ WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui()
CATCH_ALL_EXCEPTIONS
}
WIN_SPARKLE_API void __cdecl win_sparkle_check_update_without_ui()
{
try
{
// Run the check in background. Only show UI if updates
// are available.
UpdateChecker *check = new ManualUpdateChecker();
check->Start();
}
CATCH_ALL_EXCEPTIONS
}
} // extern "C"