Commit graph

3809 commits

Author SHA1 Message Date
Michael James Gratton
f1d3ff5303 Update INSTALL with GOA dependencies. 2018-05-28 01:32:25 +10:00
Michael James Gratton
25e2172e55 Merge branch 'wip/714876-goa-support'. Fixes Bug 714876. 2018-05-28 01:16:58 +10:00
Michael James Gratton
c29c8ba64f Merge branch 'wip/768975-service-info'. Fixes Bug 768975. 2018-05-28 01:00:59 +10:00
Michael James Gratton
e6891f528a Clean up Engine's account added/removed signals.
* 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.
2018-05-28 00:55:59 +10:00
Michael James Gratton
4b5aad833a Implement adding, updating and removing GOA accounts dynamically.
* 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.
2018-05-28 00:54:43 +10:00
Michael James Gratton
fbc6671e16 Fix up GOA branch to build with meson. 2018-05-28 00:46:31 +10:00
Oskar Viljasaar
5108a21def Implement GOA support for password-based accounts 2018-05-25 15:48:46 +10:00
Michael James Gratton
4e0950f9bc Introduce a ConfigFile class to improve config management.
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.
2018-05-25 15:42:56 +10:00
Michael James Gratton
f45357a50e Move Geary.CredentialsProvider to client, since it's client-specific. 2018-05-24 17:09:53 +10:00
Michael James Gratton
ad9907ac59 Remove all account uses of app and engine singletons, app builder method. 2018-05-24 17:02:05 +10:00
Michael James Gratton
4fdeb9db47 Ensure AccountInformation objects always have valid IMAP/SMTP services.
* 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.
2018-05-24 16:52:54 +10:00
Michael James Gratton
91e85a6647 Make EngineTest a bit more robust. 2018-05-24 15:52:36 +10:00
Michael James Gratton
1bfdfde249 Fix account deletion, ensure any problems doing so are reported. 2018-05-24 15:51:29 +10:00
Michael James Gratton
8539ef1214 Make EngineTest a bit more robust. 2018-05-24 15:50:13 +10:00
Michael James Gratton
17644aca64 Fix account deletion, ensure any problems doing so are reported. 2018-05-24 15:49:52 +10:00
Michael James Gratton
a50de19dd7 Clean up AccountInformation a bit. 2018-05-24 15:41:20 +10:00
Michael James Gratton
ebf499927c Make KeyFile arg mandatory when loading/saving service information.
* 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.
2018-05-24 15:38:42 +10:00
Michael James Gratton
0d3f10f51f Clean up user directory management.
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.
2018-05-24 15:34:29 +10:00
Michael James Gratton
9a05c25e68 Tidy up account loading from disk.
* 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.
2018-05-24 12:15:02 +10:00
Michael James Gratton
65bbf5bf20 Minor code cleanup. 2018-05-24 11:28:23 +10:00
Michael James Gratton
d11dc07297 Ensure accounts are deleted from disk when they are deleted by the user. 2018-05-24 11:27:35 +10:00
Michael James Gratton
24453aef2e Ensure account info is saved when special folder config changes.
* 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.
2018-05-24 11:25:30 +10:00
Michael James Gratton
602fc5352c Make loading accounts more robust in the face of config errors.
* 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.
2018-05-24 11:22:29 +10:00
Michael James Gratton
253719e1fc Make AccountManager an instance property of the controller.
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.
2018-05-24 11:19:33 +10:00
Michael James Gratton
eb3e56c58e Fix a critical warning on shutdown. 2018-05-24 11:01:28 +10:00
Michael James Gratton
bcb7d6a0dd Remove stdout-based debug logging. 2018-05-23 22:54:09 +10:00
Michael James Gratton
48ee9a01aa Clean up po/POFILES.in 2018-05-23 18:51:08 +10:00
Michael James Gratton
9f3ec5bfcb Update unit tests to work with ServiceInfo API changes. 2018-05-23 17:53:23 +10:00
Michael James Gratton
7e089dd6f1 Merge branch 'master' into wip/768975-service-info 2018-05-23 16:34:23 +10:00
Michael James Gratton
f290786a5c Ensure engine tests are re-built when the engine changes. 2018-05-23 11:24:05 +10:00
Michael James Gratton
c024ca8711 Update internal VAPI kludge to work with newer version of Meson. 2018-05-23 11:23:09 +10:00
Michael James Gratton
4ac7c10f38 Provide and use an async make_directory_with_parents in Db.Database. 2018-05-21 21:08:00 +10:00
Michael James Gratton
1b49fc1104 Ensure Db.Database corruption check doesn't fail on missing DB file.
* src/engine/db/db-database.vala (Context): Only run the corruption check
  if there is a DB file and the file exists. Add unit tests.
