Commit graph

426 commits

Author SHA1 Message Date
Michael James Gratton
9c813eaacb Replace Gtk.IconView with FlowBox for displaying email attachments. 2016-10-04 10:58:17 +11:00
Michael James Gratton
a2644f243a Fix missing space between message avatar and headers. 2016-10-04 10:58:17 +11:00
Michael James Gratton
b03c0add14 Convert new convo widgets to use Gtk.Grid instead of Box. 2016-10-04 10:58:17 +11:00
Michael James Gratton
640e8fdbc6 Workaround wide convo InfoBars being too wide for small screens.
* ui/conversation-email.ui, ui/conversation-message.ui: Ellipsie labels
  on InfoBars so they can shrink.
2016-10-04 10:58:17 +11:00
Michael James Gratton
a7570f88f2 Ensure conversation messages min width is low enough for small screens.
* src/client/conversation-viewer/conversation-message.vala
  (AddressFlowBoxChild): Enable ellipsizing the label. Set the alignment
  so labels are correctly aligned at narrow widths. Removed some cruft.

* ui/conversation-message.ui: Ensure long words in subject are
  wrapped. Ensure there's always at least two cols for recipient address
  flow boxes.
2016-10-04 10:58:17 +11:00
Michael James Gratton
5ea4b0a051 Prefix CSS classes in message HTML to avoid collisions with HTML messages.
* ui/conversation-web-view.css: Prefix the names of base Geary-internal
  elements with "geary_" to reduce the odds of them colliding with class
  names in HTML messages. Chase the name changes in classes that generate
  them.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Use constants for class names and
  WebKit.DOMElement::class_list to add/remove them.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b5e7c27c58 Tidy up collapsible quote container style and behaviour.
* src/client/conversation-viewer/conversation-message.vala:
  (ConversationMessage::create_quote_container): Fix unwanted whitespace
  at the top of quote containers by removing newlines from the inner
  HTML used to construct them.
  (ConversationMessage::unset_controllable_quotes): Replace using
  absolute pxiel value for determining whether a quote should be unhidden
  with a percentage of the parent container.

* ui/conversation-web-view.css: Polish and simplify quote container CSS.
2016-10-04 10:58:17 +11:00
Michael James Gratton
18621a2f7f Remove some unused/uneeded message body CSS. 2016-10-04 10:58:17 +11:00
Michael James Gratton
7581f16320 Substantially rework email HTML sanitising and styling.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::clean_html_markup): Ensure all displayed message
  bodies have at least a HTML element, so that the style in
  conversation-web-view.css has something to work on. Load application
  style when sanitising the HTML rather than when the web view has
  loaded.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Just set user style using WebKit.WebSettings,
  don't try to set application CSS, and remove all associated code.

* ui/conversation-web-view.css: Only trigger CSS 2.1 § 10.6.7 on the HTML
  element, so BODY can be styled as normal by email CSS.
2016-10-04 10:58:17 +11:00
Michael James Gratton
6af28fed41 Tidy up ConversationMessage GTK theme CSS. 2016-10-04 10:58:17 +11:00
Michael James Gratton
93e8a148dc Add a tooltip to to conversartion viewer's date headers with full date. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d467647153 Break out ListBox used to display conversations into standalone widget.
The conversation viewer's ListBox is sufficiently complex to warrant its
own widget. Use empty placeholders for the list per the HIG, and
correctly fix mamagement of empty folder vs no conversations selected
this time.

* src/client/application/geary-controller.vala (GearyController):
  Directly manage secondary parts of the conversation viewer, since the
  controller since it has a better and more timely idea of when a
  conversation change is due to folder loading status or from the user
  selecting conversations, and so the viwer doesn't need to hook back
  into the controller. Remove the now-unused conversations_selected
  signal and its callers.

* src/client/conversation-viewer/conversation-listbox.vala: New widget
  for displaying the list of emails for a conversation. Moved relevant
  code from ConversationViewer here. Made adding emails async to get
  better UI responsiveness. Don't implement anything to handle
  conversation changes or emptying the list.

* src/client/conversation-viewer/conversation-viewer.vala: Replace user
  messages - empty folder/search & no/multiple messages selected with new
  EmptyPlaceholder. Remove a lot of the state manage code needed when
  managing the email listbox. Add a new ConversationListBox for every new
  conversation and just throw away.

