[gnome-software/wip/hadess/fix-thrice-daily-check: 1/2] gs-update-monitor: Use constants for long timeouts
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hadess/fix-thrice-daily-check: 1/2] gs-update-monitor: Use constants for long timeouts
- Date: Fri, 21 Feb 2020 16:56:24 +0000 (UTC)
commit 816d5f568813deb8cc8b9a944332fb83c5d09374
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 21 17:53:22 2020 +0100
gs-update-monitor: Use constants for long timeouts
This saves us having to remember the number of seconds in a day or an
hour.
src/gs-update-monitor.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 9ffa867a..6c77da91 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -16,6 +16,9 @@
#include "gs-update-monitor.h"
#include "gs-common.h"
+#define SECONDS_IN_AN_HOUR (60 * 60)
+#define SECONDS_IN_A_DAY (SECONDS_IN_AN_HOUR * 24)
+
struct _GsUpdateMonitor {
GObject parent;
@@ -90,7 +93,7 @@ notify_offline_update_available (GsUpdateMonitor *monitor)
return;
/* rate limit update notifications to once per hour */
- monitor->notification_blocked_id = g_timeout_add_seconds (3600, reenable_offline_update_notification,
monitor);
+ monitor->notification_blocked_id = g_timeout_add_seconds (SECONDS_IN_AN_HOUR,
reenable_offline_update_notification, monitor);
/* get time in days since we saw the first unapplied security update */
g_settings_get (monitor->settings,
@@ -883,7 +886,7 @@ restart_upgrades_check (GsUpdateMonitor *monitor)
stop_upgrades_check (monitor);
get_upgrades (monitor);
- monitor->check_daily_id = g_timeout_add_seconds (3 * 86400,
+ monitor->check_daily_id = g_timeout_add_seconds (3 * SECONDS_IN_A_DAY,
check_thrice_daily_cb,
monitor);
}
@@ -904,7 +907,7 @@ restart_updates_check (GsUpdateMonitor *monitor)
stop_updates_check (monitor);
check_updates (monitor);
- monitor->check_hourly_id = g_timeout_add_seconds (3600, check_hourly_cb,
+ monitor->check_hourly_id = g_timeout_add_seconds (SECONDS_IN_AN_HOUR, check_hourly_cb,
monitor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]