* src/engine/api/geary-credentials.vala (Credentials): Refer to auth
tokens, not passwords, so we can use the same object for OAuth2
auth. Update call sites.
* src/engine/api/geary-credentials-mediator.vala (CredentialsMediator):
Refer to auth tokens, not passwords, so we can use the same object for
OAuth2 auth. Remove saving and clearing methods from the interface
since that's only supported for password storage, not SSO like
GOA. Update implementations and call sites.
* src/engine/api/geary-account-information.vala (AccountInformation):
Replace many byzantine auth management methods with just a few for
handling loading and prompting. Remove ServiceFlag enum now it is no
longer used. Clean up call sites.
* src/client/accounts/account-manager.vala (AccountInformation): Manage
initial saving and final deletion of libsecret based accounts here,
rather than all over the code base.
* src/engine/api/geary-engine.vala (Engine): Move account_added and
account_removed signals to AccountRemoved since the engine isn't
tracking this any more. Remove bool param from add_account for the same
reason and update call sites.
ConfigFile is a GLib.KeyFile-like class (and is backed by a KeyFile) that
nonetheless provides convenient a high-level API for getting and setting
grouped config values and asynchronous loading and saving.
* src/engine/util/util-config-file.vala: New ConfigFile class.
* src/engine/api/geary-service-information.vala (ServiceInformation):
Require ConfigFile groups rather than KeyFile instances for loading and
saving. Update subclasses and unit tests.
* src/client/accounts/account-manager.vala (AccountManager): Move generic
account key consts here from Config. Instead of using KeyFile directly,
use ConfigFile groups for loading and saving settings. Rename load and
save methods to be a bit more consistent with the class's role, and
make save_account() throw its errors so they can be reported to the
user. Update call sites.
* src/client/accounts/local-service-information.vala
(LocalServiceInformation): Move service-specific config key consts
here, use new ConfigFile groups for loading and saving.
* src/engine/api/geary-config.vala: Removed, all config consts have been
moved to the classes using them and KeyFile convenience methods
subsumed by ConfigFile.
* src/engine/api/geary-engine.vala (Engine): Require a ServiceInformation
object for IMAP and SMTP when creating orphan info objects. Update call
sites.
* src/client/accounts/account-manager.vala (AccountManager): provide
factory methods for constructing local service info objects. Use these
when re-constituting accounts. Use a singleton SecretMediator object
instance as a bonus.
* src/client/accounts/add-edit-page.vala (AddEditPage): Get
ServiceInformation objects from the account manager, pass an instance
of GearyApplication through so it has access to the manager. Update
call chains back to GearyController to pass the app instance through.
* src/engine/api/geary-service-information.vala (ServiceInformation):
Make KeyFile arg mandator for load and save methods, since it will
always need to be provided. Update subclasses.
* src/client/accounts/local-service-information.vala
(LocalServiceInformation): Remove from Geary package since it's not an
engine class. Update call sites.
Instead of passing in user config and data base dirs to the Engine from
the app, then pulling them out from the engine again from the app, just
store them in AccountManager, since that's where they are needed.
* src/client/accounts/account-manager.vala (AccountManager): Store user
config and data base dirs directly rather than getting them from the
engine. Split account directory creation out into a separate method so
they aren't re-made every time the config is saved.
* src/engine/api/geary-engine.vala (Engine): Remove user config and data
dir properties and open_async args. Update call sites and unit tests.
* src/client/application/geary-controller.vala (GearyController): Chase
AccountManager and Engine API changes. Ensure account dirs are created
when an new account is added.
* src/engine/api/geary-account-information.vala (AccountInformation):
Explicitly track copies rather relying on account dirs being
null. Don't require dirs be set in the default ctor, since they won't
be known, provide a method for updating them later on instead.
This replaces the const ContentType.DEFAULT_CONTENT_TYPE string and
related code with static defaults for both displayed and attached MIME
entities.
* src/engine/mime/mime-content-type.vala (ContentType): Replace
DEFAULT_CONTENT_TYPE const with static DISPLAY_DEFAULT and
ATTACHMENT_DEFAULT static instances. Remove is_default() since that no
longer makes sense. Update call sites and unit tests.
* src/engine/mime/mime-content-parameters.vala (ContentParameters): Make
the class immutable so it is safe to be used as a component of the
static ContentType DISPLAY_DEFAULT and ATTACHMENT_DEFAULT members.
This mostly aims to make the Geary.Attachment and ImapDB.Attachment
objects usable more generally for managing attachments, allowing
these to be instantiated once, persisted, and then reused, rather than
going through a number of representations (GMime, SQlite, Geary) and
having to be saved and re-loaded.
* src/engine/api/geary-attachment.vala (Attachment): Remove id property
and allow both file and filesize properties to be set after instances
are constructed. Update call sites.
* src/engine/api/geary-email.vala (Email): Remove get_attachment_by_id
since it unused.
* src/engine/imap-db/imap-db-attachment.vala (Attachment): Chase
Geary.Attachment API changes, move object-specific persistence code
into methods on the actual object class itself and modernise a
bit. Rename static methods to be a bit more terse. Update call sites
and add unit tests.
* src/engine/imap-db/imap-db-folder.vala (Folder): Rather than saving
attachments to the db then reloading them to add them to their email
objects, just instantiate Attachment instances once, save and then add
them.
* src/engine/imap-db/imap-db-gc.vala (GC): Replace custom SQL with
existing accessor for listing attachments.
* src/engine/util/util-stream.vala (MimeOutputStream): New adaptor class
for GMime streams to GIO output streams.
* 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.
* test/engine/api/geary-email-properties-test.vala: Add new mock
EmailProperties object.
* test/engine/app/app-conversation-test.vala (ConversationTest): Set
email sent and received dates to suppress warnings adding them to
Conversation instances.
* test/engine/app/app-conversation-set-test.vala (ConversationSetTest):
Set email sent and received dates to suppress warnings adding them to
Conversation instances, handle both casees when merging two
conversations, that the first was merged to the second and vice versa.
This commit makes the Imap.Account and Imap.Folder classes work somewhat
more like Imap.ClientSession, in that they have become higher-level
wrappers around ClientSession which come and go as the client session
does (i.e. as the connection to the IMAP server comes and goes). Further,
partly decouple account session lifecycle in ImapEngine.GenericAccount
and the folder session in ImapEngine.MinimalFolder from those objects
being opened/closed, so that sessions are created only when open /and/
the IMAP server is available, and disconnected on close /or/ when the
underlying connection goes away.
As a result, GenericAccount and MinimalFolder no longer claims a client
session on open and try to keep it forever. Instead if needed, they wait
for the server to become contactable.
This makes Geary much more robust in the face of changing network
connections - when working offline, resuming after sleep, and so on.
* src/engine/api/geary-engine.vala (Engine::create_orphan_account): Fix
sense of test when determining the next account id to use. Add unit
tests.
(Engine::add_account): Made public so it can be used in public test.
This restores some old behaviour after teh WK2 port.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage): Add alt_text param to ::save_image
signal. Replace ::set_action_param_string with
::set_action_param_string so we can pass a (url, alt_text) tuple for
the save_image tuple and update call sites. Set this tuple for the
action when enabling it, and pass the two values to the ::save_image
signal handler when activated.
* src/engine/api/geary-attachment.vala (Attachment::get_safe_file_name):
Add alt_file_name param method, use that when constructing a file
name. Add doc comment, test.
* src/client/application/geary-controller.vala: Updated to pass alt text
from save_imge signal emission all thr way through to
get_safe_file_name.
This ensures both inline images are saved using the specified content
filename, if any, and that an extension is attempted to be guessed when
no filename is specified.
Fixes Bug 713999, Bug 712923, Bug 778026.
* src/client/application/geary-controller.vala: Major rework of how
attachments are saved. Rework how save dialogs are constructed,
combining common code paths into one constrcutor method. Split up code
for saving one attachment vs many into two different methods. Ensure
all code baths ultimately use the same method to do the actual
saving. Lookup a attachment when saving an inline image and use that
by default. Get filenames from new Attachment::get_useful_filename
method that guesses if needed.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::save_image): Fix name of first param to reflect
what it actually is.
* src/engine/api/geary-attachment.vala (Attachment): Add
::get_safe_filename method that checks the type of both the
attachment's content and its file name, if any. Will construct an
appropriate file name if non is given. Add unit tests.
* src/engine/api/geary-email.vala (Email): Add new
::get_attachment_by_content_id to lookup attachments by MIME
content-id. Rename old ::get_attachment method to disambiguate.