Commit graph

2800 commits

Author SHA1 Message Date
Michael James Gratton
50120c67ff Add simple/demo client unit test using GSettings.
* 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.
2016-12-26 13:21:58 +10:30
Michael James Gratton
325232bad7 Add client lib to the test build.
* 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.
2016-12-26 13:18:51 +10:30
Michael James Gratton
bf42b7e0dd Split the client binary build up into a static lib + final binary.
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.
2016-12-26 12:17:21 +10:30
Michael James Gratton
ef46102374 Rename "geary-static" to "geary-engine" to better reflect what it is.
* 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.
2016-12-26 12:06:55 +10:30
Michael James Gratton
403c50a4c2 Add webkit to the list of client packages, so it can be re-used.
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.
2016-12-26 12:01:03 +10:30
Michael James Gratton
2f23f92074 Don't duplicate gthread library when linking. 2016-12-26 10:49:51 +10:30
Michael James Gratton
e0b1c7b546 Make VAPI build source arg a common valac arg, rather than repeating it. 2016-12-26 10:42:51 +10:30
Michael James Gratton
b7224d6da3 Stop cmake warning that we are using an internal target name.
* CMakeLists.txt: Rename "test" to "tests"

* Makefile.in: Chase target name, add a compatibility target for the old
  name.
2016-12-26 10:31:02 +10:30
Michael Gratton
1ad02284bd Fix HTML, CSS, MIME and other artifiacts appearing in previews. Bug 714317.
Also works around conversation message preview being too short
on wide (4K) screens. Bug 772607.

Merge branch 'bug/714317-hide-html-in-preview'
2016-12-25 10:43:03 +10:30
Gautier Pelloux-Prayer
f8c2a9a7bb Remove unnecessary return carriage in debug invokations 2016-12-23 11:38:00 +10:30
Michael James Gratton
7654b16908 Add unit test for Geary.RFC822.Message::get_preview. 2016-12-23 10:38:23 +10:30
Daniel Mustieles
77346fb5f2 Update Spanish translation 2016-12-21 16:25:13 +00:00
Michael James Gratton
fdb3c6cac6 Make to_preview_text() require UNIX (LF), not RFC833 (CRLF) strings.
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.
2016-12-21 10:45:21 +11:00
Michael James Gratton
c2f0f14830 Use preview synthesis when conversation list is refreshing previews.
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.
2016-12-20 23:29:31 +11:00
Michael James Gratton
9757e6e358 Synthesise PREVIEW field if HEADER and BODY were also listed.
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.
2016-12-20 23:05:43 +11:00
Marek Cernocky
d6faffb72e Updated Czech translation 2016-12-20 09:23:11 +01:00
Michael James Gratton
5b97efa529 Add test case handling HTML entities when converting to text.
* test/engine/util-html-test.vala (UtilTest::remove_html_tags): Added
  test case for HTML entities.
