From 795f4eb106d877ba6f2bd30524cc871404e9e42a Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 13 Dec 2016 10:33:02 -0800 Subject: Qt+Win32: Make software updates more friendly. Add WinSparkle can_shutdown and shutdown_request callbacks which are called prior to running the installer. Reject updates when we have unsaved information. Add notes about possible improvements. Ping-Bug: 9687 Ping-Bug: 12989 Change-Id: Ia126244b311417aa3105ea8136f186adc2745445 Reviewed-on: https://code.wireshark.org/review/19244 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/software_update.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'ui/software_update.c') diff --git a/ui/software_update.c b/ui/software_update.c index a33dbd5b47..059b409b81 100644 --- a/ui/software_update.c +++ b/ui/software_update.c @@ -103,10 +103,8 @@ software_update_init(void) { win_sparkle_set_appcast_url(update_url); win_sparkle_set_automatic_check_for_updates(prefs.gui_update_enabled ? 1 : 0); win_sparkle_set_update_check_interval(prefs.gui_update_interval); - /* Todo: Fix bugs 9687 and 12989. - * win_sparkle_set_can_shutdown_callback(...); - * win_sparkle_set_shutdown_request_callback(...); - */ + win_sparkle_set_can_shutdown_callback(software_update_can_shutdown_callback); + win_sparkle_set_shutdown_request_callback(software_update_shutdown_request_callback); win_sparkle_init(); } @@ -140,10 +138,20 @@ software_update_check(void) { } /** Clean up software update checking. - * - * Does nothing on platforms that don't support software updates. */ -extern void software_update_cleanup(void) { +void software_update_cleanup(void) { +} + +/** Check to see if Wireshark can shut down safely (e.g. offer to save the + * current capture). + */ +int software_update_can_shutdown_callback(void) { + return FALSE; +} + +/** Shut down Wireshark in preparation for an upgrade. + */ +void software_update_shutdown_request_callback(void) { } #endif /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */ -- cgit v1.2.1