* src/client/conversation-list/conversation-list-view.vala
  (ConversationListView): Clean up firing the conversations_selected
  signal - don't actually emit it when the model is clearing, and don't
  bother delaying the check either.

* src/client/components/empty-placeholder.vala: New widget for displaying
  empty list and grid placeholders per the HIG.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail): Make manually read a property, since it
  effectively is one.

* src/CMakeLists.txt: Include new source files.

* po/POTFILES.in: Include new source and UI files, and some missing ones.

* ui/CMakeLists.txt: Include new UI files.

* ui/conversation-viewer.ui: Replace user message and splash page with
  placeholders for the new empty placeholders(!).

* ui/empty-placeholder.ui: UI def for new widget class.

* ui/geary.css: Chase widget name/class changes, style new
  empty placeholder UI.
2016-10-04 10:58:17 +11:00
Michael James Gratton
9f1854548d Scroll to a useful location when a conversation is first loaded.
Scrolls to the first expanded row (first unread, or last email) in the
conversation list box to the top when the convo is fully loaded. To
implement this cleanly, ConversationViewer's handling of ListBoxRows was
cleaned up significantly by introducing a custom subclass and moving
related funtionality there.

* src/client/conversation-viewer/conversation-viewer.vala (EmailRow): New
  class for managing expanded and last row state, events needed to ensure
  we can robustly scroll to the row after its message has been loaded.
  (ConversationViewer::scroll_to_top): New method for scrolling to a
  specific row.
  (ConversationViewer::update_last_row): New method for correctly
  updating the last_email_row property and the row's flags. Replace
  existing ad-hoc methods of determining the last row and ensure that the
  last_email_row is used instead.
  (ConversationViewer::select_conversation_async): Find the first
  expanded row in the newly loaded conversation, and wire it up so that
  it is scrolled to when the email body is eventually loaded, and the
  resulting size reallocations have taken place.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView::is_height_valid): Allows checking if the web
  view's height is considered to have been correctly calculated.
2016-10-04 10:58:17 +11:00
Michael James Gratton
648e726c86 Ensure header buttons are not sensitive when convo email is collapsed. 2016-10-04 10:58:17 +11:00
Michael James Gratton
1c6745256e Emulate browser-style scroll-on-spacebar. 2016-10-04 10:58:17 +11:00
Michael James Gratton
9eafaaae4a Reduce spacing between messages in the conversation list. 2016-10-04 10:58:17 +11:00
Michael James Gratton
48a45cccd4 Ensure embedded composer is always located below its referred message. 2016-10-04 10:58:17 +11:00
Michael James Gratton
911e81a907 Go back to using the same size avatar for expanded/collapsed messages. 2016-10-04 10:58:17 +11:00
Michael James Gratton
dcc5f42eea Tidy up conversation list style. 2016-10-04 10:58:17 +11:00
Michael James Gratton
12e64b4a3a Fix alignment of conversation message date and preview date alignment. 2016-10-04 10:58:17 +11:00
Michael James Gratton
a97a371826 Update message header layout, use GtkFlowBox for addresses.
This takes some inspiration from the GNOME Mail mockups.

* src/client/components/main-window.vala (MainWindow::set_styling): Work
  around GtkFlowBoxChild padding issue.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Updated to populate new header labels, add
  addresses to GtkFlowBoxes.

* ui/conversation-message.ui: Make date always visible and
  right-aligned. Remove label for sender address. Use GtkFlowBoxes for
  sender/to/cc/bcc.
2016-10-04 10:58:17 +11:00
Michael James Gratton
4daf4bdcd5 Chase ConversationEmail action namespace change in its main UI file. 2016-10-04 10:58:17 +11:00
Michael James Gratton
5c88e07af6 Re-enable items in the ConversationEmail menu.
Using "msg" for the ConversationMessage context menu action namespace
stopped ConversationEmail's actions being found, so use "eml" instead.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::ConversationEmail): Use a the "eml" namespace for
  email actions to avoid namespace collision.

* ui/conversation-email-menus.ui: Chase namespace change.
2016-10-04 10:58:17 +11:00
Michael James Gratton
82530d12a7 Re-enable the message context menu.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Add a simple action group namespaced as "msg"
  for actions under the message's scope, add actions to it for the
  context menu. Track the currently selected DOM element under the
  context menu so we can update action enabled state, etc., based on
  it. Construct the context menu as needed, update signal & event
  handlers as needed.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail): Add new save-image signal, chain emission from
  added ConversationMessage instance's save-image signal to this.

* src/client/application/geary-controller.vala (GearyController): Chase
  on_save_buffer_to_file signal moving to ConversationEmail and being
  renamed to save_image.

* src/client/conversation-viewer/conversation-viewer.vala: Remove uneeded
  signal.

* ui/conversation-message-menus.ui: New UI file for ConversationMessage
  context menu.

* ui/CMakeLists.txt: Incude ConversationMessage UI in the resources.

* po/POTFILES.in: Add new UI file.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b2fe0ce4ff Rename conversation-message-menu.ui to conversation-email-menus.ui.
Make it actually match its parent class and use.
2016-10-04 10:58:17 +11:00
Michael James Gratton
338fe6c3b3 Convert ConversationEmail's attachment icon into a button.
Since both the star and email menu button are both buttons, the
attachments icon should be as as well. Replace the Save Attachments menu
item with this button.

* src/client/conversation-viewer/conversation-email.vala: Convert
  attachment_icon to attachment_button. Update call sites.

* ui/conversation-email.ui: Replace attachments icon with button.

* ui/conversation-message-menu.ui: Remove Save Attachments item.
2016-10-04 10:58:17 +11:00
Michael James Gratton
be31b33731 Re-enable attachments context menu.
Since we're using the Icon View, we have some more options in terms of
user selction and the actions applicable to that. So make the attachment
signals and their handlers all apply to collections of attachments and
use the GAppInfo class for determining which app to open an attachment
with.

* src/client/application/geary-controller.vala: Chase signal changes.
  (GearyController::on_attachments_activated): Handle multiple
  attachments being activated at once. Use its GAppInfo for launching
  each attachment, prompt the user with an GtkAppChooserDialog if the
  info is unknown.

* src/client/conversation-viewer/conversation-email.vala Use the new
  AttachmentInfo class to manage lists of all displayed and currently
  selected attachments and their associated GAppInfo objects. Add actions
  for attachment context menu items. Move attachment signals from
  ConversationViewer here, make all attachment signals have a collection
  of them as their param. Hook up appropriate GtkIconView callbacks to
  manage selection, activation, etc. Construct AttachmentInfo instances
  when loading attachments and use them in the icon view's model.

* ui/conversation-email.ui: Define needed callbacks for the icon
  view. Update its model to accept a GObject for the attachment info
  class.

* ui/conversation-message-menu.ui: Fix action name for save attachments
  menu item.
2016-10-04 10:58:17 +11:00
Michael James Gratton
19456bd58e Re-enable email menu actions and message star/unstar.
* src/client/application/geary-controller.vala: Chase signal changes.
  (GearyController::on_view_source): Moved view source code here from the
  conversation viewer.

* src/client/conversation-viewer/conversation-email.vala: Add an action
  group for the email for email-specific actions with the prefix
  "msg". Add actions each of the items in the email menu. Move
  email-specific signals here from ConversationViewer. Update actions
  based on message state as needed.

* src/client/conversation-viewer/conversation-viewer.vala: Add signal
  handlers for ConversationEmail's email flagging signals and forward
  them on to the `mark_emails` signal, since we also want to batch up
  email flag changes from here.

* ui/conversation-email.ui: Fix star/unstar action names.

* ui/conversation-message-menu.ui: Cromulify the email menu name.
2016-10-04 10:58:17 +11:00
Michael James Gratton
3dcf3ce7d6 Convert ConversationWebView HML CSS file to a resource, remove theme dir.
* src/client/application/geary-application.vala
  (GearyApplication::read_theme_file): Renamed to ::read_resource, do the
  lookup on a GResource instead of from the file system.
  (GearyApplication::get_ui_file): Remove unused method.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Chase CSS file rename and load method.

* theming/CMakeLists.txt: Removed, no longer needed.

* theming/message-viewer.css: Moved to ui/conversation-web-view.css.

