Folder no longer attempts to download existing messages when re-selected: #3851
The SQLite Geary.Folder implementation now uses reference semantics, so when it's reselected the same Folder object is used and in-memory state is consistent. Also found an off-by-one error when first querying an IMAP Folder that caused the most recent new email not to be downloaded the first time. Fixed as well in this commit.
This commit is contained in:
parent
b1775ae879
commit
8b26d6d112
8 changed files with 91 additions and 19 deletions
|
|
@ -7,7 +7,10 @@
|
|||
// TODO: This class currently deals with generic email storage as well as IMAP-specific issues; in
|
||||
// the future, to support other email services, will need to break this up.
|
||||
|
||||
public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder, Geary.Imap.FolderExtensions {
|
||||
public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder, Geary.Imap.FolderExtensions,
|
||||
Geary.ReferenceSemantics {
|
||||
protected int manual_ref_count { get; protected set; }
|
||||
|
||||
private MailDatabase db;
|
||||
private FolderRow folder_row;
|
||||
private Geary.Imap.FolderProperties? properties;
|
||||
|
|
@ -17,11 +20,11 @@ public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder, Gear
|
|||
private Geary.FolderPath path;
|
||||
private bool opened = false;
|
||||
|
||||
internal Folder(ImapDatabase db, FolderRow folder_row, ImapFolderPropertiesRow? properties,
|
||||
internal Folder(ImapDatabase db, FolderRow folder_row, Geary.Imap.FolderProperties? properties,
|
||||
Geary.FolderPath path) throws Error {
|
||||
this.db = db;
|
||||
this.folder_row = folder_row;
|
||||
this.properties = (properties != null) ? properties.get_imap_folder_properties() : null;
|
||||
this.properties = properties;
|
||||
this.path = path;
|
||||
|
||||
message_table = db.get_message_table();
|
||||
|
|
@ -39,9 +42,14 @@ public class Geary.Sqlite.Folder : Geary.AbstractFolder, Geary.LocalFolder, Gear
|
|||
}
|
||||
|
||||
public override Geary.FolderProperties? get_properties() {
|
||||
// TODO: TBD: alteration/updated signals for folders
|
||||
return properties;
|
||||
}
|
||||
|
||||
internal void update_properties(Geary.Imap.FolderProperties? properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public override async void open_async(bool readonly, Cancellable? cancellable = null) throws Error {
|
||||
if (opened)
|
||||
throw new EngineError.ALREADY_OPEN("%s already open", to_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue