* meson.build: Use libunwind and libunwind-generic to avoid having to
search for the platform-specific lib.
* src/meson.build: Set UNW_LOCAL_ONLY define to get the most optimal
unwind impl.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
(MinimalFolder.start_open_remote): Don't check to see if the timer is
running before opening the remote, just do it since this method is only
called when the remote should be opened.
(MinimalFolder.on_remote_ready): Only start opening the remote if
actually needed.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
(MinimalFolder.start_open_remote): Don't check to see if the timer is
running before opening the remote, just do it since this method is only
called when the remote should be opened.
(MinimalFolder.on_remote_ready): Only start opening the remote if
actually needed.
This lets valadoc build Geary's engine docs again as long as patches for
valadoc Bug 736483 and Bug 646982 are applied (which will hopefully be
merged for vala 0.40). Once Bug 792349 is also fixed, we'll be able to
generate private docs as well.
Since we are now noticing unsolicited FETCH data when open, we don't need
to periodically run the flag watcher — it only needs to be run when first
opening a folder, so do it then.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Move main flag watcher operation here, call it once the folder's remote
has opened. Remove use of EmailFlagWatcher.
* src/engine/imap-engine/imap-engine-email-flag-watcher.vala: Removed, no
longer used.
* src/engine/imap-engine/imap-engine-account-synchronizer.vala: Replace
the account synchronizer's queue and operations with two account
operations, one for simply refreshing folders and one for extanding the
vector back to the prefetch epoch.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Tell the prefetcher we've opened once the open count as incremented,
rather than when the remote is connected, so it isn't signalled
multiple times and hence doesn't add multiple listeners.
Actually process unsolicited FETCH responses from the server rather than
dropping them when in Selected state. This means we don't need to
periodically sync flags when a folder is open.
* src/engine/imap/api/imap-folder.vala (Folder): Add new updated signal,
fire it when an unsolicited FETCH is received. Keep FETCH (and SEARCH)
accumulators null when no operation is in progress so we know when a
FETCH is unsolicited.
(Folder::exec_commands_async): Make fetched and searched lists in-args
and let caller manage lifecycle of these collections, using them as the
accumulators.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (Move): Hook up
to new Imap.Folder updated signal when opening, queue the replay op
when it is fired.
* src/engine/imap-engine/replay-ops/imap-engine-replay-update.vala
(ReplayUpdate): New replay op for handling unsolicited FETCH responses.
Committing earlier makes it much more likely the commit will actually
happen before e.g. the user closes Geary or puts the computer to sleep,
but still leaving time for "oh-no" undos.
* src/engine/imap-engine/imap-engine-revokable-move.vala (RevokableMove):
Drop commit interval from 60s to 5s.
Now we are getting notified of folder chnages, we can sweep for folder
changes less often.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Bump remote folder refresh interval from 2 minutes to
15 minutes.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
(MinimalFolder::create_email_async): Send folders-contents-altered when
we have created a message.
* src/engine/imap-engine/imap-engine-account-synchronizer.vala
(AccountSynchronizer): Don't bother synchronising mail on send, since
we'll now get a folders-contents-altered signal when it's actually
saved instead.
Ensuring f-c-a is fired means that the background sync will pick up the
changes from the operations after they happen, rather than when the next
folder refresh happens.
* src/engine/imap-engine/imap-engine-generic-account.vala
(Account::update_folders): Provide a convenience singleton version of
::update_folders to fire folders_contents_altered.
* src/engine/imap-engine/imap-engine-generic-account.vala
(RefreshFolderUnseen): Update cached status values for a folder and
fire f-c-a signal, but only for folders that have changed.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
(MinimalFolder::copy_email_async): Fire f-c-a signal after the op
completes.
* src/engine/imap-engine/imap-engine-revokable-move.vala (RevokableMove),
src/engine/imap-engine/imap-engine-revokable-committed-move.vala
(RevokableCommittedMove): Notify contents have changed when a move is
revoked.
This might fix an issue where folders are duplicated in FolderTable in
the db are duplicated.
* src/engine/imap-db/imap-db-account.vala (Account::clone_folder_async):
Check the folder hasn't already been loaded before attempting to clone
it.
* src/engine/imap-engine/imap-engine-generic-account.vala (Account): Only
connect/disconnect to Imap.Account's ready signal when opening/closing
the account so we don't queue a UpdateRemoteFolders op before loading
local folders, but do queue one after a LoadFolders if the remote is
already ready.
(Account::update_remote_folders): Reset the update timer before
queuing the op in case one has been already been recently queued.
If the folder is open, we should be getting notifications of flag changes
from the server, so double-checking is kind of pointless, and since it's
implemented using an IMAP STATUS, also expensive for the server.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Convert refresh_unseen_async method into a new
RefreshFolderUnseen account operation, add a guard to ensure the folder
is closed when executing. Remove hash map of timeouts and replace with
a single timeout manager on MinimalFolder itself.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Add timeout manager for unseen update, only start it running if closed,
when triggered, schedule a RefreshFolderUnseen op on the account.
Also fixes special folders not being present when local folders have been
loaded, but remote folders have not.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Move code for enumerating local folders into new
LoadFolders operation and enumerating remote folders into new
UpdateRemoteFolders operation, and simplify implementation. Schedule
the first after opening and secule the second on the old timer and when
remote becomes ready. Replace build_folder(s) methods with new
simplified API for adding, updating and removing folders from the
account for operations. Grossly simplify implementation of
fetch_folder_async() to just return cached versions, since once the two
operations above have run, the caches should be entirely up to date.
* src/engine/api/geary-account.vala (Account): Split the
folders_added_removed signal into folders_created and folders_deleted,
since it makes the implementation a bit easier. Nothing is using them
at the moment anwyay.
This generalises the approach used to execute the flag watcher and
background sync, provides a high-level means of managing local and remote
operations, and provides a means of compartmentalising operation-specific
code.
* src/engine/imap-engine/imap-engine-account-operation.vala
(AccountProcessor): Interface for denoting classes that implements some
account-specific operation.
* src/engine/imap-engine/imap-engine-account-processor.vala
(AccountProcessor): Class to manage the operation queue and execute
operations.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Create and manage an instance of AccountProcessor,
add queue_operation method to allow operations to be queued.
This allows us to compile the engine tests against the internal VAPI, so
we can unit test internal classes.
* CMakeLists.txt: Add top-level targets test-engine-run and
test-client-run that execute the respective test binaries. Make
the tests target depend on them and make them depend on their
binaries.
* Makefile.in: Add test-client and test-engin targets for convenience.
* src/CMakeLists.txt: Make the right invocation of valac to generate a
correct geary-engine-internal.vapi. Make gsettings schema generation
depend on geary-client so it exists for test-client if the main binary
hasn't been built.
* test/CMakeLists.txt: Split everything up into to builds, one for
test-engine and the other for test-client. Use geary-engine-internal
when building test-engine for access to internal classes and members.
* test/engine/util-idle-manager-test.vala,
test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather
than the GTK main loop for pumping events so the test cases compile
without GTK.
* test/test-engine.vala, test/test-client.vala: New main source file for
test binaries based on old main.vala.
Mailbox would produce a FIFO or priority queue depending on if you pass
in a comparator or not. This adds additional constructors to make that
explicit, and also now allows the FIFO to have its own equality
function. Renames the class to something less confusing for an email
library.
Also adds doc comments for all public members.
* src/engine/nonblocking/nonblocking-queue.vala: Renamed from
nonblocking-mailbox.vala, rename class from Mailbox to Queue, rename
recv_async to just 'receive'. Provide full documentation
comments. Update call sites.
Not strictly necessary for this bug, but may as well since we're here.
* src/engine/imap-engine/imap-engine-email-prefetcher.vala
(EmailPrefetcher): Use a TimeoutManager and an explicit open and close
call from MinimalFolder.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (Folder): Add
open_cancellable member, construct new instance when opening and
cancell then null out when closing the folder.
* src/engine/api/geary-account.vala (Account): Add a doc comment for the
report_problem signal.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (Folder): Add
problem_report signal and notify_service_problem method for firting it.
* src/engine/imap-engine/imap-engine-generic-account.vala
(Account::build_folders): Connect problem_report from folder through to
the account.