* ui/CMakeLists.txt: Add conversation-web-view.css resource.

* CMakeLists.txt: Remove theming include.

* src/client/application/geary-application.vala :
2016-10-04 10:58:17 +11:00
Michael James Gratton
aabfb1d6de Reenable displaying sender avatars using Gravatar.
Since we're no longer using the web view to display the user avatar, use
libsoup and add some additional infrastructure to support caching the
avatars. Also switches to HTTPS for accessing the Gravatar service.

* src/client/application/geary-application.vala
  (GearyApplication::get_user_cache_directory): New method to return the
  XDG cache directory for Geary.

* src/client/application/geary-controller.vala: Add both a Soup session
  and cache for fetching avatars. Write the cache to disk on controller
  close.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::start_loading): Trigger avatar loads when loading
  the email.

* src/client/conversation-viewer/conversation-message.vala: Replace
  single avatar image widget with two, so the image does not need to be
  rescaled when expanded/collapsed.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::load_avatar): Queue a request for a Gravatar
  avatar.
  (ConversationMessage::set_avatar): Load pixbuf returned by Gravatar,
  scale and set it for the preview and expanded avatar images.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::clear): Cancel any outsanding avatar loads.

* src/client/util/util-gravatar.vala (Gravatar): Construct a HTTPS URL to
  avoid advertising to the NSA who we are receiving email from.

* ui/conversation-message.ui: Add the second avatar image.
2016-10-04 10:58:17 +11:00
Michael James Gratton
1af11b09b4 Reenable displaying the "sent but not saved" message.
* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::not_saved_infobar): Add a template widget child for
  the not-saved info bar, add to ConversationMessage's infobar box and
  display it when the flag is set.

* ui/conversation-email.ui: Add a warning info bar for displaying the
  message.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ad035f799c Allow ConversationEmail to manage its infobars indep. of ConversationMessage.
* src/client/conversation-viewer/conversation-email.vala: Move the
  draft_infobar wdiget from ConversationMessage, when the message is a
  draft add it to ConversationMessage's infobar box and show it.

* ui/conversation-email.ui: Move the draft_infobar definition from
  conversation-message.ui here.

* ui/conversation-message.ui: Wrap the remote messages infobar in an box
  so that ConversationEmail can easily append its own in the same location.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ec22b33825 Reenable displaying sub-messages.
Geary currently displays RFC 822 attachments inline, below the email's
primary message body, using the same HTML chrome for the headers and
email body as for the primary body. Taking the same approach but using
GTK+ widgets meant splitting ConversationMessage up into a
ConversationEmail class that manages the UI for displaying an email in
its entirety, and a ConversationMessage to manage the only header widgets
and webview for displaying an individual RFC 822 message, usable for both
the primary body and any sub-messages. Thus, this is a big change.

One behavioural change is that each sub-message with remote images now
requires individual approval, rather than being dependant on the
containing message's sender and/or approval. This prevents some attacks
e.g. a trusted sender forwarding a spam/malware message, but does not
prevent it if the message is forwarded inline, obviosuly.

* src/client/conversation-viewer/conversation-email.vala (ConversationEmail):
  New class for managing the UI for an overall email message. This
  replaces the old ConversationMessage and contains much of it's code and
  widgets - anything from that class which does not directly support
  displaying headers or a message body.

* src/client/conversation-viewer/conversation-message.vala:
  (ConversationMessage): Same class as before, but now with its scope
  narrowed to only display message headers and body. The draft infobar
  remains here rather than being put ConversationEmail where it belongs
  since it's bit of a pain to insert in the right place and doesn't
  really hurt.
  (::email): Moved this property and any code that depends on it to
  ConversationEmail.
  (::always_load_remote_images): New property passed in via the ctor,
  allowing one dependency on the old ::email property to be removed.
  (::inlined_content_ids): Moved to ConversationEmail, since that is the
  class that keeps track of attachments to display. Add the signal
  attachment_displayed_inline to allow ConversationEmail to be notified
  of inlined attachments instead.
  (::flag_remote_images, ::remember_remote_images): New signals to notify
  ConversationEmail that the user has flagged this message or the
  message's sender for loading remote images. This is passed through
  since in the former's case we may need to set flags on the email
  itself, the latter because it is one less use of the contact_store
  property, which should be removed from this class at some point.