2018-05-21 21:01:34 +10:00
Michael James Gratton
8d3b16ca68 Fix as many valac deprecation and valadoc unused warnings as poss. 2018-05-21 18:39:01 +10:00
Michael James Gratton
2b1f0e8a90 More dependency cleanup.
* debian/control: Remove version numbers from packages that aren't
  strictly required.

* meson.build: Fix dup sqlite3 dep, sort primary deps.
2018-05-21 10:41:35 +10:00
Michael James Gratton
65b44c3b3a Don't strip CRLF from iCal, vCard, and other formats that requires them.
* src/engine/rfc822/rfc822-part.vala (Part): Add a blacklist for text
  types that shouldn't have CRLF's stripped. Add unit tests.
2018-05-20 12:51:59 +10:00
Michael James Gratton
440a4d5932 Merge branch 'wip/726281-text-attachment-crlf'. Fixes Bug 726281. 2018-05-19 14:59:10 +10:00
Michael James Gratton
fe9461e439 Add a unit test for upgrading an actual Geary v0.6 database. 2018-05-19 14:55:19 +10:00
Michael James Gratton
386f9864c7 Revert "Merge branch 'wip/ricotz/webkit'. Fixes Bug 788113."
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.
2018-05-19 13:57:58 +10:00
Michael James Gratton
d4aaa3c551 Bump library dependency min versions to reflect reality.
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.
2018-05-19 10:32:45 +10:00
Michael James Gratton
43341cd3e3 Merge branch 'wip/ricotz/webkit'. Fixes Bug 788113.
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.
2018-05-19 10:06:45 +10:00
Michael James Gratton
f78939ce00 Push GResource URL for test data down so it's accessible to all tests. 2018-05-19 09:26:09 +10:00
Michael James Gratton
d91dd36484 Update unit tests to ensure text attachments saved without CRLF. 2018-05-19 09:26:09 +10:00
Michael James Gratton
ffb4befdd8 Merge branch 'wip/795906-turkish-locale'. Fixes Bug 795906. 2018-05-17 15:43:16 +10:00
Michael James Gratton
967e401c21 Replace custom and extern functions in Geary.Ascii with stdlib equivs.
This partially re-instates commit 1d8c4aea, without breaking anything
when running the client using the tr_TR.UTF-8 locale.
2018-05-17 15:41:28 +10:00
Michael James Gratton
ba861b8ed1 Fix failing RFC822.Mailbox test.
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.
2018-05-17 15:41:28 +10:00
Michael James Gratton
40d9b77999 Revert "Remove a number of redundant fns in Engine.Util.Ascii."
This reverts commit 1d8c4aea80.

Fixes Bug 795906.
2018-05-10 15:18:32 +10:00
Michael James Gratton
f1c797650f Ensure we always use the one, same codepath when decoding text content.
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.
2018-05-10 13:53:24 +10:00
Michael James Gratton
bfe665d1a0 Add unit tests for Geary.RFC822.Message body content, fix a few issues.
* 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.
2018-05-10 13:53:24 +10:00
Michael James Gratton
a2a95686b4 Support default content types for both displayed and attached entities.
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.
2018-05-10 13:53:24 +10:00