Merge branch 'master' into bug/5224-dovecot

This commit is contained in:
Jim Nelson 2013-06-10 20:08:21 -07:00
commit 52663cff0b
3 changed files with 37 additions and 0 deletions

View file

@ -43,6 +43,7 @@ public class ConversationListStore : Gtk.ListStore {
private bool loading_local_only = true;
private int conversations_added_counter = 0;
private Geary.Nonblocking.Mutex refresh_mutex = new Geary.Nonblocking.Mutex();
private uint update_id = 0;
public signal void conversations_added_began();
@ -54,10 +55,14 @@ public class ConversationListStore : Gtk.ListStore {
set_sort_column_id(Gtk.SortColumn.DEFAULT, Gtk.SortType.DESCENDING);
GearyApplication.instance.config.display_preview_changed.connect(on_display_preview_changed);
update_id = Timeout.add_seconds_full(Priority.LOW, 60 * 60, update_date_strings); // every hour
}
~ConversationListStore() {
set_conversation_monitor(null);
if (update_id != 0)
Source.remove(update_id);
}
public void set_conversation_monitor(Geary.ConversationMonitor? new_conversation_monitor) {
@ -453,5 +458,22 @@ public class ConversationListStore : Gtk.ListStore {
return compare_conversation_ascending(a, b);
}
private bool update_date_strings() {
this.foreach(update_date_string);
// Keep calling this SourceFunc
return true;
}
private bool update_date_string(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {
FormattedConversationData? message_data;
model.get(iter, Column.CONVERSATION_DATA, out message_data);
if (message_data != null && message_data.update_date_string())
row_changed(path, iter);
// Continue iterating, don't stop
return false;
}
}

View file

@ -115,6 +115,19 @@ public class FormattedConversationData : Geary.BaseObject {
this.num_emails = conversation.get_count();
}
public bool update_date_string() {
if (preview.date == null) {
return false;
}
string new_date = Date.pretty_print(preview.date.value,
GearyApplication.instance.config.clock_format);
if (new_date == date) {
return false;
}
date = new_date;
return true;
}
// Creates an example message (used interally for styling calculations.)
public FormattedConversationData.create_example() {
this.is_unread = false;

View file

@ -795,6 +795,8 @@ public class Geary.ConversationMonitor : BaseObject {
conversation.to_string(), removed_id.to_string());
}
}
conversation.clear_owner();
}
// for Conversations that have been removed, don't notify they're trimmed