* src/client/conversation-viewer/conversation-viewer.vala: Chase API
  changes from the above. In general, replace use of the term "message"
  with "email" since this class is now mostly dealing with
  ConversationEmail instances, rather than ConversationMessage instances.
  (ConversationViewer::check_mark_read): Only consider the
  ConversationEmail's primary message body when checking for visibility
  rather than that and any submessages to keep things simple.
  (ConversationViewer::show_message, ::hide_message): Renamed to
  expand_email/collapse_email respectively since we don't ever actually
  hide it. Carry that change on to same methods on ConversationEmail.

* src/engine/rfc822/rfc822-message.vala (Geary.RFC822.Message): Add
  get_primary_originator(), almost vermatim from Geary.Email, to support
  determining the sender for remembering remote message loading for
  senders of sub-emails.

* src/client/components/main-window.vala (MainWindow::set_styling): Fix
  background transition for collapsed emails.

* src/client/application/geary-controller.vala: Chase API name changes.

* src/CMakeLists.txt: Include new ConversationEmail source file.

* ui/conversation-email.ui: New UI for ConversationEmail, move the email
  action box, attachments box amd sub-messages box here from
  conversation-message.ui.

* ui/CMakeLists.txt: Include new UI in compiled resources.

* po/POTFILES.in: Add new UI for transation.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ea8a9c992c Reenable and update code for editing draft messages.
Use a Gtk.InfoBar for displaying the draft button.

* src/client/conversation-viewer/conversation-message.vala: Add draft
  infobar template child, edit_draft signal. Remove unused draft-related
  code.
  (ConversationMessage::ConversationMessage): Add new is_draft ctor
  param, when true show the draft infobar.
  (ConversationMessage::on_draft_response): New handler for when the edit
  draft button on the infobar is clicked.

* src/client/conversation-viewer/conversation-viewer.vala: Remove
  edit_draft signal, make a lame attemppt to work out if a message is a
  draft and pass that through to ConversationMessage.

* src/client/application/geary-controller.vala: Hook up on_edit_draft
  handler to added conversation messages.

* ui/conversation-message.ui: Added draft infobar.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b5270e3740 Reenable and update code for displayed attachments.
* src/client/conversation-viewer/conversation-message.vala: Add template
  child widgets for displayed attachment UI, add signal for when user
  activates an attachment.
  (ConversationMessage::ConversationMessage): Ensure the attachment UI
  is visible when there are displayed attachments.
  (ConversationMessage::start_loading): New method for async loading of
  message content, use just for attachments for now.
  (ConversationMessage::on_attachments_view_activated): Handle activation
  signal for specific attachments.
  (ConversationMessage::load_attachments): Load attachments from the
  message into the new UI.
  (ConversationMessage::load_attachment_icon): Load icons for the
  attachments UI from the attachment itself if an image, else from the
  icon theme.

* src/client/application/geary-controller.vala: Hook up
  attachment_activated signal to conversation messages.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::add_message): Ensure message loading starts after
  new conversation messages are added to the window hierarchy.

* ui/conversation-message.ui: Add an attachments box, with an icon view
  for displayed attachments.
2016-10-04 10:58:17 +11:00
Michael James Gratton
9e7fee035a Tidy up ConversationMessage styling and state management.
* src/client/components/main-window.vala: Adjust theme CSS style to
  account for new widget classes. Fix style for last row in the convo
  listbox.

* src/client/conversation-viewer/conversation-message.vala: Decouple
  updating message state and updating message flags. Prefix CSS classes
  with "geary_" to prevent class name clashes.

* src/client/conversation-viewer/conversation-viewer.vala: Manually
  maintain a CSS class on the last row of the convo listbox to work
  around Bug 764710. Prefix CSS classes with "geary_" to prevent class
  name clashes.
  (ConversationViewer::on_update_flags): Renamed from update_flags since
  it is only ever called as a signal handler. Remove most of the work -
  it is now done by ConversationMessage.
2016-10-04 10:58:17 +11:00
Michael James Gratton
9e9e007974 Use two different buttons in ConversationMessage to show starred state.
Having two buttons means we don't need to change the image and handler
when clicked, just manage their visbility.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Add both a star and unstar template child,
  update their state as the message's state changes.

