* ui/composer-widget.ui: Make the info label esliipsisable, but give it a
reasonable minimum size.
* src/client/composer/composer-widget.vala (ComposerWidget): Set the info
label's tooltip with the text so it can still be read when ellipsed.
* src/client/composer/composer-widget.vala (Composer): Replace use of
inappropriate public properties and obtuse property bindings with a
subject_changed signal and private properties that update the info
label in their setter, so it's obvious how the whole thing works. Move
code for managing a detached compoer's window title to the
ComposerWindow class.
This also ensure that if the user causes the from account quickly, that
there isn't any undesirable interleaving of drafts managers as multiple
instances are possibly opened and closed.
Fixes 778976.
* src/client/composer/composer-widget.vala (ComposerWidget): When
reopening the draft manager and one exists already, discard its draft
first. When opening a new draft manager, use a cancellable to stop any
existing draft manager being opened, and to close any being opened when
the widget is destroyed. Use a private var when opening/closing the
draft managers so the class field is only updated when the instance has
fully opened and as soon as it starts to be closed.
Fixes Bug 793710.
* src/client/composer/composer-headerbar.vala (ComposerHeaderbar): Ensure
we actually get notified when the user changes their decoration prefs
and update detach button location correctly.
* ui/composer-headerbar.ui: Make start detach button's image visible by
default.
* src/client/conversation-viewer/conversation-email.vala
(MessageViewIterator): Fix class to actually obey Gee.Iterator and
Gee.Traversable.foreach contracts, so the first attached message has
its body loaded when the email is loaded.
Follow-up to Bug 776881 and commit e333794f, fixes Bug 794264.
* src/client/application/geary-application.vala,
src/client/composer/composer-container.vala: Use
GLib.get_monotonic_time() instead of get_real_time() when calling
Gtk.Window.present_with_time to avoid issues with mutter/gnome-shell
alt-tabbing.
It looks like Gtk.Spinner triggers repaints when running, even when the
widget is not visible. This ensures the conversation is stopped when not
visible.
Fix for Bug 783025.
* src/client/conversation-viewer/conversation-viewer.vala
(ConversationViewer): Start the conversation spinner when showing it,
stop the conversation spinner when it is hidden.
* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
Don't check the folder blacklist for external folder signals when the
signal is received, do it when the operation is executed so it's fresh.
* src/engine/app/conversation-monitor/app-fill-window-operation.vala
(FillWindowOperation): Only re-fill the conversation if we get a full
load, anything else means we hit the end of the folder.
* test/engine/app/app-conversation-monitor-test.vala: New unit tests
for ConversationMonitor.
* test/engine/api/geary-account-mock.vala,
test/engine/api/geary-folder-mock.vala: Mix in MockObject mock up all
method calls.
* test/engine/api/geary-email-identifier-mock.vala: Fix the comparator
method when the other instance is null.
This replaces the use of Geary.Folder.find_boundaries_async in
ConversationMonitor with a simple sorted set of known in-folder message
ids. This is both easy and fast, reduces needless DB load when loading
conversations, and also allows allows removing what is otherwise
single-use implementation overhead in classes deriving from Folder.
* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
Replace get_lowest_email_id_async() with window_lowest property, update
call sites. Implement the property by using a sorted set of known
listed email ids from the base folder. Update the set as messages in
the base folder are listed. Rename notify_emails_removed to just
removed and remove ids from the set if any messages from the base
folder are removed.
* src/engine/api/geary-folder.vala (Folder): Remove
get_lowest_email_id_async since it is now unused, do same for all
subclasses.
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
not *-test.vala.
* test/testcase.vala: Renamed to test-case.vala for consistency, remove
TestCase class from Gee package since that's really not true. Clean up
code for consistency.
* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
into a separate test lib.
Really (for sure this time) ensure folder opening/closing is not racy by
using the same mutex to guard the complete opening and closing processes.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Rename open_mutex to remote_mutex since it's only actually used when
opening a remote session. Rename close_mutex to lifecycle_mutex and
ensure that has always been claimed when manipulating the
open_count. In particular, ensure that all of open_async is executed
under that mutex and ensure that both decrementing the close count, and
the complete actual closing process is always protected by it as well.
Conversation monitor was built around older assumptions of how a folder's
remote connections work - that once a folder opens it will likely also
eventually establish a remote connection, that once the connection is up
it will hang around, and so on.
This patch removes any public notion of (re)seeding, since it can't be
relied to actually happen over the course of the session, ensures that
all folder operations are local-only when the folder does not have a
working remote connection so it doesn't block, and take the opportunity
to reorganise and clean up the monitor API and documentation comments.
* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
Remove seed signals, and don't bother running an initial reseed if the
folder is already open, since the fill operation will cause any locally
incomplete messages to be filled out from the report. Manage and use an
internal Cancellable for cancelling internal operations when shutting
down. Construct a queue only when starting to monitor conversations,
delete it when stopping. Move as much operation-specific code into the
operations themselves as reasonably possible, making some methods
internal so thy can be accessed from the ops. Ensure all folder listing
operations specify LOCAL_ONLY when the remote is not open. Removed
LocalLoadOperation since that is now redundant. Update the API for
accessing conversations to match Gee conventions and update call
sites. Update documentation comments. Hook back up to locally-complete
signals so we don't miss emails being filled out by the prefetcher, for
now.
* src/engine/app/conversation-monitor/app-conversation-set.vala
(ConversationSet): Rename conversations property to match Gee
conventions, update call sites.
* src/engine/app/conversation-monitor/app-conversation-operation.vala
(ConversationOperation): Allow operations to specify if they should
allow duplicates, and allow the execution method to throw errors, so
they can be handled in a uniform way.
* src/engine/app/conversation-monitor/app-conversation-operation-queue.vala
(ConversationOperationQueue): Accept progress monitor property as a
ctor arg rather than constructing on itself, so it is tied to the
life-cycle of the ConversationMonitor rather than the queue. Add a
signal for notifying of errors thrown when running operations, and use
the new operation-independent support for determining if duplicates
should be queued.
* src/engine/app/conversation-monitor/app-fill-window-operation.vala
(FillWindowOperation): Enforce a maximum window size as well as minimum
to keep loading large windows semi-responsive. Remove code to handle
inserts now that they are handled by their own op.
* src/engine/app/conversation-monitor/app-insert-operation.vala
(InsertOperation): New operation to manage inserts, handle it them by
simply adding them to the conversation if they are newer than the
oldest message, rather that relisting all loaded messages.
Close released client sessions when there are too many, and try harder to
not give out bad sessions when one is being claimed.
* src/engine/imap/transport/imap-client-session-manager.vala
(ClientSessionManager): Add a maximum free session tunable and release
any client sessions returned if it would otherwise exceed this
threshold. When claiming a session, ensure that an older session is
still good by sending a NOOP before returning it.
This ensures that when an account synchroniser account op completes and
its folder is closing completely, that it waits for this to complete
fully. Thus when the next op executes, it can re-use the same client
session.
This, along with recent other recent changes on the branch, gets the
total client session count on app start down to 2 simultaneous
connections only, instead of 3 or 4.
* src/engine/imap-engine/imap-engine-account-synchronizer.vala
(RefreshFolderSync): If closing the folder causes it to be completely
closed, wait for that to happen so the session is released to the pool
before the next op runs.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Make close_remote_session async so it can wait for the session to be
fully released, including returning the session to the pool. Update
call sites.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Make release_folder_session async so that
MinimalFolder can wait for it to be fully released, including returning
the session from Selected state. Update call sites.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Don't attempt to claim two client sessions when
opening a folder, rather claim one and use as both an account session
and a folder session. Rename open_folder_session to
claim_folder_session to be consistent with account session API, update
call sites.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (MinimalFolder):
Ensure the remote session is automatically re-established if
appropriate on disconnect. Tidy up debug output and some comments.
For most of the time, GenericAccount does not need an open client
session, yet it always claims one from the pool on open and hangs on to
it. This means that the account synchroniser for example cannot use the
same session to perform sync, requiring an additional session to be
opened.
This patch removes the held session with methods to claim and release
account sessions instances for those code paths that need it, allowing
the previously claimed session to be re-used when not in use.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Remove remote_open_lock and remote_session, just
claim new client sessions from the pool as needed instead. Add
release_account_session to allow claimed sessions to be returned to the
pool. Update uses of remote_session to claim and release instead.
* src/engine/imap/transport/imap-client-session-manager.vala
(ClientSessionManager): Update ready signal to include a parameter
indicating if ready or not, so GenericAccount can still block
claim_account_session callers when not ready. Rework all code that sets
is_ready to use a common notify method that both does that and fires
the signal, and rework all code paths that stop the pool to use a
common code path that uniformly resets timers, notifies no longer
ready, and drops all client sessions.
* src/engine/imap/api/imap-account-session.vala: Remove distinction
between fetch_folder_async and fetch_folder_cached_async
since account session objects are now short-lived.
* src/client/application/geary-controller.vala (GearyController): Rather
than using several per-account maps, one for each type of related
object, introduce an AccountContext object that collects all related
objects together and use a single map from an account's info object to
the context object. When closing the controller, close each account in
the same way as it would be done if the account was closed normally, so
that the same cleanup occurs.
* src/client/components/client-web-view.vala (ClientWebView): Fix
instances being leaked due to circular ref when registering JS message
handlers.
* src/engine/util/util-idle-manager.vala,
src/engine/util/util-timeout-manager.vala: Fix instances and classes
using these being leaked due to reference loop when used with closures
as callbacks.
This splits Geary.BaseObject up into a class an interface so that classes
derived from a pre-existing, non-GLib.Object class can still use the
reference tracking infrastructure, and adds the mixin interface to a
number of key client classes such as MainWindow and ClientWebView.
* src/engine/api/geary-base-object.vala: Split Geary.BaseObject up into a
class an interface so that classed derived from a pre-existing,
non-GLib.Object class can still use the reference tracking
infrastructure.
* src/client/application/geary-application.vala (Application): Use
Application.quit to exit normally rather Gtk.main_quit so that control
is returned to the main() entry-point.