2016-12-20 12:27:07 +11:00
Michael James Gratton
f577e41ce8 Workaround conversation message preview being cut off on wide screens.
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.
2016-12-20 12:25:44 +11:00
Michael James Gratton
821ae7c987 Remove hacks for MIME part headers when processing preview text.
* 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.
2016-12-20 10:15:24 +11:00
Michael James Gratton
ab189490d3 Don't generate a preview from non-text parts, e.g. multipart/signed.
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.
2016-12-20 10:15:24 +11:00
Michael James Gratton
1879ea8480 Combine fetch and convo message codepaths for generating preview text.
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.
2016-12-19 18:47:38 +11:00
Ronan Arraes Jardim Chagas
f9a09dafad Update Brazilian Portuguese translation 2016-12-18 15:10:10 -02:00
Michael James Gratton
deb0c415d0 Fix HTML, CSS and JS leaking into conversation list preview. Bug 714317
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.
2016-12-19 00:45:41 +11:00
Michael James Gratton
330d263947 Tidy up RFC822 default charset handling a bit.
* 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.
2016-12-18 22:43:42 +11:00
Michael James Gratton
6a43bb3fb1 Fix composers not dismissed when started hidden and main window closed.
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.
2016-12-17 14:36:52 +11:00
Michael James Gratton
e24db89d10 Add is_background_service to app as a consistent way to determine this.
* 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.
2016-12-17 14:36:52 +11:00
Michael James Gratton
440d1bff20 Remove use of global application and engine instance vars in MainWindow.
* 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.
2016-12-17 14:36:52 +11:00
Dušan Kazik
df1cdf1456 Update Slovak translation 2016-12-16 15:41:24 +00:00
Piotr Drąg
94f33b4c44 Update Polish translation 2016-12-16 02:24:34 +01:00
Piotr Drąg
bfea6be048 Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=776142
2016-12-16 02:14:14 +01:00
Michael James Gratton
bc4c1e1579 Add translator notes about the conversation email star/unstar buttons. 2016-12-14 11:49:55 +11:00
Michael James Gratton
58efb70763 Fix Inbox never being prefetched, since it is never sync'ed. Bug 776029
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.
2016-12-14 11:43:56 +11:00
Michael James Gratton
7683044d61 Add an initial/example unit test. 2016-12-13 11:27:19 +11:00
Michael James Gratton
6ce262a3b7 Basic unit test build configuration. 2016-12-13 11:27:15 +11:00
Gautier Pelloux-Prayer
f548e6b6a4 Sqlite is a required dependency 2016-12-13 00:23:06 +11:00
Niels De Graef
0ea634c30f Fix the Detach shortcut not working. Bug 773658. 2016-12-12 12:20:08 +01:00
Niels De Graef
40f15d2ab2 Fix the headerbar not showing in Unity. Bug 775865. 2016-12-11 19:28:45 +01:00
Niels De Graef
2481989d5e Don't set DBusActivatable since we don't have a service file. 2016-12-10 00:33:01 +01:00
Michael James Gratton
9da8c372e2 Fix compilation under vala 0.35.1. Bug 775533.
Patch thanks to gautier@damsy.net in Bug 775452.
2016-12-09 16:01:17 +11:00
Michael James Gratton
5c8e838ea9 Fix main window showing a menubar under earlier GTK versions.
* src/client/components/main-window.vala (MainWindow::MainWindow):
  Restore explictly setting show-menubar property to false.
2016-12-09 15:57:35 +11:00
Michael James Gratton
56179ba066 Remove border around conversation viewer's scrolled window. 2016-12-09 15:36:06 +11:00
Michael Gratton
d6466d5747 Fix GTK+ widget style issues under GTK+ < 3.20. 2016-12-09 13:31:03 +11:00
Niels De Graef
ec9acc8989 Perform migration for GSettings. Bug 766196. 2016-12-08 12:53:56 +01:00
Niels De Graef
4b5b2ee6e1 Use "org.gnome.Geary" for the app ID. Bug 766196. 2016-12-08 12:53:52 +01:00
Michael James Gratton
2e5fe9ea86 Fix two runtime warnings caused by commit 3ef1ac. 2016-12-08 18:59:42 +11:00
Michael James Gratton
3ef1ac973e Fix runtime errors when built/running against GTK +3.14.
* 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.
2016-12-06 16:22:39 +11:00
Gautier Pelloux-Prayer
d4acac034d Fix compilation for Gtk3.14 and older setups. Bug 775452 2016-12-06 15:53:28 +11:00
Muhammet Kara
b582b40f59 Update Turkish translation 2016-11-30 21:22:40 +00:00
Niels De Graef
776eebd48e Clean up MainWindow. Bug 775006.
* Use GtkTemplate to simplify layout.
* Prefix instance variables with this.
* Extract helper methods for clarity.

Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2016-11-30 18:46:18 +11:00
Niels De Graef
9f331c4639 Remove 'EmptyMenu'-action. Bug 775018.
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2016-11-29 00:19:40 +11:00