* ui/conversation-message.ui: Rename flag button to "star", add new
  unstar button.
2016-10-04 10:58:17 +11:00
Michael James Gratton
83457ca048 Make collapsed ConversationMessage message boxes a bit lighter. 2016-10-04 10:58:17 +11:00
Michael James Gratton
0f64460c90 Don't display ConversationMessage header boxes when header not present.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::ConversationMessage): Remove old "empty" theme CSS
  class, just set header boxes to be visible when setting their text.

* ui/conversation-message.ui: Default header box visibility to off.
2016-10-04 10:58:17 +11:00
Michael James Gratton
21be64fe01 Add attachment icon back to the message viewer. 2016-10-04 10:58:17 +11:00
Michael James Gratton
89a1dc8c88 Style the ConversationViewer user message with CSS rather than a class. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d0dc003772 Clean up message header UI, tranitions and style a bit.
* ui/conversation-message.ui: Split out preview labels from existing
  header box and create a new preview box for them.

* src/client/components/main-window.vala (MainWindow::set_styling): Use
  style-defined names to allow us to specify message row backgrounds better.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Update GTK composite template children
  properties and visible state when showing/hiding the body, set new
  preview/header box label texts.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::do_embedded_composer,
  ConversationViewer::add_message): Don't add 'frame' class to conversation
  list rows, we're styling it explicitly now.
2016-10-04 10:58:17 +11:00
Michael James Gratton
22e67655ac Reenable and update code for inline message image display.
Use a GtkInfoBar to display to the user the message and related buttons
instead of the message-inline HTML approach. Still needs some additional
work to save per-message loading and displaying images from same sender
in convo when "Always Show" is chosen.

* src/client/conversation-viewer/conversation-message.vala: Reenable
  remote image related code, remove HTML-based UI management code.

* src/client/components/main-window.vala (MainWindow::set_styling):
  Add some theme CSS to style the remote images infobar.

* ui/conversation-message.ui: Add the remote images infobar.
2016-10-04 10:58:17 +11:00
Michael James Gratton
69a53d9db9 Reenable and update code for embedded message composer.
The embedded composer is now added to the the conversation list
box. Still needs some work to fix focus and scrolling issues, also to
insert the composer in the right place in the list.

* src/client/components/main-window.vala (MainWindow::set_styling):
  Adjust theme CSS to make padding around embedded coposer not so
  terrible. Fix style for embedded headerbar.

* src/client/composer/composer-embed.vala: Don't attempt to up-manage
  it's parent's state, since the parent has a much better idea of how
  best to do that. Instead of passing in a ConversationViewer, just pass
  in a Gtk.ScrolledWindow that needs to be adjusted as the embededded
  editor and add some signals needed by the ConversationViewer. Reenabled
  some code needed to get scroll event passthrough working.

* src/client/conversation-viewer/conversation-viewer.vala: Remove old
  embedded composer code. Adjust conversation_listbox callbacks to handle
  the embedded composer being present.
  (ConversationViewer::get_selected_message): Fixed to actually return a
  message.
  (ConversationViewer::do_embedded_composer): New method to set up an
  embedded composer.

* src/client/application/geary-controller.vala
  (GearyController::create_compose_widget_async): Call new
  ConversationViewer::do_embedded_composer to let it set up a new
  embedded composer when needed.
2016-10-04 10:58:17 +11:00
Michael James Gratton
5184a38fe8 Reenable and update code for attached, full pane message composer.
Display attached+un-embedded composer as an additional ConversationViewer
stack page, although it realy should be broken as its own top-level
widget - there's already too much state in ConversationViewer.

* src/client/conversation-viewer/conversation-viewer.vala: Remove old
  composer boxes code. Add new ViewState enum, property and methods to
  define and manipulate the current view state - either conversation or
  composer.
  (do_conversation): New method to put the viewer in conversation mode.
  (do_compose): New method to put the viewer in compose mode, hook up the
  composer widget, and handle ConversationListView selection management
  for now.
  (on_folder_selected, on_conversation_count_changed,
  on_conversations_selected): Ensure these methods do the right thing
  depending on the viewer's current view state.
  (set_paned_composer): Replaced by ::do_compose, fixed call sites.
  (show_multiple_selected): Minor code clean up - moved down to a more
  appropriate location.

