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.
* 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.
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.
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.
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.
* 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.
Since we want GearyController to handle the effects of most user actions,
we've had to duplicate ConversationMessage's signals on
ConversationViewer and chain them down.
Instead, add a message_added & message_removed signal to
ConversationViewer and emit them as appropriate, then have
GearyController connect to those and manually manage hooking/unhooking
itself to ConversationMessage signals as instances are added/removed.
Do this to the link clicked signal to start.
* src/client/application/geary-controller.vala: Add on_message_added and
on_message_removed handlers, connect them to the main window's
ConversationViewer instance and added/remove the message's link click
hander there.
* src/client/conversation-viewer/conversation-viewer.vala: Add
message_added and message_removed signals, hook them up as messages are
added and removed. Remove link_selected signal and plumbing.
* src/client/conversation-viewer/conversation-message.vala: Rename
link_selected to link_activated to match GTK nomenclature better.
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.
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.
* 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.
* src/client/application/geary-application.vala (GearyApplication): Move
action names, entries and callbacks from GearyController to here. Add a
new mailto action that expects an argument, make compose just open a
blank composer.
* src/client/application/geary-controller.vala (GearyController): Add
::compose() and ::compose_mailto() methods to support app actions.
* src/client/application/geary-controller.vala
(GearyController::create_compose_widget_async): Load draft manager and
email entry completion model asynchronously after the UI has been made
visible.
* src/client/composer/composer-widget.vala (ComposerWidget): Rename
set_entry_completions to load_entry_completions, make loading
async. Make open_draft_manager_async and load_entry_completions public
so they can be invoked by the controller.
* src/client/composer/contact-list-store.vala (ContactListStore): Load
contacts asynchronously in smaller batches, so the UI
remains responsive.
Now using these instead of the old composer's actions. This led to quite
some changes:
* Use GLib.ActionEntry instead of Gtk.ActionEntry in
composer-widget.vala
* Action names can now be specified in the UI files.
* Use templates for the ComposerHeaderBar. Remove
Pillbar as superclass, since that was no longer necessary.
* Merge ComposerToolbar into ComposerWidget.
* Since actions can now be parameterized, some methods could be
merged (e.g. font size methods).
* The menu button in the composer now automatically uses a popover.
* Some methods and classes really deserved more comments.
* necessary POTFILES.in changes
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
* src/engine/api/geary-account-information.vala (AccountInformation):
Add a display_name property, use that in the client wherever a unique
name for an account has to be shown to the user. Update all other cases
to use `id` or `primary_mailbox`.
* src/client/accounts/add-edit-page.vala: Add id property, use that when
determining if an account is new or is being edited.
* src/client/accounts/account-dialog-account-list-pane.vala
(AccountDialogAccountListPane): Add the account's id to the list model,
use that instead of the email address as the primary key.
- Make use of the "search-changed" signal to handle user input, this
lets us get rid of the built-in timeout mechanism. This reduces the
timeout from 250ms to 150ms after user input before doing the search
though.
- Use the "activate" and "stop-search" signals for the entry. This
lets us remove our handling of key events.
https://bugzilla.gnome.org/show_bug.cgi?id=720993
Move Geary.FolderSupport.Archive interface and implementation from
OtherFolder to GenericFolder, so both Y! and Outlook services get archive
support.
* src/client/components/main-toolbar.vala
(MainToolbar::update_trash_button): Renamed from
update_trash_archive_buttons, only bother to update the archive
state. Update call sites.
* src/engine/api/geary-account.vala (Geary.Account): Remove
can_support_archive property and constructor arg, update subclasses to
not pass it through.
* src/engine/imap-engine/imap-engine-generic-folder.vala (GenericFolder):
Extend Geary.FolderSupport.Archive, copy implementation from
OtherFolder.
* src/engine/imap-engine/other/imap-engine-other-folder.vala
(OtherFolder): Remove Geary.FolderSupport.Archive parent class and
implementation.
* src/client/application/geary-controller.vala
(GearyController::create_actions): Remove uneeded calls to
add_accelerator - just remove them for dups ot move them to the action
definition. Ensure they are defined in accelerators.ui so they are
bound to their accelerators regarcdless of having a visible proxy.
* help/C/shortcuts.page: Document new shortcuts.
* src/client/application/geary-controller.vala: Add shortcuts for copy
and move actions.
* src/client/components/pill-toolbar.vala (PillBar::create_menu_button):
Hook up the button's related action to invoke the button's popup menu,
taking care not to cause an infinte loop.
(PillBar::setup_button): Connect to the related_action's tooltip notify
signal via a local variable rather than via the button, so it does not
get lost when it changes for Gtk.MenuButton actions.
When the shell is not showing the app menu, we are adding a gear menu and
using that for the app menu to work around an issue in Mint Cinnamon
always showing a menu bar when an app menu was present. However under
gnome-shell, this causes both Geary and gnome-shell to both start fully
consuming the CPU when the gear menu was activated.
Perhaps GtkApplication{Window} was notifying or querying shell about the
state of the actions since they are in the in the "app" namespace, but
shell not knowing or caring about them was returning an error, causing
Geary to retry?
Removing the gear menu and letting GTK+ add its own app menu to the
header when shell is not showing it fixes the issue.
We could load the app_menu actions into the "win" namespace, but that
would require adding yet more workarounds (at least a duplicate
app_menu.ui file or something else similary sucky) for someone else's bug
and for users that will never see or need the fix.
Bug 759980.
* src/client/application/geary-controller.vala: Always set the
application's app_menu.
* src/client/components/main-toolbar.vala,
src/client/composer/composer-headerbar.vala: Remove gear menu.
* src/client/components/main-window.vala: Set show-menubar to false
so we either get the shell managed app-menu or GTK managed one
in the header bar.
Bug 763961.
* src/client/application/geary-application.vala
(GearyApplication::present): Always call show_all on the main window
since if started hidden, it won't have had that called on it.
* src/client/application/geary-controller.vala:
(GearyController::on_indicator_activated_application,
GearyController::on_indicator_activated_composer,
GearyController::on_indicator_activated_inbox): Always call show_all
on the main window since if started hidden, it won't have had that
called on it.
When implementing bug 765359, it appears that Geary is doing too much
work to load icons. Simplify it a bit.
* src/client/components/icon-factory.vala (IconFactory): Don't bother
loading an application icon, it's easier and works better to just use
an icon name where needed. Don't bother adding all of the icons/*x*
directories to the icon theme search path, just make the icon's
directory hierarchy follow the XDG/hicolor spec and add the base
directory. Remove now-redundant code.
* src/client/application/geary-controller.vala: Set the default icon name
for all geary windows.
(GearyController:on_about()): Set the name for the icon in the About
dialog.
* src/client/components/main-window.vala (ApplicationWindow): Don't
bother loading icons for the window, just use the new default.
* src/client/notification/libnotify.vala: Don't bother passing the
application icon through for error notifications, an icon name has
already been set.
* icons/*x*/geary.png: Move to a new directory hierarchy that follows the
hicolor spec.
* icons/CMakeLists.txt: Updated to use new paths to the icons.
First, create a composer action corresponding to the app menu, instead
of reusing the one from the controller. Second, create the menu from a
MenuModel, instead of from a UIManager, so we can have many of them.
https://bugzilla.gnome.org/show_bug.cgi?id=746504
This prevents a lot of extraneous (and often erroring) operations
when Geary closes, particularly due to the conversation and folder
list selections changing as items are removed.
For now, the undo stack is 1-deep with no redo facility, which mimics
Gmail's facility. We can consider later offering a more involved
undo stack, but would like to try this out for now and work out the
kinks before becoming more aggressive.
Although this doesn't solve the problems described in the bug, there
was some perceived improvement in reducing the occurrence. These
changes also clean up the code, being verbose about distinguishing
between sorting by sent date (i.e. the Date: header field) and
received date (i.e. in EmailProperties, i.e. IMAP's INTERNALDATE).
There was one comparator that did not have a proper stabilizer; that's
fixed here as well.
This allows us to avoid messing with the state of the conversation
viewer when we're composing a new message. Instead, we hide it
completely and show only the ComposerBox.
The styling of paned composer is changed to resemble that of the inline
composers. Because of restrictions on what styles are available for
various widgets, the ComposerBox becomes a Gtk.Frame, and its border
simulates the margin while some padding and an inset shadow simulate the
border. I haven't figured out how to do an outset box-shadow.
https://bugzilla.gnome.org/show_bug.cgi?id=743670
If a command fails due to a hard error (connection dropped, network
loss, etc.), the command is preserved in the in-memory Folder queue
and retried when the connection is reestablished. This makes Geary
more robust and resistant to simple errors due to connection loss,
i.e. archiving a message and having it return later because the
archive command was dropped and, when the connection reestablished,
the message "reappears" because it's still on the server.
Note that this is *not* offline mode or a replacement for it, merely
a way to make Geary more robust when a user's connection is flaky.
This patch drastically improves network connection handling and
reestablishment. In particular, the ImapEngine.Folder's open_count
wasn't always properly maintained (in the engine and the client)
causing connection reestablishment issues. Also, prior code attempted
to deduce when to reestablish a connection based on the type of Error
encountered. Now, as long as the Folder's open_count is greater than
zero, reestablishment will be attempted (with a back-off algorithm and
special cases in the ClientSessionManager preventing continual login,
i.e. when credentials are bad).
ClientSessionManager also has a back-off algorithm when it's adjusting
its session pool and uses the NetworkMonitor to detect when the host
is simply unavailable due to the network being unavailable (to prevent
continuous retries).
In addition to the above bug, this patch solves the following tickets:
Bug #714595
Bug #725959
Bug #712960
We do this heuristically, by noting which messages it is in reply to and
seeing if it matches the unmodified reply or reply all states. This
isn't perfect; notably forwarded messages are picked up.
We hide the existing draft in the conversation viewer as soon as we open
the composer. We also ensure that future versions of this draft will
also be hidden. The list of emails to be hidden is cleared when the
conversation viewer is, so we query all open composers at this point to
see which email ids should be hidden.
https://bugzilla.gnome.org/show_bug.cgi?id=743067
When replying to a message, we use the existing inline composer if it
already references the message we're replying to, or if we're replying
with a quote. Replies without quotes get made into new composers.
When adding a new message as a reply in a composer, we add the relevant
addresses to the to and cc lines, based on the current reply type. We
remove duplicates, and don't include any to addresses as cc. We also
keep track of a total to and total cc list, which gets swapped in if a
reply action is to change the reply type.
We keep track of all the replied-to message ids and include all of them
in the In-Reply-To header. However, the References header only includes
message ids from the first message replied to. This is because RFC 2822
requires this header to represent a single lineage, which we cannot
guarantee if we're replying to different branches of the conversation.
With the Empty button now attached to Archive/Trash/Delete, it's now
less lopsided for only Archive to have a label. This removes the
label from Trash/Delete (which also makes it more innocuous when the
user presses Shift a lot, i.e. while editing in the inline composer),
which in turns simplifies building the main toolbar.