* test/client/application/geary-configuration-test.vala: New unit test
for Configuration class.
* test/main.vala: Add new unit test to the client suite, ensure the
memory GSettings backend is used as the default so we get default
setting values, and never save any changes made.
* test/CMakeLists.txt: Add new unit test source.
* src/client/application/geary-config.vala: Tidy up code a bit to adhere
to code conventions.
* test/CMakeLists.txt: Add client lib and dependent packages to the
build.
* test/main.vala (main): Add test suites for both client and engine
tests to allow some more fine-grained control when running them. Also
add some sectioning doc comments.
This allows unit tests to link against client code for testing.
* src/CMakeLists.txt: Add a new geary-client static lib to the build,
that compiles all client code (except main.vala) as the executable
previously did, and generates a VAPI for it. Make the target for the
client then binary simply compile main.vala and link in the client
lib.
* src/client/application/geary-config.vala,
src/client/util/util-migrate.vala: Fix errors reported vy valac when
attempting to use the client lib VAPI.
* src/CMakeLists.txt, test/CMakeLists.txt: Rename engine lib to
geary-engine, add it to valac compilation steps via their list of
dependent packages, rather than as custom VAPIs.
This also makes the dependency betwen the client binary adn the webkit
CAPI generation explicit, and makes CLIENT_PACKAGES both complete and
less confusing.
* src/CMakeLists.txt: Add a custom target for webkit VAPI generation with
the VAPI as a dependency, so we can add that as a dependency of the
geary target, which means we won't need to use the ValaPrecompile
CUSTOM_VAPIS to add the dependency for us. With that in place, we can
simply add webkit to the client packages.
Fixes Base64 encoded parts when fetching PREVIEW, and armour, etc
stripping etc not being applied to previews geneated via
Geary.RFC822.Message.
* src/engine/rfc822/rfc822-utils.vala
(Geary.RFC822.Utils::to_preview_text): Assume line endings are LF
encoded, update doc comment and unit tests to reflect that.
* src/engine/rfc822/rfc822-message-data.vala (PreviewText.with_header):
Add CRLF filter to preveiw text to strip CR chars from lines.
Since currently, PREVIEW has some bad assumptions, we want to avoid using
it. As a workaround, when listing messages with PREVIEW, include ALL so
that HEADER and BODY are also retreived and the preview can synthesised,
also NONE to ensure that after setting ALL, UIDs will be returned in the
result.
Bug 714317.
* src/client/conversation-list/conversation-list-store.vala
(ConversationListStore): Include ALL and NONE in WITH_PREVIEW_FIELDS.
* src/client/conversation-viewer/conversation-list-box.vala
(ConversationListBox): Remove PREVIEW from REQUIRED_FIELDS, it's no
longer needed.
Since we can now generate a preview for a Geary.Email if it can construct
its RFC822 message, if a PREVIEW is requested and both both HEADER and
BODY are also requested, don't issue a seperate command for the PREVIEW.
As a result, messages downloaded via the email prefetcher will get
previews based on the complete message body.
* src/engine/imap-engine/imap-engine-email-prefetcher.vala: Update the
comment about synthesise ENVELOPE and PREVIEW, since we now do just
that from PREVIEW.
* src/engine/imap/api/imap-folder.vala (Folder::assemble_list_commands):
If the requested flags contains PREVIEW, but BODY and HEADER are also
requested, don't bother adding in additional commands for the PREVIEW.
(Folder::fetched_data_to_email): When setting the body, see if we can
also set the preview and if so, do so.
Bug 772607.
* src/engine/rfc822/rfc822-utils.vala (Geary.RFC822.Utils): Don't
truncate the preview here - fetch preview will already be truncated,
and the conversation message preview needs the full text anyway. Update
unit tests.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::ConversationMessage): Since we need to know if
the preview has been truncated so we know if we need to add an elipsis
or not, get the full preview and tuncate it here if needed.
* src/engine/rfc822/rfc822-message.vala (Message): Don't bother trying to
set the preview when creating a Geary.Email from the message. Minor
code & doc cleanup.
* src/engine/api/geary-email.vala (Email): Double length of max fetch
preview so HTML parts might actually pick up some content. Tidy up doc
comments.
* src/engine/rfc822/rfc822-utils.vala (to_preview_text): Don't bother to
check for MIME Content-* headers now that we are only treating a part
as plain text if it is actually text/plain.
Bug 714317.
* src/engine/rfc822/rfc822-message-data.vala (PreviewText::with_header):
Check to see if the part is text/plain or text/html before generating a
preview for it.
Ensures that both appear the same to the user, and that the conversation
message preview gets the same armour and quote stripping that the fecth
preview does.
Added tests.
Bug 714317
* src/engine/rfc822/rfc822-utils.vala
(Geary.RFC822.Utils::to_preview_text): New common function to handle
generating a preview from a RFC 822 plain text or HTML string.
* src/engine/rfc822/rfc822-message-data.vala (PreviewText::with_header):
Move plain text armour and quote stripping to to_preview_text(), call
that to generate preview text.
* src/engine/rfc822/rfc822-message.vala (Message::get_preview): call
to_preview_text() to generate the preview text.
When generating the preview, only the first 128 bytes of the first MIME
part is fetched and used. If this part is text/html with a significant
amount of embedded CSS, then there is a good chance the string passed to
Geary.HTML::remove_html_tags() will be invalid, or be missing closing
elements. Since that function uses regexes that require balanced tags to
remove script and style blocks, then it was very possible that in these
cases this method will miss removing these blocks.
To solve this, remove_html_tags() is removed and its call sites are
replaced by calls to Geary.HTML::html_to_text(), which has been tidyied
up to produce more human-readable result.
Add unit tests to cover new html_to_text functionality and its call
sites.
* src/engine/util/util-html.vala: Remove remove_html_tags(). Update
html_to_text() to not just insert line breaks, but also insert spaces
and alt text, and ignore tags like HEAD, SCRIPT and STYLE, as
appropriate. Add an optional param to also allow skipping BLOCKQUOTE
elements, which we don't want in the preview.
* src/engine/rfc822/rfc822-utils.vala
(Geary.RFC822.Utils::create_utf8_filter_charset): Allow the given
charset to be null, empty or invalid, and if so use the default
specificed in RFC 2045. Update call sites to simply pass in given
charsets, rather than checking if they are empty, etc.
* src/engine/rfc822/rfc822.vala (Geary.RFC822): Define a const value for
UTF-8 encoding, using that instead of literals throughout the codebase.
Fixes Bug 770037.
* src/client/application/geary-controller.vala
(GearyController::close_composition_windows): Set from private to
internal so MainWindow can call it, add an arg to determine if all
composers should be closed, or only the one in the main window.
* src/client/components/main-window.vala (MainWindow::on_delete_event):
Close any main window composers before letting the window close.
* src/client/composer/composer-widget.vala (ComposerWidget::state): Don't
allow ny old code to set the composer's state.
* src/client/application/geary-application.vala
(GearyApplication::is_background_service): New property to provide
common way to determine if the app is a background service. Rework
other uses of the command line arg or setting to use this.
* src/client/application/geary-application.vala (GearyApplication):
Deprecate 'instance' and add 'engine' prop, clean up slightly.
* src/client/components/main-window.vala (MainWindow): Override
'application' property to return an instance of GearyApplication, use
that to replace use of global instance vars.
Since the Inbox is usually always open, and folders are only sync'ed if
they are closed, the Inbox would rarely, if ever, get sync'ed. As a
result, it would also never be prefetched.
* src/engine/imap-engine/imap-engine-account-synchronizer.vala
(AccountSynchronizer::send_all): Always sync a folder when it becomes
available, even if it is open, so on reconnect/etc, even the Inbox is
sync'ed.
(AccountSynchronizer::process_folder_async): If an error occurs, keep
note of whether the sync was due to the folder becoming available or
not when re-scheduling it.
* ui/conversation-viewer.ui,
src/client/conversation-viewer/conversation-viewer.vala: next-match and
previous-match signals are only available in GTK+ >= 3.16.
* ui/empty-placeholder.ui: Drop declared GTK+ requirement to 3.14.
* ui/geary.css: The :not() pseudeo class is only available in GTK+ >= 3.20.
* Use GtkTemplate to simplify layout.
* Prefix instance variables with this.
* Extract helper methods for clarity.
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>