[geary: 20/66] Cleanup timeout usage
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 20/66] Cleanup timeout usage
- Date: Tue, 30 Jun 2020 07:09:19 +0000 (UTC)
commit dfc4c55a99479bb9cc63fa419bb855d44903ead1
Author: Chris Heywood <15127-creywood users noreply gitlab gnome org>
Date: Thu Jan 9 12:36:47 2020 +0100
Cleanup timeout usage
src/client/application/application-controller.vala | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index 7a3fdbe82..9c1a3df3f 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -93,7 +93,7 @@ internal class Application.Controller : Geary.BaseObject {
private Gee.List<string?> pending_mailtos = new Gee.ArrayList<string>();
// Timeout to do work in idle after all windows have been sent to the background
- private Geary.TimeoutManager all_windows_backgrounded_timeout = null;
+ private Geary.TimeoutManager all_windows_backgrounded_timeout;
// Whether we're fully in the background
public bool all_windows_backgrounded { get; private set; default = false; }
@@ -154,6 +154,9 @@ internal class Application.Controller : Geary.BaseObject {
ConversationWebView.load_resources();
Accounts.SignatureWebView.load_resources();
+ this.all_windows_backgrounded_timeout =
+ new Geary.TimeoutManager.seconds(CLEANUP_CHECK_AFTER_IDLE_BACKGROUND_MINUTES * 60,
on_unfocused_idle);
+
this.folks = Folks.IndividualAggregator.dup();
if (!this.folks.is_prepared) {
// Do this in the background since it can take a long time
@@ -1402,22 +1405,17 @@ internal class Application.Controller : Geary.BaseObject {
// Track a window receiving focus, for idle background work
public void window_focus_in() {
- this.all_windows_backgrounded = false;
- if (this.all_windows_backgrounded_timeout != null) {
- this.all_windows_backgrounded_timeout.reset();
- this.all_windows_backgrounded_timeout = null;
- }
+ this.all_windows_backgrounded_timeout.reset();
}
// Track a window going unfocused, for idle background work
public void window_focus_out() {
- this.all_windows_backgrounded_timeout = new
Geary.TimeoutManager.seconds(CLEANUP_CHECK_AFTER_IDLE_BACKGROUND_MINUTES * 60, on_unfocused_idle);
this.all_windows_backgrounded_timeout.start();
}
private void on_unfocused_idle() {
// Schedule later, catching cases where work should occur later while still in background
- this.all_windows_backgrounded_timeout = null;
+ this.all_windows_backgrounded_timeout.reset();
this.all_windows_backgrounded = true;
window_focus_out();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]