projects/package-update-indicator

diff pui-backend.c @ 52:707e9e3deeac

Do not hardcode pkg-config

Using a macro allows passing a different executable in case of
cross-compilation.
author Helmut Grohne <helmut@subdivi.de>
date Sat Dec 12 01:08:21 2020 -0500 (13 months ago)
parents 4a859595eabd
children
line diff
     1.1 --- a/pui-backend.c	Thu Nov 05 11:18:16 2020 +0100
     1.2 +++ b/pui-backend.c	Sat Dec 12 01:08:21 2020 -0500
     1.3 @@ -290,23 +290,33 @@
     1.4  			g_debug("perioidic checks inhibited: low battery");
     1.5  		}
     1.6  	} else {
     1.7 -		/* schedule periodic checks when no longer inhibited */
     1.8 -		elapsed_time = (g_get_monotonic_time() - self->last_check) /
     1.9 -		    G_USEC_PER_SEC;
    1.10 -		/*
    1.11 -		 * if more time that the check interval has passed since the
    1.12 -		 * last check, schedule a check after a short delay, otherwise
    1.13 -		 * wait until the interval has passed
    1.14 -		 */
    1.15 -		remaining_time = (elapsed_time < PUI_CHECK_UPDATES_INTERVAL) ?
    1.16 -		    PUI_CHECK_UPDATES_INTERVAL - elapsed_time :
    1.17 -		    PUI_STARTUP_DELAY;
    1.18 +		if (self->last_check == 0) {
    1.19 +			/* first check after startup */
    1.20 +			remaining_time = PUI_STARTUP_DELAY;
    1.21 +
    1.22 +			g_debug("scheduled first check in: %ds",
    1.23 +			    remaining_time);
    1.24 +		} else {
    1.25 +			/* schedule periodic checks when no longer inhibited */
    1.26 +			elapsed_time =
    1.27 +			    (g_get_monotonic_time() - self->last_check) /
    1.28 +			    G_USEC_PER_SEC;
    1.29 +			/*
    1.30 +			 * if more time than the check interval has passed
    1.31 +			 * since the last check, schedule a check after a short
    1.32 +			 * delay, otherwise wait until the interval has passed
    1.33 +			 */
    1.34 +			remaining_time =
    1.35 +			    (elapsed_time < PUI_CHECK_UPDATES_INTERVAL) ?
    1.36 +			    PUI_CHECK_UPDATES_INTERVAL - elapsed_time :
    1.37 +			    PUI_STARTUP_DELAY;
    1.38 +
    1.39 +			g_debug("perioidic checks no longer inhibited, "
    1.40 +			    "time since last check: %ds, next check in: %ds",
    1.41 +			    elapsed_time, remaining_time);
    1.42 +		}
    1.43  		self->check_id = g_timeout_add_seconds(remaining_time,
    1.44  		    periodic_check, self);
    1.45 -
    1.46 -		g_debug("perioidic checks no longer inhibited, time since "
    1.47 -		    "last check: %ds, next check in: %ds", elapsed_time,
    1.48 -		    remaining_time);
    1.49  	}
    1.50  }
    1.51