* src/client/composer/composer-box.vala (ComposerBox): Don't attempt to
  up-manage it's parent's state, since the parent has a much better idea
  of how best to do that. Likewise move code to manage previous
  ConversationList selection out, provide signal so the a more
  appropriate class can manage it instead.

* src/client/composer/composer-container.vala: Add some method comments.

* ui/conversation-viewer.ui: Add new page to the stack for the composer.
2016-10-04 10:58:17 +11:00
Michael James Gratton
3bf173881c Renable and update code for clicking on links in messages.
Requires GTK+ 3.12.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::link_selected): Added to pass through successful
  link clicks to the message_viewer, hook it up to the web_view.
  (ConversationMessage::load_message_body): Hook up WebKit event handler
  for when links are clicked, so phishing links can be intercepted.
  (ConversationMessage::on_link_clicked_self): Use a popover to display
  phishing warning, recursively check link's offset parent's when
  calculating box position, escape link text/href before using it as
  markup.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::add_message): Ensure unhandled mouse clicks o the
  web_view are not used to activate the message's ListBoxRow.

* ui/conversation-message.ui: Add popover (GTK+ 3.12) for phishing links.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b29d83e546 Convert ConversationViewer to a Stack with a ListBox, remove its WebView.
* src/client/conversation-viewer/conversation-viewer.vala: Convert to a
  GtkStack. Use a GTK template for constructing the UI. Remove WebView
  and any DOM-related code. Replace the enum DisplayMode and hence the
  HTML spinner and HTML user message with widgets in the stack. Remove
  all menus since they're all message specific and will need to be
  re-implemented for ConversationViewer. Comment out composer related
  code for the moment.

* src/client/application/geary-controller.vala
  (GearyController::conversations_selected): Make both conversations and
  current_folder arguments non-nullable, since it doesn't make any sense
  for there not to be any and simplifies handler impls.
  (GearyController::on_conversations_selected): Don't fire when there
  isn't a current folder.

* src/client/components/main-window.vala (MainWindow::set_styling): Add
  CSS theme code for the the conversation message list.
  (MainWindow::create_layout): Remove GtkFrame, just add the
  ConversationViewer instance directly.

* ui/conversation-viewer.ui: New GtkBuilder template for
  ConversationViewer, implemented as a GtkStack containing widgets for
  displaying the loading spinner, conversation as a GtkListBox, and label
  for user messages.

* ui/CMakeLists.txt, po/POTFILES.in: Added new UI files.
2016-10-04 10:58:17 +11:00
Michael James Gratton
64aa037c04 Add new ConversationMessage widget to display a single message with a WebView.
The new widget is designed to be added to a ListBox like container, and
can display both a summary and the complete message, a'la the traditional
Geary ConversationView.

Most features are currently disabled, but it does handle hiding/showing
the message body using a single WebKit.WebView. All code from
ConversationViewer relating to DOM manipulation as been copied over, all
but that which was needed to display the message has been commentd out.

* src/client/conversation-viewer/conversation-message.vala: Source code
  for new widget.

* src/client/components/main-window.vala: Add CSS theme code for
  ConversationMessage.

* ui/conversation-message.ui: GtkBuilder template for new widget.

* ui/conversation-message-menu.ui: GtkBuilder for the message menu. This
  is a separate file since GTK+ 3.10 doesn't support GtkPopoverMenu and I
  can't build it using Glade otherwise.

* src/CMakeLists.txt: Added new source file.

* po/POTFILES.in, ui/CMakeLists.txt: Added new UI files.
2016-10-04 10:58:17 +11:00
Michael James Gratton
8191ed4298 Add Insert Image button, action and hander to composer. Bug 712995.
* src/client/composer/composer-widget.vala (ComposerWidget): Add action
  and callback that simply does a normal attachment for now.

* ui/composer-widget.ui: Add insert image button to the composer toobar.
2016-10-04 10:35:49 +11:00
Michael James Gratton
e6c6e7c013 Update help text for move/label shortcuts in manual/help overlay.
Make it describe the result of the action, not the UI effect.
2016-10-04 09:54:06 +11:00