[geary/wip/713150-conversations: 9/9] Better filling of window, prevent soft assertions when chg folders/exiting
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713150-conversations: 9/9] Better filling of window, prevent soft assertions when chg folders/exiting
- Date: Tue, 3 Mar 2015 01:29:12 +0000 (UTC)
commit 7f86ab66d36e9dad6bed8f11652fe69fa1bcaf58
Author: Jim Nelson <jim yorba org>
Date: Mon Mar 2 17:27:32 2015 -0800
Better filling of window, prevent soft assertions when chg folders/exiting
src/client/application/geary-controller.vala | 3 +-
src/engine/app/app-conversation-monitor.vala | 34 +++++++++++++++++++++----
2 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 4d354da..21fcde2 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -56,6 +56,7 @@ public class GearyController : Geary.BaseObject {
public const string PROP_CURRENT_CONVERSATION ="current-conversations";
public const int MIN_CONVERSATION_COUNT = 50;
+ public const int LOAD_MORE_CONVERSATION_COUNT = 20;
private const string DELETE_MESSAGE_TOOLTIP_SINGLE = _("Delete conversation (Shift+Delete)");
private const string DELETE_MESSAGE_TOOLTIP_MULTIPLE = _("Delete conversations (Shift+Delete)");
@@ -1455,7 +1456,7 @@ public class GearyController : Geary.BaseObject {
private void on_load_more() {
debug("on_load_more");
- current_conversations.min_window_count += MIN_CONVERSATION_COUNT;
+ current_conversations.min_window_count += LOAD_MORE_CONVERSATION_COUNT;
}
private void on_select_folder_completed(Object? source, AsyncResult result) {
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 919a69e..2ce5789 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -13,7 +13,7 @@ public class Geary.App.ConversationMonitor : BaseObject {
Geary.Email.Field.FLAGS | Geary.Email.Field.DATE;
// # of messages to load at a time as we attempt to fill the min window.
- private const int WINDOW_FILL_MESSAGE_COUNT = 10;
+ private const int MIN_FILL_MESSAGE_COUNT = 5;
private const Geary.SpecialFolderType[] BLACKLISTED_FOLDER_TYPES = {
Geary.SpecialFolderType.SPAM,
@@ -247,8 +247,7 @@ public class Geary.App.ConversationMonitor : BaseObject {
if (is_monitoring)
debug("Warning: Conversations object destroyed without stopping monitoring");
- foreach (Conversation conversation in conversations)
- conversation.clear_owner();
+ clear();
}
protected virtual void notify_monitoring_started() {
@@ -417,10 +416,21 @@ public class Geary.App.ConversationMonitor : BaseObject {
notify_monitoring_stopped();
+ clear();
+
if (close_err != null)
throw close_err;
}
+ private void clear() {
+ foreach (Conversation conversation in conversations)
+ conversation.clear_owner();
+
+ conversations.clear();
+ all_email_id_to_conversation.clear();
+ primary_email_id_to_conversation.clear();
+ }
+
// By passing required_fields, this forces the email to be downloaded (if not already) at the
// potential expense of loading it twice; use Email.Field.NONE to only load the email identifiers
// and potentially not be able to load the email due to unavailability (but will be loaded
@@ -784,6 +794,10 @@ public class Geary.App.ConversationMonitor : BaseObject {
int initial_message_count = get_email_count();
+ debug("fill_window_async: is_insert=%s min_window_count=%d conversations.size=%d primary_ids.size=%d
initial_message_count=%d",
+ is_insert.to_string(), min_window_count, conversations.size,
primary_email_id_to_conversation.size,
+ initial_message_count);
+
// only do local-load if the Folder isn't completely opened, otherwise this operation
// will block other (more important) operations while it waits for the folder to
// remote-open
@@ -808,7 +822,7 @@ public class Geary.App.ConversationMonitor : BaseObject {
if (low_id != null && !is_insert) {
// Load at least as many messages as remaining conversations.
int num_to_load = Numeric.int_floor(min_window_count - conversations.size,
- WINDOW_FILL_MESSAGE_COUNT);
+ MIN_FILL_MESSAGE_COUNT);
yield load_by_id_async(low_id, num_to_load, Email.Field.NONE, flags, cancellable_monitor);
} else {
@@ -817,8 +831,16 @@ public class Geary.App.ConversationMonitor : BaseObject {
yield load_by_id_async(null, min_window_count, Email.Field.NONE, flags, cancellable_monitor);
}
- // Run again to make sure we're full unless we ran out of messages.
- if (get_email_count() != initial_message_count)
+ // Run again to make sure we're full ... precondition checking is relied on to prevent
+ // continuous looping of FillWindowOperations
+ bool rescheduled = false;
+ if (conversations.size < min_window_count) {
operation_queue.add(new FillWindowOperation(this, false));
+ rescheduled = true;
+ }
+
+ debug("fill_window_async: loaded from %s, email_count=%d primary_ids.size=%d conversations.size=%d
rescheduled=%s",
+ low_id != null ? low_id.to_string() : "(null)", get_email_count(),
primary_email_id_to_conversation.size,
+ conversations.size, rescheduled.to_string());
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]