Commit graph

2934 commits

Author SHA1 Message Date
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
Kacper Bielecki
01c419ae5c Do not use headerbar with Unity
This commit reverts Unity workaround removal (commit 7b37e26; bug
738899).

However, in contrast to 7b37e26, it does not:
 * set clock format to the one used for Unity clock indicator
 * Use global GearyApplication.instance variable

Additionally, it makes detach button displayed always on the right while
running in Unity.
2016-11-28 22:05:33 +11:00
Piotr Drąg
7663ccd8a4 Update Polish translation 2016-11-27 17:34:08 +01:00
Dušan Kazik
a470412d67 Update Slovak translation 2016-11-24 20:04:36 +00:00
Alan Mortensen
5f92d6fd7d Updated Danish translation 2016-11-24 16:46:03 +01:00
Gautier Pelloux-Prayer
c623a4e621 Disable "save draft" button if it is not available yet. Bug 747627 2016-11-22 01:03:07 +11:00
Gautier Pelloux-Prayer
d39b44a0c1 Do not reset password unconditionally in case of login failure, but check for the reason. Bug 772808 2016-11-21 23:17:11 +11:00
Michael James Gratton
7ba13e934d Don't crash when attempting to display a 0-sized inline image.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::clean_html_markup): Check the image buffer
  actually has some bytes before processing it.
2016-11-18 14:01:27 +11:00
hanniedu
e1bbba13fd Updated Dutch translation Master 3.24 2016-11-15 16:34:41 +01:00
Niels De Graef
604a3b24d2 Change helper methods to private in MainToolbar. Bug 773728.
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2016-11-15 21:26:41 +11:00
Niels De Graef
4f404b15d4 Use GtkTemplate for the MainToolbar
Bug 773728.

Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2016-11-15 16:05:04 +11:00
Niels De Graef
8189e4cadd Removed the PillBar classes (i.e. PillBar, PillHeaderbar and PillToolbar). Bug 773728.
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2016-11-15 16:05:04 +11:00
Mario Blättermann
11005a19de Update German translation 2016-11-11 21:15:33 +00:00
Ask Hjorth Larsen
077e9911d1 Updated Danish translation 2016-11-09 21:42:34 +01:00
Benedikt M. Thoma
f5a3e9860c Update German translation 2016-10-30 20:14:31 +00:00
Michael James Gratton
e91edf4dbd Fix some initially collapsed messages not showing a body when expanded.
* src/client/conversation-viewer/conversation-list-box.vala (EmailRow::expand):
  Check to see if the message's web views report a valid height and queue
  a resize if not, before expanding the row.
2016-10-25 14:17:59 +11:00
Michael James Gratton
797bb44b7c Fix conversation viewer's spinners being huge with some themes.
Bug 773054

* src/client/conversation-viewer/conversation-list-box.vala
  (ConversationListBox::show_loading), ui/conversation-viewer.ui: Specify
  a width and height request for the spinners, ensure they are centered.
2016-10-25 10:03:42 +11:00