Commit graph

426 commits

Author SHA1 Message Date
Michael James Gratton
d4a4c5b45f Initial pass at implementing Format=Flowed formatting in JS for WK2.
May not actually be working, needs testing, may eat your replies, etc.
2017-02-01 00:41:43 +11:00
Michael James Gratton
6edc097e50 Ensure basic rich text editing controls work under WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
a023b8aa6b Re-implement select-link-on-click for WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
6933f3b6f2 Re-enable rich/plain text editing toggke for WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
a72d845b35 Fix some dumb bugs in ConversationPageState::getSelectionForQuoting().
* ui/conversation-web-view.js: Fix prviously brace-less if block
  indentation, minor cleanup.
2017-02-01 00:41:43 +11:00
Michael James Gratton
b1027fcbbf Implement getting HTML and plain text from ComposerWebView in WK2.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
5b8c68f5fa Implement getting message selection for quoting and selection in WK2.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
3f90f7785a Reimplement loading and cleaning message into WK2 composer web view.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
b02059795f Remove some obsolete CSS from conversation-web-view.css. 2017-02-01 00:41:43 +11:00
Michael James Gratton
431ebcb35f Re-implement message HTML cleaning in JS in the web extension for WK2.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
766d55e75d Reimplement selection_changed signal for WK2.
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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
3068d1b0e5 Integrate preferred height JS code into PageState, tidy it up a bit.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d002722a19 Re-implement remote image loading management for WebKit2.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
56651ed8c4 Inject ClientWebView script at document start.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
26fe139e97 Initial pass at getting the HTML document's height from the web process.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
09c9a398f7 Load a default app script into ClientWebViews at construction time.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
1d1229b623 Use CID resources to display images for multipart/mixed messages.
* 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.
2017-02-01 00:41:43 +11:00
Michael James Gratton
326c450a68 Fix non-parallel build after landing geary-client changes. Bug 776421.
* 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.
2017-01-10 02:39:11 +11: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
Niels De Graef
40f15d2ab2 Fix the headerbar not showing in Unity. Bug 775865. 2016-12-11 19:28:45 +01: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
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
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
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
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
Michael James Gratton
478ab2d700 Use click-to-focus prop on toolbar buttons rather than other workarounds.
* 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.
2016-10-20 16:58:48 +11:00
Michael James Gratton
41f47bb187 Reverse the text order of Discard/Save and Close buttons in the composer.
c.f. Bug 747627
2016-10-15 18:08:58 +11:00
Michael James Gratton
0a164cecda Add missing word to UI label in conversation-email.ui. Bug 772951. 2016-10-15 12:05:30 +11:00
Michael James Gratton
65e0df7aca Update conversation address labels to indicate interactivity. Bug 765516.
* 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.
2016-10-08 17:32:40 +11:00
Michael James Gratton
dfe9e3d43a Fix secondary address label parts not being dim under the Arc theme.
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.
2016-10-08 17:29:54 +11:00
Michael James Gratton
898fa3303d Convert the conversation viewer to use GTK widgets. Fixes Bug 765516.
Merge branch 'wip/765516-gtk-widget-conversation-viewer'
2016-10-07 23:14:16 +11:00
Piotr Drąg
c5f0a7cf67 Move context to the end of the tag in the shortcuts window
It doesn't work the other way around, for some reason.
2016-10-04 21:43:32 +02:00
Michael James Gratton
8cde4f36a2 Split up handling of emails and composers in conversation list box.
* 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.
2016-10-04 10:58:17 +11:00
Michael James Gratton
d8fbb6f971 Ensure composer web views are always visible. 2016-10-04 10:58:17 +11:00
Michael James Gratton
23fdf583cf Don't show draft messages when editing them.
* 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.
2016-10-04 10:58:17 +11:00
Michael James Gratton
0e57d6e8d1 Display Sender and Reply-To headers for conversation messages. 2016-10-04 10:58:17 +11:00
Michael James Gratton
e044b27471 Define message address popover activation handlers via the UI file. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d217cb868f Highlight search terms in conversation message address headers. 2016-10-04 10:58:17 +11:00
Michael James Gratton
124273da45 Explicitly handle find bar being closed, update search terms if set. 2016-10-04 10:58:17 +11:00
Michael James Gratton
e0b956b64d Minor GTK and HTML CSS tweaks. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d32676d5f5 Dismiss link popover when a link is activated. 2016-10-04 10:58:17 +11:00
Michael James Gratton
4e6d072b9b Don't show info bars on show all. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d157fa0472 Clean up the conversation find implementation a bit.
* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer): Move notify::search-mode-enabled handler to UI
  file, remove old unused FSM code.
2016-10-04 10:58:17 +11:00
Michael James Gratton
67fbd08691 Implement "Search for messages from" for email addresses. 2016-10-04 10:58:17 +11:00
Michael James Gratton
dca845d840 Reimplement in-conversation find.
* 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.
2016-10-04 10:58:17 +11:00
Michael James Gratton
99e0f689a8 Highlight unread emails in convo viewer. 2016-10-04 10:58:17 +11:00
Michael James Gratton
3d1b208327 Fix lack of padding around GMail blockquotes. 2016-10-04 10:58:17 +11:00