* 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.
* src/client/accounts/account-manager.vala (AccountManager): Add signals
to track when SSO accounts are updated or removed. Listen to the GOA
service for account changes and do the right thing when they occur.
* src/client/application/geary-controller.vala (GearyController): Listen
for AccountManager SSO signals and handle accordingly.
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.
* src/client/accounts/account-manager.vala (AccountManager): Don't try
creating any directories when loading accounts, deal with config dir
not being present gracefully, streamline IO when loading a tiny bit by
loading file info in batches.
* src/client/application/geary-controller.vala (GearyController): Save
account info when special folders change.
* src/client/accounts/account-manager.vala (AccountManager): Ensure
saving info is serialised so that multiple writes cannot be attempted
simultaneously.
* src/engine/api/geary-account-information.vala (AccountInformation): Add
a save lock to use when serialising saving info instances.
* src/client/accounts/account-manager.vala (AccountManager): Just warn
when encountering a bogus account, don't stop loading.
* src/client/application/geary-controller.vala (GearyController): Just
warn when encountering an error when loading accounts, don't error
since that will quit the application.
This lets us convert the static methods to instance methods, pass an
instance of the Engine in so it doesn't need to use the global singleton
to access it, and in the future will provide a place to keep the GOA
service needed to be notified of accounts being added, changed and
removed there.
* src/client/accounts/account-manager.vala (AccountManager): Add an
Engine instance field, set it in the ctor, and use that rather than the
global singleton instance. Make static methods non-static.
* src/client/application/geary-controller.vala (GearyController): Add an
account manager property, populate it when opening the controller. Use
that for creating/saving accounts.
* src/client/accounts/account-dialog.vala (AccountDialog),
src/client/accounts/account-dialog-account-list-pane.vala
(AccountDialogAccountListPane): Add GearyApplication as a private field
so it can access an AccountManager instance for managing accounts. Pass
an instance in to the ctor and update call sites. Use that instance to
access the controller, engine, etc throughout instead of the global
singleton accessors.
This reverts commit 43341cd3e3, reversing
changes made to ffb4befdd8.
This is causing segfault in Geary.JS.to_string_released() when running
client tests, so reverting until a solution is found.
Commit 43341cd3 basically means we require vala 0.38, which excludes
Debian 9 (stretch), Ubuntu 16.04 (artful) and Fedora 26. Hence bump
minimum versions (and tidy up the list of deps) to reflect this.
This became necessary sooner rather than later since WebKitGTK 2.21
with the upstream valac bindings are now incompatible with the custom
in-source bindings.
Reverting commit 1d8c4aea broke the mailbox class a bit. This fixes the
issue, introduces Ascii.last_index_of which is needed by Mailbox anyway,
and adds some test for it. Also 'optimises' Ascii.index_of bit as well.
This introduces the Geary.RFC822.Part class, which provides a place to
MIME entity body decoding code so it can be reused when needed. It also
provides a place to put common GMime to Geary object conversion, and
apply some common policy decisions, such as what is the default content
type if none is specified.
* src/engine/rfc822/rfc822-part.vala: New Part class that represents a
MIME entity. Move code for both decoding entity body from
RFC822.Message and code for cleaning content filename from RFC822.Util
to here. Convert GMime entity header objects into their Geary
equivalents and make available as properties. Provide a common means of
determining the content type of the part if not explicitly set.
* src/engine/rfc822/rfc822-message-data.vala (PreviewText.with_header):
Construct a RFC822.Part and use that for decoding preview text. Swap
args to make some more sense and update call sites.
* src/engine/rfc822/rfc822-message.vala (InlinePartReplacer): Simply pass
through an instance of a RFC822.Part rather than the multi-arg list,
since that has all the data needed by replacers.
* src/engine/imap-db/imap-db-attachment.vala (Attachment): Require and
use RFC822.Part instances for obtaining attachment bodies rather than
GMime.Part instances. Update call sites.
* src/engine/rfc822/rfc822-message.vala (Message): Fix has_plain_body(),
handle the case where displayed MIME entities (as opposed to attached
ones) with no Content-Type default to US-ASCII, per the RFC.
* test/engine/rfc822-message-test.vala (MessageTest): Add tests for
testing and accessing body content as both plain text and HTML. Use
GResources for accessing test message bodies rather than extremely long
const strings.
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.