* src/client/composer/composer-web-view.vala (ComposerWebView): Implement
both ::get_html and ::get_text as async JS calls, make the methods
async and update cal sites to handle that.
* src/client/composer/composer-widget.vala: Make saving deafts and
sending message async, to handle editor returning message body text
async. Remove uneeded ::get_html and ::get_text functions, update call
sites to call same directly on the on editor instead.
* src/client/web-process/util-composer.vala: Remove obsolete ::get_html
and ::get_text functions.
* ui/composer-web-view.js (ComposerPageState): Initial implementation of
getHtml and getText methods.
* src/client/conversation-viewer/conversation-web-view.vala
(ConversationWebView): Remove has_selection method since we are
using the signal to specify if a selection was found or not. Update
call sites to use that.
(ConversationWebView::get_selection_for_find,
ConversationWebView::get_selection_for_quoting): Implement using calls
to web process JS methods.
* src/client/application/geary-controller.vala
(GearyController::create_reply_forward_widget): If we have a possible
message view to quote from, handle constructing the compser widget
asynchronously, when we know if we have a quote or not.
* src/client/conversation-viewer/conversation-viewer.vala:
(ConversationViewer::on_find_mode_changed): Handle getting text
selection for finds asynchonously.
* src/client/components/client-web-view.vala
(ClientWebView::get_string_result): New helper for getting string
values from JS calls.
* src/client/conversation-viewer/conversation-email.vala
(ConversationEmail::get_selection_for_quoting,
ConversationEmail::get_selection_for_find): Handxle errors when
obtaining selections from a message view.
* src/client/conversation-viewer/conversation-message.vala: Remove
methods that were simply passed through to the web view anyway. Update
call sies.
* src/client/web-process/util-conversation.vala: Port all remaining
functions to JS, remove.
* bindings/vapi/javascriptcore-4.0.vapi: Add methods needed to get
strings out of WebKit.JavascriptResult instances.
* ui/conversation-web-view.js: Implement selection functions in JS, minor
cleanup.
* src/client/application/geary-controller.vala (GearyController::open_async):
Load ComposerWebView resources.
* src/client/composer/composer-web-view.vala (ComposerWebView): Move
HTML/CSS template here from ComposerWidget. Load composer-web-view.js
on app init and add it to the web view's user content manager.
(ComposerWebView::load_html): Overridden to require HTML body and
signature, assemble complete HTML as appropriate before chaining up to
the default impl.
(ComposerWebView::load_finished_and_realised): Remove redundant method.
* src/client/composer/composer-widget.vala (ComposerWidget):
Remove 'message' prop since it is unused and onerous. Cache current
account's signature as a field so it can be passed through to the
editor as needed. Port on_link_clicked to composer-web-view.js.
* src/client/web-process/util-composer.vala: Remove function ported to JS
in composer-web-view.js
* ui/CMakeLists.txt: Include new ComposerWebView JS resource.
* ui/composer-web-view.js: Port composer HTML sanitisation methods to JS,
add to a custom subclass of PageState. Instantiate it and hook it up to
onload.
* ui/conversation-web-view.js: New script, port old HTML cleaning code in
vala to Javascript as new subclass of PageState. Instantiate that on
page load.
* src/client/conversation-viewer/conversation-web-view.vala
(ConversationWebView): Load and add new JS script for conversations.
* src/client/web-process/util-conversation.vala (Util.Conversation):
Remove migrated and obsolete code.
* ui/client-web-view.js (PageState): Allow on-load behaviour to be
overridden in subclasses.
* ui/CMakeLists.txt: Include new JS script.
* ui/conversation-web-view.css: Chase CSS class name changes.
Add a "has_selection" param to avoid a second round-trip to the web
process to determine that.
* src/client/components/client-web-view.vala (ClientWebView): Add a
selection_changed signal, register a JS message handler for the JS
equivalent hook up firing the signal.
* src/client/web-process/web-process-extension.vala (GearyWebExtension):
Send a JS selectionChanged message when the page's selection changes.
* src/client/composer/composer-widget.vala,
src/client/conversation-viewer/conversation-email.vala,
src/client/conversation-viewer/conversation-message.vala: Uncomment
code that relied on the WK1 selection_changed signal, use signal param
rather than DOM calls.
* ui/client-web-view.js: Implement sending the selectionChanged message.
* ui/client-web-view.js: Move emitPreferredHeightChanged() into PageState
as ::preferredHeightChanged(). Add a explicit constructor, move
instance properties into that. Add an interval timer to periodically
update the preferred height until loaded.
* src/client/components/client-web-view.vala (ClientWebView): Register
for new remoteImageLoadBlocked message from JS. Add new
::remote_image_load_blocked signal to notify when a remote image load
was blocked. Add ::allow_remote_image_loading and ::load_remote_images
methods to allow th app to manage image loading state.
* src/client/conversation-viewer/conversation-email.vala
(ConversationEmail): Determine up front whether the message view should
load remote images and flag that, rather than passing through the email
flag and the contact store.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage): Rmeove contact_store and
always_load_remote_images properties and related code, just let the
parent email view advise whether remote images should be initially
loaded and act accordingly. Look up to ClientWebView signal and methods
to handle manual remote image loading management by the user. Remove
some obsolete code.
* src/client/web-process/web-process-extension.vala (GearyWebExtension):
Replace allow_prefix implementation for remote image management with
explicit signalling to/from the application via JavaScript.
* ui/client-web-view.js: Add a new PageState object, add props and method
to implement remote image loading management.
* ui/client-web-view-allow-remote-images.js: Monkeypatch to be used when
remote images should be loaded by default.
* ui/CMakeLists.txt: Include new JS file.
* src/client/conversation-viewer/conversation-web-view.vala,
src/client/web-process/util-conversation.vala,
src/client/web-process/util-webkit.vala: Remove obsolete code.
* src/client/components/client-web-view.vala
(ClientWebView::load_app_script): Set script injection time to the
start of the document load.
* ui/client-web-view.js: Set an onload handler to report back the
preferred height.
* bindings/vapi/javascriptcore-4.0.vapi: Add some methods to
GlobalContext for accessing JSValues as ints.
* src/client/components/client-web-view.vala
(ClientWebView): Hook up UserContentManager script messages handler and
handler implementation for "preferredHeightChanged", update the new
preferred_height prop on the class, and queue a resize. Hook those
values up to the GTK allocation machinery.
(ClientWebView::get_int_result): Convenience method for getting an int
from a JavascriptResult.
(ClientWebView::get_preferred_height): Report back values as reported
by messages from the script handler.
(ClientWebView::register_message_handler): Convenience method for
registering script messages handlers.
* src/client/conversation-viewer/conversation-web-view.vala
(ConversationWebView): Remove now-redundant GTK allocation machinery.
* ui/client-web-view.js: Post a message to preferredHeightChanged when
the page is sorta-kinda loaded.
* src/client/application/geary-controller.vala
(GearyController::open_async): Load the app script for ClientWebView at
startup.
* src/client/components/client-web-view.vala
(ClientWebView::ClientWebView): Ensure we actually have a
UserContentManager instance to work with, add the app script to the
manager for the instance.
(ClientWebView::load_scripts): Actually load client-web-view.js.
(ClientWebView::load_user_stylesheet): Helper method for this class and
subsclasses for doing the actual script load from the app.
* ui/client-web-view.js: Add boilerplaye for new file.
* ui/CMakeLists.txt: Include client-web-view.js.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage): Remove ReplacedImage and related code.
(ConversationMessage::inline_image_replacer): Don't bother loading,
scaling, rotating and serialising the images, just add them as CID
resources.
* src/client/components/client-web-view.vala (ClientWebView): Modify the
cid_resources map contain memory buffers, not files, and update call
sites.
* src/CMakeLists.txt: Make geary-client depend on the VAPI generation,
not the final client binary. Make geary-client depend on resource_copy
so valac can find the actual resource files.
* ui/CMakeLists.txt: Don't bother generating the GResources header file,
it's not needed.
* 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>
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.
* src/client/application/geary-controller.vala
(GearyController::archive_or_delete_selection_async): Don't modify the
focus after archiving/trashing/deleting.
* src/client/components/pill-toolbar.vala, ui/composer-headerbar.ui,
ui/composer-widget.ui: Ensure all toolbar buttons are focusable but
have focus-on-click disabled.
* src/client/conversation-viewer/conversation-message.vala
(AddressFlowBoxChild::AddressFlowBoxChild): Check for enter and leave
events, update the prelight state of the flowbox child accordingly.
(ConversationMessage::on_address_box_child_activated): Update the
active state of the flowbox child appropriately when the popover
active.
* ui/geary.css: Style the active and hover states of the flowboxes.
Replace the dim-label hack with two distinct labels, themed using GTK CSS
classes.
Bug 765516.
* src/client/conversation-viewer/conversation-message.vala
(AddressFlowBoxChild::AddressFlowBoxChild): Construct a different
Gtk.Label for each address part, add CSS classes to enable them to be
styled. Pass an enum in to specify From addresses, rather than Pango
markup attr values. Fix call sites. Remove now obsolete
::format_address() method, update call sites.
* src/client/util/util-gtk.vala (pango_color_from_theme): Remove now
unsed method.
* ui/geary.css: Style the new address labels.
* src/client/conversation-viewer/conversation-listbox.vala: Add two
different listbox child row types, one for emails only and one for
composers only, with a common ConversationRow superclass. When a draft
composer is added, replace the draft email it is standing in for, and
replace it again when removed. Rename last_email_row to last_row and
make into a generic ConversationRow, only update it at the end of a
batch of changes.
* src/client/conversation-viewer/conversation-listbox.vala (EmailRow):
Add a grid to the row, then add the email view to that. Allow embedded
composers to also be added to the grid, hide the email view when the
composer is for a draft. Fix code making asumptions about EmailRow's
child.
(ConversationListBox::add_embedded_composer): Add draft param, pass it
through to the email row. Update call sites.
* src/client/conversation-viewer/conversation-email.vala
(ConversationEmail): Remove composer related prop and methods, since
its handled by EmailRow now.
* ui/geary.css: Update widget hierarchy.
* src/client/application/geary-controller.vala (GearyController): Remove
ACTION_FIND_NEXT_IN_CONVERSATION and
ACTION_FIND_PREVIOUS_IN_CONVERSATION arctions and callbacks since they
will be taken care of by the search entry & search bar buttons, and
remove from accelerators.ui. Add ACTION_TOGGLE_FIND action to handle
toggling find bar in the same way as the search bar.
* src/client/components/main-toolbar.vala (MainToolbar): Add new button
and infrastrcuture for toggling the find bar.
* src/client/conversation-viewer/conversation-viewer.vala
(ConversationViewer): Convert ::conversation_page to be grid, add new
::conversation_scroller property for the scrollbar, update call
sites. Add props for accessing find widgets, remove old find methods
and add callbacks for handling find start, change, etc.
* src/client/conversation-viewer/conversation-email.vala,
src/client/conversation-viewer/conversation-message.vala: Add methods
for accessing selected text for find.
* src/client/conversation-viewer/conversation-listbox.vala
(ConversationListBox::highlight_search_terms): Updated to return a flag
specifiying whether any search results were found, and to
expand/collapse messsages depending on whether they have any.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::highlight_search_terms): Keep track of how many
results were found, and return that.
* ui/conversation-viewer.ui: Convert conversation_page to be a grid, add
a search bar and search widgets to it, and move conversation
ScrolledWindow to it.